/* ========================================
   DASHBOARD SHOPEE - CSS RESPONSIVO 100%
   ======================================== */

:root {
    /* Cores principais */
    --primary-color: #ee4d2d;
    --secondary-color: #ff6b35;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    
    /* Cores de fundo */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.2);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.25);
    
    /* Bordas */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    
    /* Transições */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Espaçamentos */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;
}

/* ========================================
   RESET E BASE
   ======================================== */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--bg-secondary);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ========================================
   TIPOGRAFIA RESPONSIVA
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: clamp(1.125rem, 2vw, 1.5rem); }
h5 { font-size: clamp(1rem, 1.5vw, 1.25rem); }
h6 { font-size: clamp(0.875rem, 1.25vw, 1rem); }

p {
    margin-bottom: var(--spacing-md);
    font-size: clamp(0.875rem, 2vw, 1rem);
}

/* ========================================
   LAYOUT RESPONSIVO
   ======================================== */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-md);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -var(--spacing-sm);
}

.col {
    flex: 1;
    padding: 0 var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.col-12 { flex: 0 0 100%; }
.col-11 { flex: 0 0 91.666667%; }
.col-10 { flex: 0 0 83.333333%; }
.col-9 { flex: 0 0 75%; }
.col-8 { flex: 0 0 66.666667%; }
.col-7 { flex: 0 0 58.333333%; }
.col-6 { flex: 0 0 50%; }
.col-5 { flex: 0 0 41.666667%; }
.col-4 { flex: 0 0 33.333333%; }
.col-3 { flex: 0 0 25%; }
.col-2 { flex: 0 0 16.666667%; }
.col-1 { flex: 0 0 8.333333%; }

/* ========================================
   NAVBAR RESPONSIVA
   ======================================== */

.navbar {
    background: var(--bg-gradient);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: var(--spacing-sm) 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: white !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.navbar-nav {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-md);
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    font-size: clamp(0.875rem, 2vw, 1rem);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-normal);
    text-decoration: none;
    display: block;
}

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

/* ========================================
   CARDS RESPONSIVOS - COMPACTOS
   ======================================== */

.card {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: none;
    overflow: hidden;
    transition: all var(--transition-normal);
    margin-bottom: var(--spacing-md);
    height: fit-content;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

/* ========================================
   BOTÕES RESPONSIVOS - COMPACTOS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-normal);
    user-select: none;
    white-space: nowrap;
    min-height: 40px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    min-height: 32px;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
    min-height: 48px;
}

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

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: var(--dark-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

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

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

/* ========================================
   FORMULÁRIOS RESPONSIVOS - COMPACTOS
   ======================================== */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--dark-color);
    background-color: var(--bg-primary);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    transition: all var(--transition-normal);
    min-height: 40px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.15rem rgba(238, 77, 45, 0.15);
}

.form-control-lg {
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    min-height: 44px;
}

.form-control-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    min-height: 32px;
}

label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.9rem;
    color: #495057;
}

/* ========================================
   ALERTAS RESPONSIVOS
   ======================================== */

.alert {
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: clamp(0.875rem, 2vw, 1rem);
    position: relative;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

/* ========================================
   TABELAS RESPONSIVAS
   ======================================== */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    margin-bottom: 0;
    background-color: var(--bg-primary);
    border-collapse: collapse;
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
}

.table th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 600;
    padding: var(--spacing-md);
    text-align: left;
    border: none;
}

.table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: rgba(238, 77, 45, 0.05);
}

/* ========================================
   GRÁFICOS RESPONSIVOS
   ======================================== */

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    margin-bottom: var(--spacing-lg);
}

@media (min-width: 768px) {
    .chart-container {
        height: 400px;
    }
}

@media (min-width: 1200px) {
    .chart-container {
        height: 500px;
    }
}

canvas {
    max-width: 100%;
    height: auto !important;
}

/* ========================================
   HISTÓRICO DE OFERTAS RESPONSIVO
   ======================================== */

.offer-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

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

.offer-card-header {
    background: linear-gradient(135deg, var(--info-color), #20c997);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.offer-card-body {
    padding: var(--spacing-lg);
}

.offer-image {
    width: 100%;
    max-width: 150px;
    height: auto;
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-md);
}

.offer-text {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    font-family: 'Courier New', monospace;
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: var(--spacing-md);
    border: 1px solid #e9ecef;
}

.offer-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* ========================================
   KPI CARDS RESPONSIVOS
   ======================================== */

.kpi-card {
    text-align: center;
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

.kpi-icon {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: var(--spacing-md);
}

.kpi-value {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.kpi-label {
    font-size: clamp(0.875rem, 2vw, 1rem);
    color: #6c757d;
    font-weight: 500;
}

.kpi-card.border-success {
    border-left: 5px solid var(--success-color);
    background: linear-gradient(135deg, #fff 0%, #f8fff9 100%);
}

.kpi-card.border-info {
    border-left: 5px solid var(--info-color);
    background: linear-gradient(135deg, #fff 0%, #f8fcff 100%);
}

.kpi-card.border-warning {
    border-left: 5px solid var(--warning-color);
    background: linear-gradient(135deg, #fff 0%, #fffef8 100%);
}

.kpi-card.border-primary {
    border-left: 5px solid var(--primary-color);
    background: linear-gradient(135deg, #fff 0%, #fff8f8 100%);
}

/* ========================================
   ANIMAÇÕES E EFEITOS
   ======================================== */

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* ========================================
   ESTADOS DE LOADING
   ======================================== */

.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-border {
    width: clamp(2rem, 4vw, 3rem);
    height: clamp(2rem, 4vw, 3rem);
    border-width: 3px;
}

/* ========================================
   UTILITÁRIOS RESPONSIVOS
   ======================================== */

.hidden { display: none !important; }
.visible { display: block !important; }

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

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

.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-around { justify-content: space-around; }

.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }

.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }
.gap-4 { gap: var(--spacing-lg); }
.gap-5 { gap: var(--spacing-xl); }

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-5 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }

.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }
.p-5 { padding: var(--spacing-xl); }

/* ========================================
   SCROLLBAR PERSONALIZADA
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ========================================
   MEDIA QUERIES RESPONSIVAS
   ======================================== */

/* Mobile First - Base (320px+) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .navbar-nav {
        flex-direction: column;
        gap: var(--spacing-sm);
        width: 100%;
    }
    
    .nav-link {
        width: 100%;
        text-align: center;
    }
    
    .btn {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }
    
    .offer-actions {
        flex-direction: column;
    }
    
    .offer-actions .btn {
        width: 100%;
    }
    
    .table-responsive {
        font-size: 0.75rem;
    }

/* ========================================
   ESTILOS PARA DASHBOARD E KPIs
   ======================================== */

/* Cards de KPI */
.kpi-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.kpi-card.border-primary {
    border-color: #007bff;
}

.kpi-card.border-success {
    border-color: #28a745;
}

.kpi-card.border-info {
    border-color: #17a2b8;
}

.kpi-card.border-warning {
    border-color: #ffc107;
}

.kpi-card.border-secondary {
    border-color: #6c757d;
}

.kpi-card.border-dark {
    border-color: #343a40;
}

.kpi-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.kpi-card small {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Gráficos */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container canvas {
    max-height: 300px;
}

/* Cards de gráfico */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-header {
    border-radius: 15px 15px 0 0 !important;
    border-bottom: none;
    padding: 1rem 1.5rem;
}

.card-header h6 {
    font-weight: 600;
    font-size: 1rem;
}

.card-body {
    padding: 1.5rem;
}

/* Responsividade para KPIs */
@media (max-width: 768px) {
    .kpi-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .kpi-icon {
        font-size: 1.5rem;
    }
    
    .kpi-value {
        font-size: 1.5rem;
    }
    
    .kpi-label {
        font-size: 0.8rem;
    }
    
    .chart-container {
        height: 250px;
    }
}

@media (max-width: 576px) {
    .kpi-card {
        padding: 0.75rem;
    }
    
    .kpi-icon {
        font-size: 1.25rem;
    }
    
    .kpi-value {
        font-size: 1.25rem;
    }
    
    .chart-container {
        height: 200px;
    }
}

/* ========================================
   ESTILOS PARA UPLOAD DE RELATÓRIOS
   ======================================== */

/* Área de Upload */
.upload-area {
    transition: all 0.3s ease;
    border: 2px dashed #dee2e6;
    background-color: #f8f9fa;
    border-radius: 10px;
}

.upload-area:hover {
    border-color: #007bff;
    background-color: #e3f2fd;
    cursor: pointer;
}

.upload-area.dragover {
    border-color: #28a745;
    background-color: #d4edda;
    transform: scale(1.02);
}

.upload-area .display-4 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Progress Bar */
.progress {
    height: 8px;
    border-radius: 4px;
}

.progress-bar {
    transition: width 0.3s ease;
}

/* Modal de Histórico */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 15px 15px 0 0;
    border: none;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 15px 15px;
}

/* Tabela de Histórico */
#uploadHistoryTable {
    margin-bottom: 0;
}

#uploadHistoryTable th {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
}

#uploadHistoryTable td {
    border-color: #e9ecef;
    vertical-align: middle;
}

/* Badges para tipos de relatório */
.badge-cliques {
    background-color: #17a2b8;
    color: white;
}

.badge-vendas {
    background-color: #28a745;
    color: white;
}

/* Responsividade para Upload */
@media (max-width: 768px) {
    .upload-area .display-4 {
        font-size: 2rem;
    }
    
    .upload-area h6 {
        font-size: 1rem;
    }
    
    .upload-area p {
        font-size: 0.9rem;
    }
}
    
    .table th,
    .table td {
        padding: var(--spacing-sm);
    }
    
    .chart-container {
        height: 250px;
    }
    
    .kpi-card {
        padding: var(--spacing-lg);
    }
    
    .card-body {
        padding: var(--spacing-md);
    }
}

/* Small devices (576px+) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        max-width: 540px;
    }
    
    .col-sm-12 { flex: 0 0 100%; }
    .col-sm-11 { flex: 0 0 91.666667%; }
    .col-sm-10 { flex: 0 0 83.333333%; }
    .col-sm-9 { flex: 0 0 75%; }
    .col-sm-8 { flex: 0 0 66.666667%; }
    .col-sm-7 { flex: 0 0 58.333333%; }
    .col-sm-6 { flex: 0 0 50%; }
    .col-sm-5 { flex: 0 0 41.666667%; }
    .col-sm-4 { flex: 0 0 33.333333%; }
    .col-sm-3 { flex: 0 0 25%; }
    .col-sm-2 { flex: 0 0 16.666667%; }
    .col-sm-1 { flex: 0 0 8.333333%; }
}

/* Medium devices (768px+) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }
    
    .col-md-12 { flex: 0 0 100%; }
    .col-md-11 { flex: 0 0 91.666667%; }
    .col-md-10 { flex: 0 0 83.333333%; }
    .col-md-9 { flex: 0 0 75%; }
    .col-md-8 { flex: 0 0 66.666667%; }
    .col-md-7 { flex: 0 0 58.333333%; }
    .col-md-6 { flex: 0 0 50%; }
    .col-md-5 { flex: 0 0 41.666667%; }
    .col-md-4 { flex: 0 0 33.333333%; }
    .col-md-3 { flex: 0 0 25%; }
    .col-md-2 { flex: 0 0 16.666667%; }
    .col-md-1 { flex: 0 0 8.333333%; }
    
    .navbar-nav {
        flex-direction: row;
    }
    
    .btn {
        width: auto;
    }
    
    .offer-actions {
        flex-direction: row;
    }
    
    .offer-actions .btn {
        width: auto;
    }
    
    .chart-container {
        height: 350px;
    }
}

/* Large devices (992px+) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
    
    .col-lg-12 { flex: 0 0 100%; }
    .col-lg-11 { flex: 0 0 91.666667%; }
    .col-lg-10 { flex: 0 0 83.333333%; }
    .col-lg-9 { flex: 0 0 75%; }
    .col-lg-8 { flex: 0 0 66.666667%; }
    .col-lg-7 { flex: 0 0 58.333333%; }
    .col-lg-6 { flex: 0 0 50%; }
    .col-lg-5 { flex: 0 0 41.666667%; }
    .col-lg-4 { flex: 0 0 33.333333%; }
    .col-lg-3 { flex: 0 0 25%; }
    .col-lg-2 { flex: 0 0 16.666667%; }
    .col-lg-1 { flex: 0 0 8.333333%; }
    
    .chart-container {
        height: 400px;
    }
}

/* Extra large devices (1200px+) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .col-xl-12 { flex: 0 0 100%; }
    .col-xl-11 { flex: 0 0 91.666667%; }
    .col-xl-10 { flex: 0 0 83.333333%; }
    .col-xl-9 { flex: 0 0 75%; }
    .col-xl-8 { flex: 0 0 66.666667%; }
    .col-xl-7 { flex: 0 0 58.333333%; }
    .col-xl-6 { flex: 0 0 50%; }
    .col-xl-5 { flex: 0 0 41.666667%; }
    .col-xl-4 { flex: 0 0 33.333333%; }
    .col-xl-3 { flex: 0 0 25%; }
    .col-xl-2 { flex: 0 0 16.666667%; }
    .col-xl-1 { flex: 0 0 8.333333%; }
    
    .chart-container {
        height: 450px;
    }
}

/* ========================================
   ORIENTAÇÃO LANDSCAPE (MOBILE)
   ======================================== */

@media (max-width: 767.98px) and (orientation: landscape) {
    .navbar {
        padding: var(--spacing-xs) 0;
    }
    
    .navbar-brand {
        font-size: clamp(1rem, 3vw, 1.5rem);
    }
    
    .card-body {
        padding: var(--spacing-md);
    }
    
    .chart-container {
        height: 200px;
    }
    
    .kpi-card {
        padding: var(--spacing-md);
    }
}

/* ========================================
   ACESSIBILIDADE E TOUCH
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .btn:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    .nav-link:hover {
        transform: none;
    }
    
    /* Larger touch targets */
    .btn {
        min-height: 48px;
        padding: var(--spacing-lg) var(--spacing-xl);
    }
    
    .form-control {
        min-height: 48px;
        padding: var(--spacing-lg);
    }
}

/* ========================================
   IMPRESSÃO
   ======================================== */

@media print {
    .navbar,
    .btn,
    .alert {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}

/* ========================================
   DARK MODE (FUTURO)
   ======================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --dark-color: #ffffff;
        --light-color: #1a1a1a;
    }
    
    body {
        background-color: var(--bg-secondary);
        color: var(--dark-color);
    }
    
    .card {
        background-color: var(--bg-primary);
        color: var(--dark-color);
    }
    
    .form-control {
        background-color: var(--bg-primary);
        color: var(--dark-color);
        border-color: #444;
    }
}

/* ========================================
   ANIMAÇÕES DE ENTRADA
   ======================================== */

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

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

/* ========================================
   PERFORMANCE E OTIMIZAÇÕES
   ======================================== */

.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

.no-animation {
    animation: none !important;
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   MELHORIAS DE UX E DESIGN PROFISSIONAL
   ======================================== */

/* Melhorar contraste e legibilidade */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: #2c3e50;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
}

/* Cards com sombra mais sutil e moderna */
.card {
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

/* Inputs com foco mais suave */
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
    outline: none;
}

/* Botões com gradiente mais suave */
.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

/* Melhorar espaçamento geral */
.container {
    max-width: 1200px;
}

/* Sidebar com gradiente mais sutil */
.tabs-sidebar {
    background: linear-gradient(180deg, #4f46e5 0%, #7c3aed 100%);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

/* Melhorar contraste dos links da sidebar */
.tabs-nav .nav-link {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

.tabs-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.15);
    color: white;
}

.tabs-nav .nav-link.active {
    background-color: rgba(255,255,255,0.25);
    color: white;
    border-right: 3px solid #ffffff;
}

/* Melhorar tipografia */
h1, h2, h3, h4, h5, h6 {
    color: #1a202c;
    font-weight: 600;
    line-height: 1.3;
}

/* Melhorar contraste dos textos */
.text-muted {
    color: #6b7280 !important;
}

/* Cards de resultado mais elegantes */
#offerResult .card {
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* Melhorar aparência dos alerts */
.alert {
    border: none;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    border-left: 4px solid #10b981;
}

/* Melhorar aparência dos badges */
.badge {
    font-weight: 600;
    padding: 0.5em 0.75em;
    border-radius: 6px;
}

/* Melhorar scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================
   BOTÃO DE DOWNLOAD DE IMAGEM
   ======================================== */

.download-image-btn {
    background: rgba(13, 110, 253, 0.9) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
}

.download-image-btn:hover {
    background: rgba(13, 110, 253, 1) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}

.download-image-btn i {
    font-size: 16px !important;
    color: white !important;
}

/* Efeito hover na imagem quando botão está presente */
.position-relative:hover .download-image-btn {
    opacity: 1;
}

.download-image-btn {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

/* Botão de download no histórico - estilo normal */
.download-image-history-btn {
    background: transparent !important;
    border: 1px solid #6c757d !important;
    border-radius: 0.375rem !important;
    width: auto !important;
    height: auto !important;
    padding: 0.375rem 0.75rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
    transition: all 0.15s ease-in-out !important;
    z-index: auto !important;
    opacity: 1 !important;
}

.download-image-history-btn:hover {
    background: #6c757d !important;
    border-color: #6c757d !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.download-image-history-btn i {
    font-size: 0.875rem !important;
    color: #6c757d !important;
}

.download-image-history-btn:hover i {
    color: white !important;
}

/* ========================================
   LAYOUT AGRUPADO DO HISTÓRICO
   ======================================== */
.history-grouped .row {
    display: flex !important;
    flex-wrap: wrap !important;
}

.history-grouped .col-12.col-md-6.col-lg-4 {
    flex: 0 0 auto !important;
    width: 100% !important;
}

@media (min-width: 768px) {
    .history-grouped .col-12.col-md-6.col-lg-4 {
        width: 50% !important;
    }
}

@media (min-width: 992px) {
    .history-grouped .col-12.col-md-6.col-lg-4 {
        width: 33.333333% !important;
    }
}

/* ========================================
   CORREÇÕES DE CONTRASTE PARA FUNDOS ESCUROS
   ======================================== */

/* Footer com fundo escuro - garantir texto claro */
footer.bg-dark,
.bg-dark {
    color: #ffffff !important;
}

footer.bg-dark small,
.bg-dark small {
    color: #e9ecef !important;
}

/* Cards com cabeçalho escuro */
.card-header.bg-dark {
    color: #ffffff !important;
}

.card-header.bg-dark h6,
.card-header.bg-dark .mb-0 {
    color: #ffffff !important;
}

/* KPI cards com borda escura - garantir contraste */
.kpi-card.border-dark {
    background-color: #ffffff;
}

.kpi-card.border-dark .kpi-icon {
    color: #343a40 !important;
}

.kpi-card.border-dark .kpi-value {
    color: #343a40 !important;
}

.kpi-card.border-dark .kpi-icon.text-dark {
    color: #343a40 !important;
}

.kpi-card.border-dark .kpi-value.text-dark {
    color: #343a40 !important;
}

/* Elementos text-muted em fundos escuros */
.bg-dark .text-muted,
footer .text-muted,
.card-header.bg-dark .text-muted {
    color: #e9ecef !important;
}

/* Elementos text-secondary em fundos escuros */
.bg-dark .text-secondary,
footer .text-secondary {
    color: #dee2e6 !important;
}

/* Tabelas em modais com fundos escuros */
.modal .table th,
.modal .table td {
    color: inherit;
}

/* Botões em fundos escuros */
.bg-dark .btn-outline-primary {
    border-color: #ffffff;
    color: #ffffff;
}

.bg-dark .btn-outline-primary:hover {
    background-color: #ffffff;
    color: #343a40;
}

/* Correção específica para elementos em fundos escuros */
.bg-dark *,
footer * {
    color: inherit;
}

/* Garantir que textos em fundos escuros sejam claros */
.bg-dark .text-dark,
footer .text-dark {
    color: #ffffff !important;
}

/* Correção para elementos específicos do dashboard */
.card-header.bg-dark .text-muted {
    color: #adb5bd !important;
}

/* Melhorar contraste de badges em fundos escuros */
.bg-dark .badge {
    color: #ffffff !important;
}

/* Correção para tabelas em fundos escuros */
.bg-dark .table,
.bg-dark .table td,
.bg-dark .table th {
    color: #ffffff !important;
}

.bg-dark .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255,255,255,0.05) !important;
}

/* Correção para elementos de upload em fundos escuros */
.bg-dark .upload-area,
.bg-dark .upload-area:hover {
    border-color: #ffffff;
    color: #ffffff;
}

.bg-dark .upload-area .text-muted {
    color: #adb5bd !important;
}

/* Correção para modais */
.modal-header.bg-dark,
.modal-footer.bg-dark {
    color: #ffffff !important;
}

.modal-header.bg-dark .btn-close {
    filter: invert(1);
}

/* Garantir que todos os ícones em fundos escuros sejam visíveis */
.bg-dark .bi,
footer .bi {
    color: inherit;
}

/* Correção para elementos de status em fundos escuros */
.bg-dark .text-success {
    color: #28a745 !important;
}

.bg-dark .text-warning {
    color: #ffc107 !important;
}

.bg-dark .text-danger {
    color: #dc3545 !important;
}

.bg-dark .text-info {
    color: #17a2b8 !important;
}

/* ========================================
   CORREÇÕES ADICIONAIS DE CONTRASTE
   ======================================== */

/* Melhorar contraste de elementos específicos */
.text-muted {
    color: #6c757d !important;
}

/* Em fundos claros, manter text-muted escuro */
.card:not(.bg-dark) .text-muted,
.card-body .text-muted {
    color: #6c757d !important;
}

/* Melhorar contraste de labels e textos pequenos */
.kpi-label {
    color: #495057 !important;
    font-weight: 600;
}

/* Melhorar contraste de elementos de status */
.badge {
    font-weight: 600;
}

/* Melhorar contraste de botões outline */
.btn-outline-primary {
    border-color: #007bff;
    color: #007bff;
}

.btn-outline-primary:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: #ffffff;
}

/* Melhorar contraste de elementos de upload */
.upload-area {
    border: 2px dashed #dee2e6;
    background-color: #f8f9fa;
    color: #495057;
}

.upload-area:hover {
    border-color: #007bff;
    background-color: #e3f2fd;
    color: #0056b3;
}

/* Melhorar contraste de tabelas */
.table th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
}

.table td {
    color: #495057;
}

/* Melhorar contraste de modais */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    color: #495057;
    font-weight: 600;
}

/* Melhorar contraste de elementos de loading */
.text-center .text-muted {
    color: #6c757d !important;
}

/* Melhorar contraste de ícones */
.bi {
    color: inherit;
}

/* Garantir que elementos específicos tenham bom contraste */
.section-title,
.card-title,
.modal-title {
    color: #495057 !important;
    font-weight: 600;
}

/* Melhorar contraste de elementos de formulário */
.form-label {
    color: #495057 !important;
    font-weight: 600;
}

.form-control {
    border-color: #ced4da;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ========================================
   CORREÇÃO ESPECÍFICA PARA GERADOR DE OFERTAS
   ======================================== */

/* Melhorar contraste do texto de ajuda no formulário */
.form-text {
    color: #495057 !important;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    line-height: 1.3;
}

.form-text strong {
    color: #343a40 !important;
    font-weight: 600;
}

/* Garantir que o texto de ajuda seja sempre legível */
.card .form-text,
.card-body .form-text {
    color: #495057 !important;
}

/* Melhorar contraste do placeholder */
.form-control::placeholder {
    color: #6c757d !important;
    opacity: 1;
}

/* Melhorar contraste do input quando focado */
.form-control:focus {
    color: #495057 !important;
    background-color: #ffffff;
    border-color: #007bff;
    box-shadow: 0 0 0 0.15rem rgba(0, 123, 255, 0.15);
}

/* ========================================
   FORMULÁRIO COMPACTO E PROFISSIONAL
   ======================================== */

/* Container do formulário mais compacto */
#offerForm {
    max-height: 80vh;
    overflow-y: auto;
}

/* Reduzir espaçamento entre grupos de formulário */
#offerForm .form-group {
    margin-bottom: 1.5rem;
}

/* Inputs mais compactos */
#offerForm .form-control {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    min-height: 38px;
}

/* Labels mais compactos */
#offerForm .form-label {
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

/* Botão de gerar oferta sempre visível - SEM FAIXA BRANCA */
#generateBtn {
    position: sticky;
    bottom: 0;
    background: linear-gradient(135deg, #ee4d2d, #ff6b35);
    border: none;
    box-shadow: 0 8px 25px rgba(238, 77, 45, 0.4);
    z-index: 10;
    backdrop-filter: blur(10px);
}

#generateBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(238, 77, 45, 0.5);
}

/* Botão Amazon também sem faixa branca */
#generateAmazonBtn {
    position: sticky;
    bottom: 0;
    background: linear-gradient(135deg, #ff9900, #ff6600);
    border: none;
    box-shadow: 0 8px 25px rgba(255, 153, 0, 0.4);
    z-index: 10;
    backdrop-filter: blur(10px);
}

#generateAmazonBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(255, 153, 0, 0.5);
}

/* Container principal com altura controlada */
.tab-section {
    max-height: 100vh;
    overflow-y: auto;
}

/* Garantir que o botão seja sempre visível - SEM FAIXA BRANCA */
.d-grid.gap-2.d-md-flex.justify-content-md-center {
    position: sticky;
    bottom: 0;
    background: transparent;
    padding: 1rem 0;
    margin-top: 1rem;
    border-top: none;
}

/* ========================================
   CORREÇÃO ESPECÍFICA PARA TICKET MÉDIO
   ======================================== */

/* Garantir que o Ticket Médio sempre seja visível */
#averageTicket {
    color: #343a40 !important;
    font-weight: 700 !important;
}

/* Garantir que todos os kpi-value tenham contraste adequado */
.kpi-card .kpi-value {
    color: inherit;
}

/* Específico para cards com borda escura */
.kpi-card.border-dark .kpi-value {
    color: #343a40 !important;
}

/* Garantir que o ícone também seja visível */
.kpi-card.border-dark .kpi-icon {
    color: #343a40 !important;
}

/* Garantir que o label seja visível */
.kpi-card.border-dark .kpi-label {
    color: #495057 !important;
}

/* ========================================
   CORREÇÃO DOS TÍTULOS DE SEÇÕES
   ======================================== */

/* Todos os títulos de seções devem ser brancos */
.card-header .card-title,
.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6 {
    color: #ffffff !important;
}

/* Ícones dos títulos também devem ser brancos */
.card-header .card-title i,
.card-header h1 i,
.card-header h2 i,
.card-header h3 i,
.card-header h4 i,
.card-header h5 i,
.card-header h6 i {
    color: #ffffff !important;
}

/* Específico para títulos de seções principais */
.card-header .card-title {
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* Garantir que todos os títulos em cabeçalhos de cards sejam brancos */
.card-header * {
    color: inherit;
}

.card-header {
    color: #ffffff !important;
}

/* Específico para badges em títulos (como contador de ofertas) */
.card-header .badge {
    background-color: #28a745 !important;
    color: #ffffff !important;
}

/* Botões em cabeçalhos de cards */
.card-header .btn {
    color: #ffffff !important;
    border-color: #ffffff !important;
}

.card-header .btn:hover {
    background-color: #ffffff !important;
    color: #343a40 !important;
}

/* ========================================
   SISTEMA DE ABAS LATERAIS
   ======================================== */

/* Container principal das abas */
.tabs-container {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-secondary);
}

/* Sidebar com navegação das abas - COMPACTA */
.tabs-sidebar {
    width: 220px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    padding: 15px 0;
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
}

/* Logo/Header da sidebar */
.tabs-sidebar-header {
    padding: 0 15px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 15px;
}

.tabs-sidebar-header h3 {
    color: white;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Navegação das abas */
.tabs-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tabs-nav li {
    margin: 0;
}

.tabs-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255,255,255,0.8) !important;
    text-decoration: none;
    transition: all var(--transition-normal);
    border: none;
    border-radius: 0;
    margin: 0;
    font-weight: 500;
    font-size: 0.9rem;
}

.tabs-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white !important;
    transform: none;
}

.tabs-nav .nav-link.active {
    background-color: rgba(255,255,255,0.2);
    color: white !important;
    border-right: 3px solid white;
}

.tabs-nav .nav-link i {
    margin-right: 8px;
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

/* Área de conteúdo das abas */
.tabs-content {
    flex: 1;
    margin-left: 220px;
    padding: 20px;
    min-height: 100vh;
}

/* Seções de conteúdo das abas */
.tab-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-section.active {
    display: block;
}

.subid-row {
    cursor: pointer;
}
.subid-row:hover {
    background-color: rgba(13, 110, 253, 0.08);
}

.subid-chart-title-wrap {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    color: #fff;
    padding: 0.5rem 1rem;
    margin: -1rem -1rem 1rem -1rem;
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
}
.subid-chart-title-wrap .mb-3 { margin-bottom: 0 !important; }
.subid-chart-title-wrap,
.subid-chart-title-wrap h5,
.subid-chart-title-wrap #subidDetailTitle { color: #fff !important; }

/* Animação de transição */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsividade para mobile */
@media (max-width: 768px) {
    .tabs-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 10px 0;
    }
    
    .tabs-content {
        margin-left: 0;
        padding: 15px;
    }
    
    .tabs-nav {
        display: flex;
        overflow-x: auto;
        padding: 0 10px;
    }
    
    .tabs-nav li {
        flex-shrink: 0;
    }
    
    .tabs-nav .nav-link {
        padding: 10px 15px;
        white-space: nowrap;
        border-radius: var(--border-radius-sm);
        margin: 0 5px;
    }
    
    .tabs-nav .nav-link.active {
        border-right: none;
        border-bottom: 3px solid white;
    }
    
    .tabs-nav .nav-link i {
        margin-right: 5px;
    }
    
    .tabs-sidebar-header h3 {
        font-size: 1rem;
        text-align: center;
    }
    
    /* Garantir que o botão seja sempre visível no mobile - SEM FAIXA BRANCA */
    .d-grid.gap-2.d-md-flex.justify-content-md-center {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: transparent;
        padding: 15px;
        box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
        z-index: 1000;
        margin: 0;
    }
    
    /* Ajustar padding do conteúdo para não sobrepor o botão */
    .tab-section {
        padding-bottom: 100px;
    }
    
    /* Formulário mais compacto no mobile */
    #offerForm .form-group {
        margin-bottom: 1rem;
    }
    
    #offerForm .form-control {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        min-height: 36px;
    }
    
    #offerForm .form-label {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }
    
    #offerForm .form-text {
        font-size: 0.75rem;
        margin-top: 0.2rem;
    }
}

/* Ajustes para telas muito pequenas */
@media (max-width: 480px) {
    .tabs-nav .nav-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .tabs-nav .nav-link span {
        display: none;
    }
    
    .tabs-nav .nav-link i {
        margin-right: 0;
        font-size: 1.2rem;
    }
}

/* ========================================
   MODERN SAAS THEME (Magic UI inspired)
   ======================================== */
:root {
    --app-bg: radial-gradient(circle at 10% 10%, #f2f6ff 0%, #f7f8fc 30%, #f4f5fb 70%, #f1f3fa 100%);
    --surface-1: rgba(255, 255, 255, 0.9);
    --surface-2: rgba(255, 255, 255, 0.72);
    --surface-glass: rgba(255, 255, 255, 0.78);
    --surface-border: rgba(140, 160, 190, 0.25);
    --text-strong: #111827;
    --text-muted: #64748b;
    --accent: #5b6cff;
    --accent-2: #7c3aed;
    --accent-soft: rgba(91, 108, 255, 0.12);
    --ring: rgba(91, 108, 255, 0.25);
    --ok: #16a34a;
    --danger: #dc2626;
    --shadow-premium: 0 10px 35px rgba(30, 41, 59, 0.11), 0 2px 10px rgba(30, 41, 59, 0.06);
    --radius-xl: 18px;
    --radius-lg: 14px;
    --radius-md: 12px;
}

html, body { min-height: 100%; }
body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-strong);
    background: var(--app-bg);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Sora', 'Manrope', sans-serif;
    letter-spacing: -0.02em;
}

.tabs-container {
    background: transparent;
}

.tabs-sidebar {
    width: 270px;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.94) 0%, rgba(30, 41, 59, 0.93) 100%);
    border-right: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tabs-sidebar-header {
    padding: 22px 16px 14px;
    position: relative;
}

.tabs-sidebar-header h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.sidebar-desktop-toggle {
    position: absolute;
    right: 12px;
    top: 18px;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(99, 102, 241, 0.2);
    color: #e2e8f0;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
}

.sidebar-desktop-toggle:hover {
    background: rgba(99, 102, 241, 0.35);
    border-color: rgba(165, 180, 252, 0.65);
    color: #fff;
}

.tabs-nav { padding: 8px; gap: 4px; }
.tabs-nav li { margin-bottom: 4px; }

.tabs-nav .nav-link {
    border-radius: 12px;
    padding: 12px 13px;
    color: rgba(241, 245, 249, 0.8) !important;
    border: 1px solid transparent;
    transition: all .22s ease;
}

.tabs-nav .nav-link:hover {
    color: #fff !important;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(148, 163, 184, 0.35);
}

.tabs-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(91,108,255,0.28), rgba(124,58,237,0.26));
    border: 1px solid rgba(165, 180, 252, 0.5);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 8px 20px rgba(59, 130, 246, .2);
    border-right: 1px solid rgba(165, 180, 252, 0.5);
}

.tabs-content {
    margin-left: 270px;
    padding: clamp(18px, 3vw, 34px);
}

.tab-section .container {
    max-width: 1320px;
    padding-inline: clamp(6px, 1.6vw, 14px);
}

.card {
    border: 1px solid var(--surface-border);
    background: linear-gradient(145deg, var(--surface-1), var(--surface-2));
    box-shadow: var(--shadow-premium);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(30, 41, 59, 0.14);
}

.card-header {
    background: linear-gradient(120deg, #f8fbff 0%, #eef2ff 45%, #ede9fe 100%);
    color: var(--text-strong);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding: 14px 18px;
}

.card-title { font-size: clamp(1rem, 1.5vw, 1.18rem); }
.card-body { padding: clamp(14px, 2vw, 24px); }

.form-label {
    font-weight: 700;
    color: #1e293b;
    font-size: .9rem;
}

.form-text { color: var(--text-muted); }

.form-control, .form-select, .input-group-text {
    border-radius: 12px !important;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255,255,255,.9);
    min-height: 44px;
}

.input-group > .form-control:not(:last-child),
.input-group > .form-select:not(:last-child),
.input-group > .input-group-text:not(:last-child) {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.form-control:focus, .form-select:focus {
    border-color: rgba(91,108,255,.65);
    box-shadow: 0 0 0 4px var(--ring);
}

.btn {
    border-radius: 12px;
    font-weight: 700;
    min-height: 42px;
    letter-spacing: 0.01em;
}

.btn-primary, .btn-success {
    border: 0;
    background: linear-gradient(125deg, var(--accent) 0%, var(--accent-2) 100%);
}

.btn-outline-primary {
    border-color: rgba(99,102,241, .45);
    color: #4338ca;
    background: rgba(255,255,255,.7);
}

.badge {
    border-radius: 999px;
    padding: .44em .8em;
    font-weight: 700;
}

.table {
    border-radius: 14px;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255,255,255,.88);
}

.table thead th {
    background: #f1f5ff;
    color: #1e293b;
    border-bottom: 1px solid rgba(148,163,184,.25);
    font-weight: 800;
    text-transform: uppercase;
    font-size: .76rem;
    letter-spacing: .04em;
}

.table > :not(caption) > * > * {
    padding: .78rem .72rem;
    border-bottom-color: rgba(148,163,184,.17);
}

.table-hover tbody tr:hover {
    background-color: rgba(91,108,255,.06);
}

canvas {
    max-width: 100%;
    border-radius: 12px;
}

.chart-container, .chart-card, .analytics-chart, [id*='chart'] {
    max-width: 100%;
}

.alert {
    border: 1px solid rgba(148,163,184,.28);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(15,23,42,.06);
}

.sidebar-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1400;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255,255,255,.86);
    color: #0f172a;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    box-shadow: var(--shadow-premium);
}

.sidebar-toggle i { font-size: 1.2rem; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 1300;
}

.sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

body.sidebar-open { overflow: hidden; }

body.sidebar-collapsed .tabs-sidebar {
    width: 84px;
}

body.sidebar-collapsed .tabs-content {
    margin-left: 84px;
}

body.sidebar-collapsed .tabs-sidebar-header h3 {
    font-size: 0;
}

body.sidebar-collapsed .tabs-sidebar-header h3 i {
    margin-right: 0 !important;
    font-size: 1.35rem;
}

body.sidebar-collapsed .tabs-nav .nav-link {
    justify-content: center;
    padding-inline: 10px;
}

body.sidebar-collapsed .tabs-nav .nav-link span {
    display: none;
}

body.sidebar-collapsed .tabs-nav .nav-link i {
    margin-right: 0;
    font-size: 1.12rem;
}

body.sidebar-collapsed #logoutBtn {
    width: 44px !important;
    min-width: 44px;
    margin-left: auto;
    margin-right: auto;
    padding-inline: 0.4rem;
}

body.sidebar-collapsed #logoutBtn .me-1 {
    margin-right: 0 !important;
}

body.sidebar-collapsed #logoutBtn {
    font-size: 0;
}

body.sidebar-collapsed #logoutBtn i {
    font-size: .95rem;
}

/* Login page redesign */
.login-page {
    margin: 0;
    padding: clamp(12px, 3vw, 28px);
    background:
        radial-gradient(circle at 20% 15%, rgba(99,102,241,.28), transparent 42%),
        radial-gradient(circle at 80% 0%, rgba(14,165,233,.18), transparent 36%),
        #0b1220;
}

.auth-shell {
    min-height: calc(100vh - 2 * clamp(12px, 3vw, 28px));
    display: grid;
    grid-template-columns: 1fr 430px;
    gap: clamp(14px, 2.5vw, 28px);
    max-width: 1160px;
    margin: 0 auto;
}

.auth-brand-panel {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(148,163,184,.18);
    background: linear-gradient(155deg, rgba(15,23,42,.72), rgba(30,41,59,.5));
    backdrop-filter: blur(8px);
}

.auth-brand-glow {
    position: absolute;
    inset: -25%;
    background: radial-gradient(circle, rgba(99,102,241,.28), transparent 48%);
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    padding: clamp(24px, 4vw, 48px);
    color: #e2e8f0;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(99,102,241,.22);
    border: 1px solid rgba(165,180,252,.35);
    padding: .4rem .8rem;
    font-size: .82rem;
    margin-bottom: 1rem;
}

.auth-brand-content h1 { font-size: clamp(1.6rem, 3vw, 2.5rem); margin-bottom: .7rem; color: #fff; }
.auth-brand-content p { color: #cbd5e1; max-width: 44ch; }

.auth-brand-points { display: grid; gap: .5rem; margin-top: 1.1rem; font-size: .95rem; }
.auth-brand-points span { display: inline-flex; align-items: center; gap: .45rem; }

.login-card {
    align-self: center;
    border-radius: 24px;
    border: 1px solid rgba(148,163,184,.22);
    background: rgba(255,255,255,.94);
    box-shadow: 0 26px 64px rgba(15,23,42,.25);
}

.auth-icon {
    font-size: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(99,102,241,.16), rgba(14,165,233,.16));
}

@media (max-width: 1199px) {
    .tabs-sidebar { width: 242px; }
    .tabs-content { margin-left: 242px; }
}

@media (max-width: 991px) {
    .tabs-sidebar {
        width: min(84vw, 320px);
        left: 0 !important;
        position: fixed !important;
        top: 0 !important;
        height: 100vh !important;
        transform: translateX(-102%) !important;
        transition: transform .25s ease;
        z-index: 1350;
        overflow-y: auto !important;
    }
    .tabs-sidebar.is-open { transform: translateX(0) !important; }
    .tabs-content {
        margin-left: 0;
        padding: 68px 12px 16px;
    }
    .tabs-nav {
        display: block;
        overflow: visible;
        padding-inline: 8px;
    }
    .tabs-nav .nav-link span { display: inline; }
    body.sidebar-collapsed .tabs-content {
        margin-left: 0;
    }
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 520px;
    }
    .auth-brand-panel { min-height: 200px; }
}

@media (max-width: 767px) {
    .card { border-radius: 14px; }
    .card-header, .card-body { padding: 12px; }
    .table-responsive {
        border: 1px solid rgba(148,163,184,.22);
        border-radius: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: rgba(255,255,255,.84);
    }
    .auth-brand-panel { display: none; }
    .login-card {
        border-radius: 18px;
        box-shadow: 0 18px 40px rgba(15,23,42,.24);
    }
}

/* ========================================
   CONTRASTE LEGÍVEL (títulos + datas)
   ======================================== */
.card-header,
.card-header .card-title,
.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6,
.card-header .card-title i,
.card-header h1 i,
.card-header h2 i,
.card-header h3 i,
.card-header h4 i,
.card-header h5 i,
.card-header h6 i {
    color: #0f172a !important;
}

/* Campos de data do relatório e similares sempre com alto contraste */
input[type="date"],
input[type="datetime-local"],
#startDate,
#endDate,
#subidStartDate,
#subidEndDate {
    color: #0f172a !important;
    background-color: #ffffff !important;
    color-scheme: light;
    -webkit-text-fill-color: #0f172a !important;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    opacity: 0.9;
    cursor: pointer;
}