@import url('https://fonts.googleapis.com/css2?family=Pacifico&display=swap');

/* ===== VARIÁVEIS CSS ===== */
:root {
    --primary-color: #ffffff;      /* Cor principal do tema */
    --secondary-color: #1a3353;    /* Cor secundária do tema */
    --tertiary-color: #950d0d;     /* Cor terciária do tema para detalhes */
    --fourth-color: #e0bf5e;       /* Quarta cor do tema */
    --fifth-color: #ce0001;        /* Quinta cor do tema */
    
    --text-primary: #1a3353;
    --text-secondary: #6c757d;
    --text-light: #ffffff;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-dark: #1a3353;
    --bg-accent: #e0bf5e;
    
    --border-color: #dee2e6;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(26, 51, 83, 0.1);
    --box-shadow-hover: 0 4px 20px rgba(26, 51, 83, 0.15);
    
    --transition: all 0.3s ease;
    
    /* Novas variáveis para padronização */
    --font-size-base: 0.875rem;
    --font-size-sm: 0.8rem;
    --font-size-xs: 0.75rem;
    --line-height-base: 1.6;
    --spacing-base: 1rem;
    --spacing-sm: 0.5rem;
    --spacing-xs: 0.25rem;
}

/* ===== RESET E BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Garantir que os cards não sejam afetados por outros estilos */
.plataforma-cards,
.aulas-cards {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)) !important;
    gap: 2rem !important;
    margin: 2rem 0 !important;
    padding: 1rem !important;
}

.plataforma-card,
.aula-card {
    background: #ffffff !important;
    border-radius: 20px !important;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.1),
        0 4px 10px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(26, 51, 83, 0.08) !important;
    border: 2px solid rgba(26, 51, 83, 0.1) !important;
    position: relative !important;
    min-height: 400px !important;
    margin-bottom: 2rem !important;
    overflow: hidden !important;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: var(--line-height-base);
    overflow-x: hidden;
    font-size: var(--font-size-base);
}

/* ===== CONTAINER FLUID IMPROVEMENTS ===== */
.container-fluid {
    max-width: 100%;
    padding-left: var(--spacing-base);
    padding-right: var(--spacing-base);
}

/* ===== HEADER ===== */
.navbar {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2a4a7a 100%);
    box-shadow: var(--box-shadow);
    padding: 0.75rem 0;
    transition: var(--transition);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-light) !important;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.navbar-brand:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.navbar-toggler {
    border: none;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-toggler:focus {
    box-shadow: none;
    background-color: rgba(255, 255, 255, 0.2);
}

.navbar-nav .nav-link {
    color: var(--text-light) !important;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    margin: 0 0.25rem;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.handwriting-title {
    font-family: 'Pacifico', cursive;
    font-size: 1.5rem;
    color: var(--text-light);
    letter-spacing: 0.5px;
    font-weight: 400;
    line-height: 1.1;
    text-shadow: 0 1px 2px rgba(26,51,83,0.10);
    white-space: nowrap;
}

/* ===== DROPDOWN NO HEADER ===== */
.navbar .dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    z-index: 1100;
    margin-top: 0.5rem;
    min-width: 180px;
    box-shadow: 0 4px 16px rgba(26,51,83,0.10);
}

.navbar .dropdown {
    position: relative;
}

/* ===== SIDEBAR ===== */
.sidebar {
    background: var(--bg-primary);
    box-shadow: var(--box-shadow);
    border-right: 1px solid var(--border-color);
    transition: var(--transition);
    position: fixed;
    top: 60px; /* Altura do header */
    left: 0;
    width: 280px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-sticky {
    padding: 1rem 0;
    height: 100%;
    overflow-y: auto;
}

/* Estilizar scrollbar do sidebar */
.sidebar-sticky::-webkit-scrollbar {
    width: 6px;
}

.sidebar-sticky::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-sticky::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar-sticky::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Sidebar do CRM também fixo */
.bg-light.sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 280px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 1000;
    background: var(--bg-primary) !important;
    box-shadow: var(--box-shadow);
    border-right: 1px solid var(--border-color);
}

.nav.flex-column .nav-item {
    margin-bottom: 0.25rem;
}

.nav.flex-column .nav-link {
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.875rem 1.5rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin: 0 0.5rem 0 0;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav.flex-column .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(135deg, var(--secondary-color), var(--fourth-color));
    transition: var(--transition);
    z-index: -1;
}

.nav.flex-column .nav-link:hover::before,
.nav.flex-column .nav-link.active::before {
    width: 100%;
}

.nav.flex-column .nav-link:hover,
.nav.flex-column .nav-link.active {
    color: var(--text-light);
    transform: translateX(5px);
}

.nav.flex-column .nav-link i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* ===== MAIN CONTENT ===== */
main {
    background-color: var(--bg-secondary);
    min-height: calc(100vh - 60px);
    padding: 2rem;
    overflow-x: hidden;
    margin-left: 280px; /* Compensar o sidebar fixo */
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-primary);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--box-shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--secondary-color), #2a4a7a);
    color: var(--text-light);
    border: none;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* ===== STATS CARDS ===== */
.stats-card {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2a4a7a 100%);
    color: var(--text-light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(224, 191, 94, 0.1) 0%, transparent 70%);
    transition: var(--transition);
}

.stats-card:hover::before {
    transform: scale(1.2);
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-hover);
}

.stats-card .stats-icon {
    font-size: 2.5rem;
    color: var(--fourth-color);
    margin-bottom: 1rem;
}

.stats-card .stats-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-card .stats-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-base);
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color), #2a4a7a);
    color: var(--text-light);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2a4a7a, var(--secondary-color));
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-hover);
}

.btn-secondary {
    background: var(--fourth-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #d4b55a;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--fifth-color);
    color: var(--text-light);
}

.btn-danger:hover {
    background: var(--tertiary-color);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: var(--text-light);
}

.btn-success:hover {
    background: linear-gradient(135deg, #20c997, #28a745);
    transform: translateY(-2px);
}

/* ===== TABLES ===== */
.table {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    font-size: var(--font-size-base);
    margin-bottom: 0;
}

.table thead th {
    background: linear-gradient(135deg, var(--secondary-color), #2a4a7a);
    color: var(--text-light);
    border: none;
    padding: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: var(--font-size-sm);
    white-space: normal;
    word-wrap: break-word;
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    white-space: normal;
    word-wrap: break-word;
    max-width: 300px;
}

.table tbody tr:hover {
    background-color: rgba(224, 191, 94, 0.05);
}

/* ===== TABLE RESPONSIVE IMPROVEMENTS ===== */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.table-responsive .table {
    box-shadow: none;
}

/* ===== FORMS ===== */
.form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    transition: var(--transition);
    background-color: var(--bg-primary);
    font-size: var(--font-size-base);
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem rgba(26, 51, 83, 0.25);
    background-color: var(--bg-primary);
}

.form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    transition: var(--transition);
    background-color: var(--bg-primary);
    font-size: var(--font-size-base);
}

.form-select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem rgba(26, 51, 83, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: var(--font-size-base);
}

/* ===== ALERTS ===== */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    font-weight: 500;
    font-size: var(--font-size-base);
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left: 4px solid var(--fifth-color);
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border-left: 4px solid var(--fourth-color);
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-left: 4px solid var(--secondary-color);
}

/* ===== BADGES ===== */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: var(--font-size-xs);
}

.badge-primary {
    background: var(--secondary-color);
    color: var(--text-light);
}

.badge-success {
    background: #28a745;
    color: var(--text-light);
}

.badge-warning {
    background: var(--fourth-color);
    color: var(--text-primary);
}

.badge-danger {
    background: var(--fifth-color);
    color: var(--text-light);
}

/* ===== MODALS ===== */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-hover);
}

.modal-header {
    background: linear-gradient(135deg, var(--secondary-color), #2a4a7a);
    color: var(--text-light);
    border: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* ===== LOADING SPINNER ===== */
.spinner-border {
    color: var(--secondary-color);
}

/* ===== UTILITIES ===== */
.text-primary {
    color: var(--secondary-color) !important;
}

.text-secondary {
    color: var(--fourth-color) !important;
}

.text-danger {
    color: var(--fifth-color) !important;
}

.bg-primary {
    background-color: var(--secondary-color) !important;
}

.bg-secondary {
    background-color: var(--fourth-color) !important;
}

.bg-danger {
    background-color: var(--fifth-color) !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    main {
        padding: 1.5rem;
        margin-left: 280px; /* Manter sidebar fixo em tablets */
    }
    
    .stats-card {
        padding: 1.25rem;
    }
    
    .stats-card .stats-number {
        font-size: 2rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding-left: var(--spacing-sm);
        padding-right: var(--spacing-sm);
    }
    
    main {
        padding: 1rem;
        margin-left: 0 !important; /* Reset margin em mobile */
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: var(--transition);
        overflow-y: auto;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    /* Reset margin do CRM em mobile */
    .bg-light.sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: var(--transition);
        overflow-y: auto;
    }
    
    .bg-light.sidebar.show {
        left: 0;
    }
    
    .stats-card {
        margin-bottom: 1rem;
        padding: 1rem;
    }
    
    .stats-card .stats-number {
        font-size: 1.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        border-radius: var(--border-radius);
        overflow: hidden;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.25rem;
        font-size: var(--font-size-xs);
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: var(--font-size-sm);
    }
    
    .form-control,
    .form-select {
        padding: 0.5rem 0.75rem;
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .handwriting-title {
        font-size: 1.25rem;
    }
    
    .stats-card .stats-number {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: var(--font-size-xs);
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.375rem 0.125rem;
        font-size: var(--font-size-xs);
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2a4a7a;
}

/* ===== FOCUS STATES ===== */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(26, 51, 83, 0.25);
}

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .modal {
        display: none !important;
    }
    
    main {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* ===== GLOBAL OVERFLOW FIXES ===== */
.row {
    margin-left: 0;
    margin-right: 0;
}

.col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
.col-sm, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
.col-md, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
.col-lg, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12,
.col-xl, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12 {
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-sm);
}

/* ===== FLEX UTILITIES ===== */
.d-flex {
    display: flex !important;
}

.flex-column {
    flex-direction: column !important;
}

.align-items-center {
    align-items: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.gap-2 {
    gap: var(--spacing-sm) !important;
}

.gap-3 {
    gap: var(--spacing-base) !important;
}

/* ===== SPACING UTILITIES ===== */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-xs) !important; }
.mb-2 { margin-bottom: var(--spacing-sm) !important; }
.mb-3 { margin-bottom: var(--spacing-base) !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.mt-1 { margin-top: var(--spacing-xs) !important; }
.mt-2 { margin-top: var(--spacing-sm) !important; }
.mt-3 { margin-top: var(--spacing-base) !important; }
.mt-4 { margin-top: 1.5rem !important; }

.me-1 { margin-right: var(--spacing-xs) !important; }
.me-2 { margin-right: var(--spacing-sm) !important; }

.ms-1 { margin-left: var(--spacing-xs) !important; }
.ms-2 { margin-left: var(--spacing-sm) !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: var(--spacing-xs) !important; }
.p-2 { padding: var(--spacing-sm) !important; }
.p-3 { padding: var(--spacing-base) !important; }

.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; } 