/* CSS Design System - AlfaTrack
 * Identidade Visual Oficial da Alfagek Tecnologia
 * Aparência: Tecnologia, Segurança, Profissionalismo, Minimalismo e Elegância Corporativa.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #F8FAFC;       /* Fundo Claro */
    --bg-secondary: #04442C;     /* Verde Institucional (usado no menu lateral) */
    --bg-card: #FFFFFF;          /* Branco */
    --border-color: #E5E7EB;     /* Cinza Claro */
    
    --primary-color: #04442C;    /* Verde Institucional */
    --primary-gradient: linear-gradient(135deg, #04442C 0%, #0B6E4F 100%);
    --primary-glow: rgba(4, 68, 44, 0.1);
    
    --accent-color: #0B6E4F;     /* Verde Claro */
    --accent-gradient: linear-gradient(135deg, #04442C 0%, #0B6E4F 100%);
    
    --danger-color: #ef4444;     /* Vermelho de erro */
    --warning-color: #f59e0b;    /* Amarelo de aviso */
    --success-color: #04442C;    /* Verde institucional para sucesso */
    
    --text-main: #374151;        /* Cinza Escuro */
    --text-muted: #6B7280;       /* Cinza Médio */
    --text-dark: #1f2937;
    
    --sidebar-width: 260px;
    --transition-speed: 0.25s;
    --border-radius: 12px;       /* Raio padrão oficial de 12px */
    --shadow-premium: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02); /* Sombra muito suave */
    --glass-blur: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Roboto', 'Segoe UI', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation (Verde Institucional) */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: #FFFFFF;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    fill: #04442C;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #FFFFFF;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

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

.nav-group-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    user-select: none;
}

.nav-group-header:hover {
    background: #065F46; /* Verde Secundário */
    color: #FFFFFF;
}

.nav-group-header svg:first-child {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.nav-group-header span {
    flex-grow: 1;
}

.chevron-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: transform 0.3s ease;
}

.nav-group.collapsed .chevron-icon {
    transform: rotate(-90deg);
}

.nav-group-links {
    list-style: none;
    padding-left: 1.5rem;
    margin: 0;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s;
    opacity: 1;
}

.nav-group.collapsed .nav-group-links {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.nav-group-links li {
    margin: 0.25rem 0;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all var(--transition-speed) ease;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.nav-link:hover {
    color: #FFFFFF;
    background: #065F46; /* Verde Secundário */
}

.nav-link.active {
    background: #0B6E4F; /* Verde Claro */
    color: #FFFFFF;
}

.user-profile-section {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #FFFFFF; /* Texto branco no menu lateral */
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    color: rgba(255, 255, 255, 0.7);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
}

.btn-logout:hover {
    color: #ef4444;
    background: rgba(255, 255, 255, 0.1);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    min-height: 100vh;
    background-color: var(--bg-primary);
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* Cards & Statistics (Tema Claro) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.stat-data h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-data p {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.primary {
    background: rgba(4, 68, 44, 0.1);
    color: var(--primary-color);
}

.stat-icon.accent {
    background: rgba(11, 110, 79, 0.1);
    color: var(--accent-color);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all var(--transition-speed) ease;
}

.btn-primary {
    background: #04442C; /* Verde Institucional */
    color: #FFFFFF;
    border-radius: 8px;
}

.btn-primary:hover {
    background: #065F46; /* Verde Secundário */
    color: #FFFFFF;
}

.btn-secondary {
    background: #FFFFFF;
    color: #04442C;
    border: 1px solid #04442C;
    border-radius: 8px;
}

.btn-secondary:hover {
    background: #F8FAFC;
    color: #04442C;
    border-color: #04442C;
}

/* Tables (Estilo Oficial Alfagek) */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
    overflow-x: auto;
    margin-bottom: 2rem;
}

.table-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    background-color: #04442C; /* Fundo do cabeçalho */
    color: #FFFFFF;           /* Texto branco */
    padding: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.custom-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-main);
}

.custom-table tr:last-child td {
    border-bottom: none;
}

.custom-table tbody tr {
    transition: background-color var(--transition-speed) ease;
}

.custom-table tbody tr:hover {
    background-color: #F8FAFC; /* Hover oficial */
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(4, 68, 44, 0.1);
    color: var(--primary-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
}

/* Forms */
.form-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-premium);
    max-width: 700px;
    margin: 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-full-width {
    grid-column: span 2;
}

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

.form-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-input, .form-select, .form-textarea {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
    width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #04442C; /* Foco Verde Institucional */
    box-shadow: 0 0 0 3px rgba(4, 68, 44, 0.15);
    background: #FFFFFF;
}

select.form-input option, select.form-select option {
    background-color: #FFFFFF;
    color: var(--text-main);
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Login Screen - Light Corporate Card */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: var(--bg-primary);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-premium);
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.login-logo svg {
    width: 32px;
    height: 32px;
    fill: #04442C;
}

.login-logo span {
    font-size: 1.75rem;
    font-weight: 800;
    color: #04442C;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2.5rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.alert-success {
    background: rgba(4, 68, 44, 0.08);
    border: 1px solid rgba(4, 68, 44, 0.15);
    color: #04442C;
}

/* Autocomplete Lists styles */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #F8FAFC;
    color: #04442C;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1.5rem;
    }
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-full-width {
        grid-column: span 1;
    }
}

/* Custom Checkbox Group */
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
}
