/* =====================================================
   RESET E CONFIGURAÇÕES GLOBAIS
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2c3e50;
}

/* =====================================================
   LAYOUT PRINCIPAL
   ===================================================== */
.container {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   SIDEBAR (MENU LATERAL)
   ===================================================== */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #ecf0f1;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
}

.sidebar-header h3 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
}

.sidebar-nav ul {
    list-style: none;
    flex-grow: 1;
    padding: 20px 0;
}

.sidebar-nav li {
    margin: 5px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    font-weight: 500;
}

.sidebar-nav a:hover {
    background: rgba(102, 126, 234, 0.2);
    border-left-color: #667eea;
    padding-left: 30px;
}

.sidebar-nav a.active {
    background: rgba(102, 126, 234, 0.3);
    border-left-color: #667eea;
}

.logout-link {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-link a {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.logout-link a:hover {
    background: rgba(231, 76, 60, 0.4);
    border-left-color: #e74c3c;
}

/* =====================================================
   CONTEÚDO PRINCIPAL
   ===================================================== */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 40px;
    background: #f8f9fa;
    min-height: 100vh;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 900;
    margin-bottom: 30px;
    margin-top: -40px;
    /* Compensa padding do main-content */
    margin-left: -40px;
    margin-right: -40px;
    padding: 20px 40px;
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid #eee;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
}

/* =====================================================
   CARDS DO DASHBOARD
   ===================================================== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border-left: 5px solid #667eea;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.card h3 {
    font-size: 14px;
    font-weight: 600;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.card p {
    font-size: 36px;
    font-weight: 700;
    color: #667eea;
}

.card.warning {
    border-left-color: #f39c12;
}

.card.warning p {
    color: #f39c12;
}

.card.danger {
    border-left-color: #e74c3c;
}

.card.danger p {
    color: #e74c3c;
}

.card.success {
    border-left-color: #27ae60;
}

.card.success p {
    color: #27ae60;
}

/* =====================================================
   BOTÕES
   ===================================================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

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

/* =====================================================
   TABELAS
   ===================================================== */
.table-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-header h2 {
    font-size: 20px;
    color: #1a1a2e;
}

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

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

thead th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: all 0.2s ease;
}

tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

tbody td {
    padding: 15px;
    color: #2c3e50;
}

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-ativo {
    background: #d5f4e6;
    color: #27ae60;
}

.status-inativo {
    background: #fadbd8;
    color: #e74c3c;
}

.status-vencido {
    background: #fdeaa8;
    color: #f39c12;
}

/* =====================================================
   FORMULÁRIOS
   ===================================================== */
.form-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    margin-top: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* =====================================================
   MODAL
   ===================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.modal-header h2 {
    color: #1a1a2e;
    font-size: 24px;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-modal:hover {
    color: #e74c3c;
    transform: rotate(90deg);
}

/* =====================================================
   PÁGINA DE LOGIN
   ===================================================== */
.login-container {
    background: white;
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 450px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #1a1a2e;
    font-size: 28px;
}

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

.login-logo h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 36px;
    font-weight: 700;
}

.btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.error-message {
    background: #fadbd8;
    color: #e74c3c;
    padding: 12px 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
    font-weight: 500;
}

/* =====================================================
   RESPONSIVIDADE
   ===================================================== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* === MENU MOBILE === */

    /* Botão Hambúrguer */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 2001;
        /* Acima do modal e overlay */
        background: #667eea;
        color: white;
        width: 45px;
        height: 45px;
        border-radius: 50%;
        font-size: 24px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
        cursor: pointer;
    }

    /* Botão Fechar (Dentro da Sidebar) */
    .close-sidebar-btn {
        display: block;
        font-size: 28px;
        cursor: pointer;
    }

    /* Sidebar Mobile */
    .sidebar {
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        /* Escondido à esquerda */
        transition: transform 0.3s ease;
        z-index: 3000;
        /* Bem alto */
    }

    .sidebar.active {
        transform: translateX(0);
        /* Mostra */
    }

    /* Overlay Escuro */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 2999;
        /* Abaixo da sidebar */
        backdrop-filter: blur(3px);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 20px;
        padding-top: 0;
        /* Header já tem padding */
    }

    .page-header {
        margin-top: 0;
        margin-left: -20px;
        margin-right: -20px;
        padding: 15px 20px 15px 70px;
        /* Esquerda maior para o botão hambúrguer */
        position: sticky;
        top: 0;
    }

    /* Melhorias de Usabilidade Mobile */

    /* Aumentar fonte base */
    body {
        font-size: 16px;
    }

    /* Cards maiores */
    .card {
        padding: 30px;
    }

    .card h3 {
        font-size: 16px;
    }

    .card p {
        font-size: 42px;
        /* Números maiores */
    }

    /* Botões mais fáceis de tocar */
    .btn,
    .btn-sm,
    button,
    input[type="submit"] {
        padding: 15px 25px;
        /* Área de toque maior */
        font-size: 16px;
        min-height: 44px;
        /* Altura mínima recomendada */
    }

    /* Inputs maiores */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 15px;
        font-size: 16px;
        /* Evita zoom no iPhone */
    }
}

/* ESCONDER NO DESKTOP */
@media (min-width: 769px) {

    .mobile-menu-btn,
    .close-sidebar-btn,
    .sidebar-overlay {
        display: none;
    }
}