/* =========================================
   1. VARIÁVEIS & RESET (Paleta Coco & Cia)
   ========================================= */
:root {
    /* Cores da Marca */
    --primary: #2e6f40;
    /* Verde Floresta */
    --primary-dark: #1b4332;
    /* Verde Escuro */
    --secondary: #facc15;
    /* Amarelo Solar */
    --accent: #ea580c;
    /* Laranja Terracota */

    /* Cores de Interface */
    --bg-body: #f0fdf4;
    /* Menta suave */
    --white: #ffffff;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --danger: #ef4444;
    --success: #22c55e;

    /* Efeitos */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* =========================================
   2. LAYOUT & UTILITÁRIOS
   ========================================= */
.container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.main-content {
    flex: 1;
    /* Empurra o footer para baixo */
    padding-top: 20px;
}

h1,
h2,
h3 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.text-center {
    text-align: center;
}

/* =========================================
   3. TELA DE LOGIN (Modernizada)
   ========================================= */
.login-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 20px;
}

.login-container {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.logo-area {
    margin-bottom: 1.5rem;
}

.logo-img {
    max-width: 120px;
    margin-bottom: 10px;
}

/* Inputs com Ícones */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    padding-left: 45px !important;
    /* Espaço para o ícone */
}

.input-icon {
    position: absolute;
    left: 15px;
    color: var(--text-light);
    pointer-events: none;
}

.toggle-password {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    display: flex;
}

.toggle-password:hover {
    color: var(--primary);
}

.login-footer {
    margin-top: 20px;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* =========================================
   4. FORMULÁRIOS & BOTÕES GERAIS
   ========================================= */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
    background-color: #f8fafc;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(46, 111, 64, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    display: inline-block;
    text-align: center;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    background: var(--text-light);
    color: white;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-sm:hover {
    opacity: 0.9;
}

.btn-outline {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline:hover {
    background: #ecfdf5;
}

/* =========================================
   5. HEADER & NAVEGAÇÃO
   ========================================= */
.main-header {
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 4px solid var(--secondary);
    height: 72px;
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--accent);
}

/* Menu Desktop */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-left: auto;
}

.nav-menu ul {
    display: flex;
    gap: 25px;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    font-weight: 600;
    color: var(--text-dark);
    transition: var(--transition);
    font-size: 0.95rem;
    position: relative;
    padding: 5px 0;
}

.nav-menu a:hover,
.nav-menu a.active-link {
    color: var(--primary);
}

.nav-menu a.active-link::after {
    content: '';
    display: block;
    width: 100%;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    position: absolute;
    bottom: -5px;
    left: 0;
}

.nav-user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-left: 20px;
    border-left: 1px solid #e2e8f0;
}

.user-badge {
    background-color: #ecfdf5;
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.btn-logout {
    color: var(--danger);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}

/* =========================================
   6. DASHBOARD & WIDGETS
   ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.stat-info .big-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}

.highlight-card {
    border: 2px solid var(--secondary);
    text-align: center;
}

.highlight-card .stat-icon {
    margin: 0 auto 15px auto;
    background-color: #fef9c3;
}

/* Status Text */
.status-text.success {
    color: var(--success);
    font-weight: bold;
}

.status-text.error {
    color: var(--danger);
    font-weight: bold;
}

/* Alertas */
.alert {
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.alert.error {
    background-color: #fee2e2;
    color: var(--danger);
}

.alert.success {
    background-color: #dcfce7;
    color: var(--primary);
}

/* =========================================
   7. FOOTER MODERNO & COMPACTO
   ========================================= */
.main-footer {
    background-color: var(--primary-dark);
    color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    margin-top: auto;
    font-size: 0.85rem;
    border-top: 4px solid var(--secondary);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.copyright p {
    margin: 0;
    font-weight: 400;
}

/* Status Pill (Rodapé) */
.status-pill {
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ccc;
    display: inline-block;
}

/* WhatsApp Icon */
.whatsapp-mini {
    color: #25D366;
    background: rgba(255, 255, 255, 0.1);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.3s;
}

.whatsapp-mini:hover {
    background: #25D366;
    color: white;
    transform: scale(1.1);
}

/* =========================================
   8. MODAIS GLOBAIS
   ========================================= */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.custom-modal-box {
    background: var(--white);
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
    /* Scroll para modais grandes */
}

.custom-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.custom-modal-overlay.active .custom-modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 15px;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: 0.2s;
}

.close-modal:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

/* =========================================
   9. ELEMENTOS DE COLETA (Câmera)
   ========================================= */
.camera-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.camera-box:hover,
.camera-box.active {
    border-color: var(--primary);
    background: #f0fdf4;
}

.camera-box input[type="file"] {
    display: none;
}

.camera-content {
    text-align: center;
    pointer-events: none;
    z-index: 2;
}

.camera-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    display: none;
}

/* =========================================
   10. RESPONSIVIDADE (MOBILE MENU)
   ========================================= */
.menu-toggle {
    display: none;
}

.nav-overlay {
    display: none;
}

@media (max-width: 900px) {
    .menu-toggle {
        display: block;
        background: none;
        border: none;
        cursor: pointer;
        padding: 5px;
        z-index: 1001;
    }

    .bar {
        display: block;
        width: 25px;
        height: 3px;
        margin: 5px auto;
        background-color: var(--primary);
        border-radius: 2px;
        transition: var(--transition);
    }

    /* Menu Lateral */
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100vh;
        background: var(--white);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 30px;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        margin-left: 0;
        gap: 0;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .nav-overlay.active {
        display: block;
        opacity: 1;
    }

    .nav-menu ul {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid #f1f5f9;
    }

    .nav-menu a {
        display: block;
        padding: 15px 0;
        font-size: 1.1rem;
    }

    .nav-menu a.active-link {
        color: var(--primary);
        background: #f0fdf4;
        padding-left: 10px;
        border-left: 4px solid var(--accent);
    }

    .nav-menu a.active-link::after {
        display: none;
    }

    .nav-user-actions {
        margin-top: auto;
        flex-direction: column;
        width: 100%;
        gap: 20px;
        padding: 20px 0 0 0;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        text-align: center;
    }

    /* Footer Mobile */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .footer-section {
        justify-content: center;
        width: 100%;
    }

    /* Animação Botão X */
    .menu-toggle.is-active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
        background-color: var(--danger);
    }

    .menu-toggle.is-active .bar:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.is-active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
        background-color: var(--danger);
    }
}