* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #e67e22;
    --primary-dark: #d35400;
    --secondary-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-bg: #1a3a5c;
    --light-bg: #f5f6fa;
    --sidebar-bg: #1a3a5c;
    --text-dark: #1a3a5c;
    --text-light: #7f8c8d;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --orange-gradient: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--dark-bg);
    position: relative;
    overflow: hidden;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-logo {
    text-align: center;
    margin-bottom: 25px;
}

.login-logo img {
    max-width: 280px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.3));
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-row .form-group {
    margin-bottom: 0;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--orange-gradient);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #d35400 0%, #e67e22 100%);
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.4);
}

.btn-secondary {
    background: var(--text-light);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-dark);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-block {
    width: 100%;
}

.registro-link {
    text-align: center;
    margin-top: 20px;
}

.registro-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.registro-link a:hover {
    text-decoration: underline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 40px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    color: var(--text-light);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: var(--text-dark);
}

/* Messages */
.mensagem {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 5px;
    display: none;
}

.mensagem.sucesso {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.mensagem.erro {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
    position: relative;
    background: var(--light-bg);
}

.dashboard::before {
    content: '';
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    bottom: 0;
    background: url('../img/logo-walter.png') center center no-repeat;
    background-size: 50%;
    filter: blur(3px);
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0,0,0,0.2);
}

.sidebar-header h2 {
    font-size: 20px;
}

.user-info {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.user-details small {
    display: block;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.2);
    color: white;
    border-left: 4px solid var(--primary-color);
}

.nav-item .icon {
    font-size: 20px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    max-width: calc(100vw - 260px);
    overflow-x: hidden;
    position: relative;
    z-index: 1;
}

.content-header {
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 32px;
    color: var(--text-dark);
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 48px;
    opacity: 0.8;
}

.stat-info h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
}

/* Forms */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.localizacao-info {
    background: #e8f4f8;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid var(--primary-color);
    margin-top: 10px;
}

/* Tables */
.table-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    max-width: 100%;
}

.recent-section {
    margin-top: 30px;
}

.recent-section h2 {
    margin-bottom: 20px;
    color: var(--text-dark);
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Larguras específicas para colunas da lista de pessoas */
table th:nth-child(1), table td:nth-child(1) { width: 12%; } /* Nome */
table th:nth-child(2), table td:nth-child(2) { width: 10%; } /* Telefone */
table th:nth-child(3), table td:nth-child(3) { width: 15%; } /* Endereço */
table th:nth-child(4), table td:nth-child(4) { width: 8%; }  /* Bairro */
table th:nth-child(5), table td:nth-child(5) { width: 10%; } /* Título */
table th:nth-child(6), table td:nth-child(6) { width: 12%; } /* Demanda */
table th:nth-child(7), table td:nth-child(7) { width: 10%; } /* Status */
table th:nth-child(8), table td:nth-child(8) { width: 8%; }  /* Localização */
table th:nth-child(9), table td:nth-child(9) { width: 8%; }  /* Data */
table th:nth-child(10), table td:nth-child(10) { width: 7%; min-width: 120px; } /* Ações */

table th {
    background: var(--light-bg);
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

table tr:hover {
    background: #f8f9fa;
}

/* Truncar texto longo nas células */
table td {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mostrar texto completo no hover */
table td:hover {
    overflow: visible;
    white-space: normal;
    word-break: break-word;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* List Header */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.search-box {
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--sidebar-bg);
    color: white;
    z-index: 998;
    padding: 0 15px;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.mobile-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    line-height: 1;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Responsive - Tablets */
@media (max-width: 1024px) {
    .main-content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Esconde colunas menos importantes em tablets */
    table th:nth-child(5), table td:nth-child(5),
    table th:nth-child(8), table td:nth-child(8) {
        display: none;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        background: var(--sidebar-bg);
    }
    
    .dashboard::before {
        left: 0;
        background-size: 80%;
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        z-index: 1001;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 80px 15px 15px;
        max-width: 100vw;
    }
    
    .content-header h1 {
        font-size: 24px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-container {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .stat-icon {
        font-size: 32px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-info h3 {
        font-size: 12px;
    }
    
    .list-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .search-box,
    .filter-box {
        max-width: 100%;
        flex: 1 1 100%;
    }
    
    .list-header .btn {
        width: 100%;
    }
    
    /* Tabela em formato de cards no mobile */
    .table-container {
        padding: 10px;
        background: transparent;
        box-shadow: none;
    }
    
    table, thead, tbody, th, td, tr {
        display: block;
        width: 100% !important;
    }
    
    thead {
        display: none;
    }
    
    tbody {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    tr {
        margin-bottom: 0;
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        padding: 15px;
        border: 1px solid var(--border-color);
    }
    
    td {
        padding: 10px 0;
        border-bottom: 1px solid #eee;
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        width: 100% !important;
        max-width: none !important;
        overflow: visible !important;
        white-space: normal !important;
    }
    
    td:last-child {
        border-bottom: none;
        padding-top: 15px;
        justify-content: center;
    }
    
    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-dark);
        text-align: left;
        flex: 0 0 35%;
        padding-right: 10px;
    }
    
    td:last-child::before {
        content: none;
    }
    
    /* Mostra todas as colunas no mobile em formato card */
    table th:nth-child(5), table td:nth-child(5),
    table th:nth-child(8), table td:nth-child(8) {
        display: flex !important;
    }
    
    .action-buttons {
        justify-content: center;
        width: 100%;
    }
    
    .btn-sm {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .recent-section h2 {
        font-size: 18px;
    }
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 64px;
    opacity: 0.5;
    margin-bottom: 20px;
}

/* Modal de Exclusão */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: 90%;
    transform: scale(0.8) translateY(-20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 30px 30px 20px;
    text-align: center;
}

.modal-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 32px;
}

.modal-icon.danger {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
}

.modal-header h2 {
    font-size: 1.4rem;
    color: var(--text-dark);
    margin: 0;
}

.modal-body {
    padding: 0 30px 25px;
    text-align: center;
}

.modal-body p {
    color: var(--text-light);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.modal-warning {
    color: var(--danger-color) !important;
    font-size: 0.85rem !important;
    font-weight: 500;
}

.modal-pessoa-info {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    text-align: left;
}

.modal-pessoa-info strong {
    color: var(--text-dark);
    display: block;
    margin-bottom: 5px;
}

.modal-pessoa-info span {
    color: var(--text-light);
    font-size: 0.9rem;
}

.modal-footer {
    padding: 20px 30px;
    background: var(--light-bg);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 100px;
    padding: 12px 20px;
}

.modal-footer .btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.modal-footer .btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Notificação Toast */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 16px 24px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1001;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-notification.sucesso {
    border-left: 4px solid var(--secondary-color);
}

.toast-notification.erro {
    border-left: 4px solid var(--danger-color);
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-message {
    color: var(--text-dark);
    font-weight: 500;
}

@media (max-width: 480px) {
    .modal-container {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header, .modal-body {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .toast-notification {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
}

/* Badges para status de demanda */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 5px;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Filtro de demanda */
.filter-box {
    flex: 0 0 200px;
}

.filter-box select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

.filter-box select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Status da demanda - Botões elegantes */
.status-demanda {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.status-demanda i {
    font-size: 12px;
}

.status-resolvida {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.3);
}

.status-resolvida:hover {
    background: linear-gradient(135deg, #219a52, #27ae60);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
    transform: translateY(-1px);
}

.status-pendente {
    background: linear-gradient(135deg, #e67e22, #f39c12);
    color: white;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.status-pendente:hover {
    background: linear-gradient(135deg, #d35400, #e67e22);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
    transform: translateY(-1px);
}

/* Ajuste responsivo para lista com mais colunas */
@media (max-width: 1200px) {
    .list-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .filter-box {
        flex: 1 1 150px;
    }
}
/* Mobile - Telas menores que 480px */
@media (max-width: 480px) {
    .modal-container {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header, .modal-body {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .toast-notification {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .login-box {
        padding: 25px;
    }
    
    .login-box h1 {
        font-size: 22px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 14px;
        font-size: 16px;
    }
    
    /* Status demanda no mobile */
    .status-demanda {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Botões de ação no card mobile */
    .action-buttons .btn {
        flex: 1;
    }
}