/* ===================================================
   ATECHDOWN PROFILE V2 - BENTO PRO MAX
   Premium UI with Ultra-Glassmorphism & Bento System
   Designed based on ui-ux-pro-max guidelines
=================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
    /* Semantic Colors - PROFESSIONAL BLUE THEME */
    --bg-void: #020617;
    /* Deep Navy */
    --bg-card: rgba(15, 23, 42, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.8);

    --primary: #2563eb;
    /* Royal Blue */
    --primary-glow: rgba(37, 99, 235, 0.3);

    --secondary: #475569;
    /* Slate (Replaces Purple) */
    --secondary-glow: rgba(71, 85, 105, 0.3);

    --accent: #0ea5e9;
    /* Sky Blue (Replaces Cyan/Pink) */

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --text-muted: #64748b;

    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(59, 130, 246, 0.3);

    /* System Tokens */
    --font-head: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-xl: 24px;
    --radius-l: 16px;
    --radius-m: 12px;

    --blur: 12px; /* Reduced from 20px */
    --transition: all 0.2s ease;
}

@media (max-width: 768px) {
    :root {
        --blur: 4px;
    }
    .bg-mesh, .bg-noise {
        opacity: 0.1; /* Fade out expensive FX on mobile */
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-void);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ===== BACKGROUND SYSTEM ===== */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(14, 165, 233, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(2, 6, 23, 1) 0%, rgba(1, 2, 8, 1) 100%);
}

.hidden {
    display: none !important;
}

.bg-noise {
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.02;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* ===== TOPBAR ===== */
.topbar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 1200px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 20px;
    color: white;
}

@media (max-width: 768px) {
    .topbar-nav .btn-nav span {
        display: none;
    }

    .topbar-nav .btn-logout span {
        display: none;
    }

    .topbar-nav .btn-nav i,
    .topbar-nav .btn-logout i {
        font-size: 20px;
    }

    .topbar .logo span {
        font-size: 16px;
    }

    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }

    /* Mobile Back Button - Visible on mobile */
    .btn-back-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: rgba(59, 130, 246, 0.15);
        border: 1px solid rgba(59, 130, 246, 0.3);
        border-radius: 10px;
        color: #3b82f6;
        text-decoration: none;
        transition: all 0.3s;
    }

    .btn-back-mobile:hover {
        background: rgba(59, 130, 246, 0.25);
        transform: translateX(-2px);
    }

    .btn-back-mobile i {
        font-size: 20px;
    }

    /* Logout Button - Make icon visible on mobile */
    .btn-logout {
        width: 40px;
        height: 40px;
        padding: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
    }

    .btn-logout i {
        display: block !important;
        font-size: 18px;
    }
}

/* Desktop: Hide mobile back button */
@media (min-width: 769px) {
    .btn-back-mobile {
        display: none;
    }
}

/* Fix for broken text in screenshot provided by user */
@media (max-width: 480px) {

    /* Tabs - Enable Horizontal Scroll */
    .tabs-header {
        width: 100% !important;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
        padding-bottom: 12px;
        /* Space for touch */
    }

    .tabs-header::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .tab {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 10px 16px;
    }

    .tab i {
        font-size: 18px;
    }

    /* Better stat card layout for very small screens */
    .stat-label {
        font-size: 12px;
        white-space: nowrap;
    }

    .stat-number {
        font-size: 32px;
        /* Reduce from 42px */
    }
}

.logo img {
    height: 28px;
    border-radius: 8px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-nav,
.notif-bell {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    color: var(--text-dim);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.btn-nav:hover,
.notif-bell:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateY(-2px);
    border-color: var(--primary-glow);
}

.btn-logout {
    border-radius: 12px;
    padding: 10px 18px;
    background: var(--danger);
    color: white;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* ===== NOTIFICATION DROPDOWN ===== */
.notification-container {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 800;
    min-width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(15, 23, 42, 0.8);
    opacity: 1;
    transition: opacity 0.3s;
}

.notif-badge.hidden {
    opacity: 0;
}

.notif-dropdown {
    position: absolute;
    top: 50px;
    right: -10px;
    width: 360px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: top right;
    animation: scaleIn 0.2s ease-out;
    z-index: 1100;
}

.notif-dropdown.hidden {
    display: none;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.notif-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.notif-header span {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
}

.notif-header button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.notif-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.notif-item.unread {
    background: rgba(37, 99, 235, 0.08);
    position: relative;
}

.notif-item.unread::after {
    content: '';
    position: absolute;
    top: 16px;
    right: 16px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

.notif-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-dim);
    flex-shrink: 0;
}

.notif-info {
    flex: 1;
    min-width: 0;
    /* Text truncation fix */
}

.notif-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.notif-message {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    display: block;
}

.notif-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Mobile Adjustments for Notification */
@media (max-width: 768px) {
    .notif-dropdown {
        position: fixed;
        top: 70px;
        right: 50%;
        /* Center logically */
        transform: translateX(50%);
        /* Center visually */
        width: 90%;
        max-width: 350px;
    }
}


/* ===== CONTAINER ===== */
.profile-page {
    padding: 120px 20px 80px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== BENTO SYSTEM ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto;
    gap: 20px;
    margin-bottom: 20px;
}

.hero-section {
    grid-column: span 3;
    grid-row: span 1;
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 40px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(14, 165, 233, 0.05));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.stat-icon.purple {
    color: var(--secondary);
    background: rgba(71, 85, 105, 0.1);
}

.avatar-ring {
    position: relative;
    z-index: 2;
}

.avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--bg-void);
    border: 4px solid var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8);
}

.status-dot {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: var(--success);
    border: 4px solid var(--bg-void);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--success);
}

.user-info h1 {
    font-family: var(--font-head);
    font-size: 42px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 8px;
    background: linear-gradient(to right, #fff, var(--text-dim));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tier-badge {
    display: inline-flex;
    padding: 6px 16px;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #1e1b4b;
    border-radius: 100px;
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
}

/* Stat Cards - Pro Max */
.stat-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    /* Larger radius */
    padding: 28px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    pointer-events: none;
}

.stat-card:hover {
    background: rgba(30, 41, 59, 0.8);
    transform: translateY(-5px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Primary Stat Card (Credits) */
.stat-card.primary {
    grid-column: span 1;
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.15), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.15);
}

.stat-card.primary:hover {
    box-shadow: 0 20px 50px rgba(37, 99, 235, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
}

/* Stat Icons - Glowing Box */
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 20px;
    position: relative;
    transition: all 0.3s ease;
    /* Default Blue */
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2), 0 8px 20px rgba(59, 130, 246, 0.15);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

.stat-icon.cyan {
    background: rgba(6, 182, 212, 0.1);
    color: #22d3ee;
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.2), 0 8px 20px rgba(6, 182, 212, 0.15);
}

.stat-icon.purple {
    background: rgba(168, 85, 247, 0.1);
    color: #c084fc;
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.2), 0 8px 20px rgba(168, 85, 247, 0.15);
}

.stat-label {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-family: var(--font-head);
    font-size: 42px;
    font-weight: 800;
    color: white;
    line-height: 1;
    /* Gradient Text */
    background: linear-gradient(135deg, white 30%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-recharge {
    margin-top: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #ffffff, #e2e8f0);
    color: #0f172a;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
    display: block;
}

.btn-recharge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, #ffffff, #f8fafc);
}

/* ===== TABS SECTION ===== */
.tabs-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.tabs-header {
    display: flex;
    justify-content: flex-start;
    /* Fix: prevent spreading */
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    gap: 8px;
    width: fit-content;
}

.tab {
    padding: 12px 24px;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.03);
}

.tab.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    color: #3b82f6;
    border-bottom: 2px solid #3b82f6;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* ===== LISTS & CONTENT ===== */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

.section-block h3 {
    font-family: var(--font-head);
    font-size: 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-list {
    display: grid;
    gap: 16px;
}

/* History Items - Button Style */
.history-item {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px 20px;
    /* Slimmer padding */
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.history-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateX(4px);
    /* Subtle slide */
}

/* Icons in History Item */
.history-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 20px;
    /* Default */
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    transition: all 0.3s ease;
}

.history-item:hover .history-icon {
    background: white;
    color: black;
    /* High contrast on hover */
    transform: scale(1.1);
}

.history-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.history-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    transition: color 0.2s;
}

.history-item:hover .history-title {
    color: white;
}

.history-meta {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Action Buttons inside Item */
.history-item .btn-icon-sm {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    cursor: pointer;
}

.history-item .btn-icon-sm:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transform: translateY(-2px);
}

/* ===== HISTORY CARD PRO MAX ===== */
.history-card-pro {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: var(--radius-m);
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
}

.history-card-pro:hover {
    background: rgba(30, 41, 59, 0.6);
    transform: translateX(6px) scale(1.01);
    border-color: var(--primary-glow);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.history-card-pro .thumb-container {
    width: 64px;
    height: 84px;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
    position: relative;
    flex-shrink: 0;
}

.history-card-pro .thumb-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.history-card-pro:hover .thumb-container img {
    transform: scale(1.1);
}

/* Shimmer Loading Effect */
.shimmer {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.05) 50%,
            rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Platform Badge */
.platform-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    z-index: 10;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.platform-badge.tiktok {
    background: rgba(0, 0, 0, 0.7);
    color: #00f2ea;
}

.platform-badge.facebook {
    background: rgba(24, 119, 242, 0.7);
    color: white;
}

.platform-badge.youtube {
    background: rgba(255, 0, 0, 0.7);
    color: white;
}

/* Custom Scrollbar for Pro Max List */
.history-list-pro::-webkit-scrollbar {
    width: 6px;
}

.history-list-pro::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.history-list-pro::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: background 0.3s;
}

.history-list-pro::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Right Indicator Hover */
.history-card-pro .btn-download-pro {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-left: auto;
}

.history-card-pro:hover .btn-download-pro {
    background: var(--primary);
    color: white;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Mobile Tweak */
@media (max-width: 480px) {
    .history-card-pro .history-title {
        max-width: 140px;
    }

    .history-card-pro .history-meta {
        font-size: 11px;
    }
}

/* ... existing styles ... */

/* ===== KB CARD ===== */
.kb-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    padding: 32px;
}

.kb-card h3 {
    color: var(--accent);
}

.kb-card textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    color: white;
    font-family: var(--font-mono);
    margin: 20px 0;
    resize: vertical;
}

/* ===== SETTINGS GRID ===== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 32px;
    border-radius: var(--radius-l);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-dim);
}

.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    color: white;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: white;
    color: black;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--border);
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-3px);
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-box {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    /* Fix scrolling issue */
    padding: 40px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-section {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .hero-section {
        grid-column: span 1;
        flex-direction: column;
        text-align: center;
    }

    .topbar {
        width: 95%;
        top: 10px;
    }
}

.hero-section .tier-badge {
    margin-top: 12px;
    padding: 6px 16px;
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.3);
    color: orange;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
    width: auto;
    height: auto;
}

/* ===== PREMIUM REPORT STYLES (Ported from Dashboard) ===== */
.score-header-pro {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--border);
    padding: 32px;
    border-radius: var(--radius-l);
}

.tier-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 140px;
}

.score-header-pro .tier-badge {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.tier-s {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e1b4b;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.4);
}

.tier-a {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: white;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

.tier-b {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: white;
}

.tier-c {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: white;
}

.tier-letter {
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
}

.tier-label {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.8;
    text-transform: uppercase;
}

.score-badge {
    text-align: center;
}

.score-value {
    font-size: 24px;
    font-weight: 800;
    color: white;
    display: block;
}

.score-label {
    font-size: 12px;
    color: var(--text-dim);
}

.critique-box h4 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--accent);
}

.critique-box p {
    font-size: 15px;
    color: var(--text-main);
    line-height: 1.7;
}

.layers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.layer-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius-m);
    transition: var(--transition);
}

.layer-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.layer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.layer-icon {
    font-size: 20px;
}

.layer-header h5 {
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
}

.layer-score {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent);
}

.layer-card p {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 12px;
}

.improvements {
    list-style: none;
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.improvements li {
    font-size: 13px;
    color: var(--text-dim);
    padding-left: 20px;
    position: relative;
}

.improvements li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary);
}

@media (max-width: 768px) {
    .score-header-pro {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px;
    }

    .layers-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== PRINT / PDF EXPORT STYLES ===== */
@media print {

    /* Hide everything by default */
    body>* {
        display: none !important;
    }

    /* Only show the print container */
    #print-area {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        margin: 0;
        padding: 20px;
        background: white !important;
        /* Clean white background for print */
        color: black !important;
        z-index: 99999;
    }

    /* Hide the print button itself inside the clone */
    .btn-print,
    .btn-primary-xl,
    button {
        display: none !important;
    }

    /* Reset Styles for Print Readability */
    #print-area * {
        color: black !important;
        text-shadow: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    /* Enhance Headers */
    #print-area h2,
    #print-area h3,
    #print-area h4,
    #print-area h5 {
        color: #1e293b !important;
        /* Dark Slate */
        font-weight: 800;
        margin-bottom: 10px;
        page-break-after: avoid;
    }

    /* Enhance Tier Badge */
    #print-area .tier-badge {
        border: 2px solid black;
        color: black !important;
        background: white !important;
    }

    /* Enhance Cards */
    #print-area .layer-card,
    #print-area .score-header-pro,
    #print-area .section-block {
        border: 1px solid #cbd5e1 !important;
        /* Light gray border */
        border-radius: 8px;
        margin-bottom: 20px;
        padding: 20px;
        break-inside: avoid;
        /* Prevent cutting cards across pages */
    }

    /* Hide decorative icons if needed, or keep them */
    #print-area i {
        color: #3b82f6 !important;
        /* Blue icons */
    }

    /* Layout Adjustments */
    #print-area .layers-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        /* 2 Column layout for layers */
        gap: 20px;
    }

    /* Force Page Margins */
    @page {
        margin: 2cm;
    }
}

/* ===================================================
   PROFESSIONAL UI ENHANCEMENTS V2.2
   Clean, modern, customer-friendly design
=================================================== */

/* 1. GRADIENT CREDITS - Eye-catching */
.stat-number,
#creditsRemaining {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(6, 182, 212, 0.4));
}

/* 2. SMOOTH CARD ANIMATIONS */
.stat-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.25);
    border-color: rgba(37, 99, 235, 0.4);
}

/* 3. ACTIVITY ITEM HOVER */
.activity-item {
    transition: all 0.3s ease;
}

.activity-item:hover {
    transform: translateX(6px);
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

/* 4. MODERN TAB ACTIVE STATE */
.tab {
    transition: all 0.3s ease;
}

.tab.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    color: #3b82f6;
    border-bottom: 2px solid #3b82f6;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* 5. BUTTON ENHANCEMENTS */
.btn-recharge,
button:not(.tab) {
    transition: all 0.3s ease;
}

/* 5. BUTTON ENHANCEMENTS */
.btn-recharge {
    margin-top: 16px;
    padding: 14px 24px;
    background: linear-gradient(135deg, white 0%, #e2e8f0 100%);
    color: #0f172a;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
    display: block;
    border: none;
}

.btn-recharge:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(255, 255, 255, 0.4);
    background: white;
}

button:not(.tab) {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:not(.tab):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

/* 6. TIER BADGE GLOW */
.tier-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

/* 8. PROPER SPACING */
.stats-grid {
    margin-bottom: 24px;
}

.profile-page {
    padding-top: 100px;
}

/* 9. PROFESSIONAL EMPTY STATES */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    min-height: 200px;
}

.empty-state i {
    display: block;
}

.empty-state p {
    font-size: 16px;
    color: var(--text-main);
}

.empty-state a {
    font-size: 14px;
    font-weight: 600;
}

/* 10. HIDE DEBUG ELEMENTS */
body::before,
body::after,
main::before,
main::after,
.profile-page::before,
.profile-page::after,
[style*="VIDEO"],
/* 11. BENTO GRID LAYOUT FIX */
.hero-section {
    grid-column: span 3;
}

.stats-grid>.stat-card:nth-child(2) {
    grid-column: span 1;
}

.stats-grid>.stat-card:nth-child(3),
.stats-grid>.stat-card:nth-child(4) {
    grid-column: span 2;
}

/* On mobile, stack everything */
@media (max-width: 768px) {

    .hero-section,
    .stats-grid>.stat-card {
        grid-column: span 1 !important;
    }
}

/* ===== REFERRAL PREMIUM UI ===== */
.referral-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto auto;
    gap: 20px;
    padding: 10px 0;
}

.referral-hero-pro {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(14, 165, 233, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 24px;
    padding: 40px;
    display: flex;
    align-items: center;
    gap: 32px;
    position: relative;
    overflow: hidden;
}

.referral-hero-pro::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent);
}

.referral-badge-icon {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.3);
    flex-shrink: 0;
    z-index: 1;
}

.referral-hero-content h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    color: white;
    font-family: var(--font-head);
}

.referral-hero-content p {
    color: var(--text-dim);
    line-height: 1.6;
    max-width: 600px;
}

.referral-stats-bento {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bento-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.bento-stat-card:hover {
    transform: translateX(10px);
    border-color: var(--primary-glow);
    background: rgba(255, 255, 255, 0.05);
}

.bento-stat-card .stat-inner {
    display: flex;
    flex-direction: column;
}

.bento-stat-card .stat-val {
    font-size: 36px;
    font-weight: 800;
    font-family: var(--font-head);
    line-height: 1;
    margin-bottom: 4px;
    background: linear-gradient(135deg, white, var(--text-dim));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bento-stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bento-stat-card i {
    font-size: 32px;
    color: var(--text-muted);
    opacity: 0.3;
}

.invited .stat-val {
    color: var(--accent);
}

.earned .stat-val {
    color: var(--success);
}

.referral-link-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.referral-link-card .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: var(--text-main);
}

.link-input-group {
    display: flex;
    gap: 12px;
}

.link-input-group input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 14px;
}

.btn-copy-pro {
    background: white;
    color: black;
    border: none;
    border-radius: 12px;
    padding: 0 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-copy-pro:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

.link-hint {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.referral-rules-card {
    grid-column: span 2;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
}

.referral-rules-card h3 {
    font-family: var(--font-head);
    font-size: 20px;
    margin-bottom: 24px;
}

.rules-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    list-style: none;
}

.rules-list li {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rule-num {
    font-family: var(--font-head);
    font-size: 32px;
    font-weight: 800;
    color: rgba(59, 130, 246, 0.2);
}

.rule-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dim);
}

@media (max-width: 768px) {
    .referral-grid {
        grid-template-columns: 1fr;
    }

    .referral-hero-pro {
        flex-direction: column;
        text-align: center;
        padding: 30px;
    }

    .referral-hero-pro {
        grid-column: span 1;
    }

    .rules-list {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .referral-rules-card {
        grid-column: span 1;
    }

    .link-input-group {
        flex-direction: column;
    }
}