/**
 * CSS Principal do Sistema Annalytcs
 * Estilos globais e componentes reutilizáveis
 */

/* ==========================================
   VARIÁVEIS GLOBAIS
   ========================================== */
:root {
    /* Paleta de cores */
    --primary-green-dark: #1B4332;
    --primary-green-deeper: #0F2419;
    --accent-orange: #f97316;
    --accent-green: #059669;
    --accent-emerald: #10b981;
    
    /* Tons neutros */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Sistema de feedback */
    --success: var(--accent-emerald);
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Backgrounds */
    --bg-primary: var(--gray-50);
    --bg-card: var(--white);
    
    /* Gradientes */
    --gradient-main: linear-gradient(135deg, var(--primary-green-dark) 0%, var(--primary-green-deeper) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-green) 100%);
    --gradient-subtle: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Transições */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-out;
    --transition-slow: all 0.3s ease-in-out;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

.conteudo-principal {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    transition: var(--transition);
    min-height: 100vh;
}

/* ==========================================
   MENU HAMBÚRGUER MOBILE (À DIREITA)
   ========================================== */
.menu-toggle {
    display: none;
    background: var(--primary-green-dark);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 12px;
    position: fixed;
    top: 1rem;
    right: 1rem; /* Posicionado à direita */
    z-index: 1001;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.menu-toggle:hover {
    background: var(--primary-green-deeper);
    transform: scale(1.05);
}

.menu-toggle:active {
    transform: scale(0.98);
}

/* Animação do ícone do hambúrguer */
.menu-toggle i {
    transition: var(--transition-fast);
}

.menu-toggle.active i {
    transform: rotate(90deg);
}

/* ==========================================
   BOTÕES GLOBAIS
   ========================================== */
.btn {
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    transition: var(--transition);
    border: none;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1.5;
}

.btn:focus {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-green), var(--accent-emerald));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #047857, var(--accent-green));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
    text-decoration: none;
}

.btn-outline-primary {
    color: var(--primary-green-dark);
    border: 2px solid var(--primary-green-dark);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-green-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

/* ==========================================
   FORMULÁRIOS
   ========================================== */
.form-control {
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    transition: var(--transition);
    font-size: 0.9rem;
    width: 100%;
}

.form-control:focus {
    border-color: var(--primary-green-dark);
    box-shadow: 0 0 0 0.2rem rgba(27, 67, 50, 0.15);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    display: block;
}

.form-select {
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    transition: var(--transition);
    background-color: white;
    cursor: pointer;
}

.form-select:focus {
    border-color: var(--primary-green-dark);
    box-shadow: 0 0 0 0.2rem rgba(27, 67, 50, 0.15);
    outline: none;
}

/* ==========================================
   ALERTAS
   ========================================== */
.alert {
    border-radius: 10px;
    border: none;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.alert i {
    margin-right: 0.5rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border-left: 4px solid var(--error);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    border-left: 4px solid var(--info);
}

/* ==========================================
   BADGES
   ========================================== */
.badge {
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
}

.bg-success {
    background: linear-gradient(135deg, var(--success), var(--accent-green)) !important;
    color: white;
}

.bg-danger {
    background: linear-gradient(135deg, var(--error), #dc2626) !important;
    color: white;
}

.bg-warning {
    background: linear-gradient(135deg, var(--warning), #f59e0b) !important;
    color: white;
}

.bg-primary {
    background: linear-gradient(135deg, var(--info), #3b82f6) !important;
    color: white;
}

.bg-secondary {
    background: linear-gradient(135deg, var(--gray-500), var(--gray-600)) !important;
    color: white;
}

/* ==========================================
   CARDS
   ========================================== */
.card-custom {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.card-custom:hover {
    box-shadow: var(--shadow-lg);
}

.card-custom .card-header {
    background: var(--gradient-subtle);
    border-bottom: 1px solid var(--gray-200);
    border-radius: 16px 16px 0 0;
    padding: 1.5rem 2rem;
}

.card-custom .card-body {
    padding: 2rem;
}

/* ==========================================
   OVERLAY PARA MOBILE
   ========================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   ANIMAÇÕES
   ========================================== */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ==========================================
   RESPONSIVIDADE
   ========================================== */
@media (max-width: 768px) {
    .conteudo-principal {
        margin-left: 0;
        padding: 1rem;
    }
    
    .menu-toggle {
        display: block;
    }
    
    /* Ajusta espaçamento do botão à direita */
    .conteudo-principal {
        padding-top: 5rem; /* Espaço para o botão hambúrguer */
    }
}

@media (max-width: 576px) {
    .conteudo-principal {
        padding: 0.75rem;
        padding-top: 5rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* ==========================================
   MELHORIAS DE ACESSIBILIDADE
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visível para navegação por teclado */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

/* ==========================================
   UTILITÁRIOS
   ========================================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }

/* Mostrar apenas em mobile */
@media (max-width: 768px) {
    .d-md-none {
        display: none !important;
    }
}

/* Ocultar em mobile */
@media (max-width: 768px) {
    .d-none-mobile {
        display: none !important;
    }
}