/* ============================================================
   RATIO Competitor Tracker - Custom Styles
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --navbar-height: 60px;
    --primary-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================================
   BASE
   ============================================================ */
body {
    font-family: var(--font-family);
    background-color: #f4f6f9;
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] {
    background-color: #0f1117;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.main-navbar {
    height: var(--navbar-height);
    background: rgba(255,255,255,0.95) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.08);
    z-index: 1040;
}

[data-bs-theme="dark"] .main-navbar {
    background: rgba(15,17,23,0.95) !important;
    border-bottom-color: rgba(255,255,255,0.08);
}

.main-navbar .navbar-brand {
    color: #6366F1 !important;
    font-size: 1.25rem;
}

.sidebar-toggle {
    color: #6B7280;
    text-decoration: none;
    padding: 0;
}

.nav-icon {
    color: #6B7280;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.25rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: #fff;
    border-right: 1px solid rgba(0,0,0,0.08);
    overflow-y: auto;
    z-index: 1030;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

[data-bs-theme="dark"] .sidebar {
    background: #1a1d27;
    border-right-color: rgba(255,255,255,0.06);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-top: 0.5rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.25rem;
    color: #4B5563;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

[data-bs-theme="dark"] .sidebar-nav-link {
    color: #9CA3AF;
}

.sidebar-nav-link:hover {
    background: rgba(99, 102, 241, 0.06);
    color: #6366F1;
}

.sidebar-nav-link.active {
    background: rgba(99, 102, 241, 0.08);
    color: #6366F1;
    border-left-color: #6366F1;
    font-weight: 600;
}

.sidebar-nav-link i {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background: rgba(0,0,0,0.08);
    margin: 0.5rem 1.25rem;
}

[data-bs-theme="dark"] .sidebar-divider {
    background: rgba(255,255,255,0.06);
}

.sidebar-heading {
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9CA3AF;
    font-weight: 600;
}

.sidebar-plan-badge {
    margin: auto 1rem 1rem;
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1025;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.has-sidebar .main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

.main-content-public {
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

.min-vh-100-nav {
    min-height: calc(100vh - var(--navbar-height) - 2rem);
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* ============================================================
   COMPETITOR CARDS
   ============================================================ */
.competitor-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.competitor-avatar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.competitor-avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.3rem;
    border-radius: 16px;
}

.competitor-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* ============================================================
   METRIC CARDS
   ============================================================ */
.metric-card {
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: background 0.2s;
}

.metric-card:hover {
    background: rgba(99, 102, 241, 0.08);
}

/* ============================================================
   REPORT CONTENT
   ============================================================ */
.report-content {
    font-size: 0.95rem;
    line-height: 1.75;
}

.report-content h2 {
    color: #6366F1;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(99, 102, 241, 0.2);
}

.report-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #374151;
}

[data-bs-theme="dark"] .report-content h3 {
    color: #E5E7EB;
}

.report-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.report-content table th,
.report-content table td {
    border: 1px solid #E5E7EB;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.report-content table th {
    background: rgba(99, 102, 241, 0.06);
    font-weight: 600;
}

.report-content ul, .report-content ol {
    margin-bottom: 1rem;
}

.report-content li {
    margin-bottom: 0.25rem;
}

/* ============================================================
   CARDS & SHADOWS
   ============================================================ */
.card {
    border-radius: 12px;
}

.shadow-sm {
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04) !important;
}

.shadow-lg {
    box-shadow: 0 10px 40px rgba(0,0,0,0.1) !important;
}

.card-header {
    border-bottom-color: rgba(0,0,0,0.06);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
    background: #6366F1;
    border-color: #6366F1;
}

.btn-primary:hover {
    background: #4F46E5;
    border-color: #4F46E5;
}

.btn-outline-primary {
    color: #6366F1;
    border-color: #6366F1;
}

.btn-outline-primary:hover {
    background: #6366F1;
    border-color: #6366F1;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control:focus, .form-select:focus {
    border-color: #6366F1;
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15);
}

/* ============================================================
   PRICING
   ============================================================ */
.pricing-amount .display-4 {
    line-height: 1;
}

/* ============================================================
   CHARTS
   ============================================================ */
canvas {
    max-width: 100%;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: 10px;
    border: none;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* ============================================================
   PROGRESS
   ============================================================ */
.progress {
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    background: var(--primary-gradient);
}

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown-menu {
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.dropdown-item {
    border-radius: 6px;
    margin: 0 0.25rem;
    padding: 0.4rem 0.75rem;
}

/* ============================================================
   TOAST / NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    right: 1rem;
    z-index: 9999;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar.show + .sidebar-overlay,
    .sidebar-overlay.show {
        display: block;
    }

    .has-sidebar .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .kpi-card .h3 {
        font-size: 1.25rem;
    }
    
    .kpi-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar, .main-navbar, .sidebar-overlay, .btn, .dropdown, nav {
        display: none !important;
    }
    
    .has-sidebar .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .report-content {
        font-size: 12pt;
    }
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

[data-bs-theme="dark"] .loading-overlay {
    background: rgba(15,17,23,0.8);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

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

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

/* ============================================================
   ACCORDION (Pricing FAQ)
   ============================================================ */
.accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15);
}

.accordion-button:not(.collapsed) {
    background: rgba(99, 102, 241, 0.06);
    color: #6366F1;
}
