/* --- global.css --- */
:root {
    /* Light Theme (Default) */
    --bg-color: #fcfbf7;
    --panel-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border: #e0e0e0;
    --accent-blue: #2d6cdf;
    --accent-red: #ff4f4f;
    --dropdown-bg: #ffffff;
    --dropdown-hover: #f5f5f5;

    --font-family: 'Space Grotesk', sans-serif;
}

[data-theme="dark"] {
    /* "Olivia" Dribbble Inspired Theme */
    --bg-color: #0e1225;
    /* Deepest Navy */
    --panel-bg: #1e2440;
    /* Card Navy */
    --text-main: #ffffff;
    /* Pure White */
    --text-muted: #8b96b5;
    /* Blue-Grey */
    --border: #2e365c;
    /* Muted Blue Border */

    /* Vibrant Accents */
    --accent-blue: #5b6bf9;
    /* Vibrant Royal Blue */
    --accent-red: #f43f5e;
    /* Hot Pink (matching the FAB vibe) */

    --dropdown-bg: #1e2440;
    --dropdown-hover: #2b335a;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- HEADER --- */
header {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    background-color: var(--panel-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 100;
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 26px;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-main);
    letter-spacing: -1.5px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Token Counter */
.token-pill {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.token-icon {
    color: #f1c40f;
}

/* Profile & Dropdown */
.profile-container {
    position: relative;
    cursor: pointer;
}

/* Nav Icon Buttons (History, Home, Notifications) */
.nav-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--panel-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-size: 18px;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.nav-icon-btn:hover {
    background: var(--dropdown-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    color: var(--accent-blue);
}

/* Updated Profile Pill */
.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--panel-bg);
    /* Clean background */
    padding: 6px 12px 6px 6px;
    /* Optimized padding */
    border-radius: 40px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.user-pill:hover {
    background: var(--dropdown-hover);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.user-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
}

.user-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
}

.user-email {
    font-size: 11px;
    color: var(--text-muted);
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: #ccc;
    background-position: center;
    background-size: cover;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid white;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 45px;
    right: 0;
    background: var(--dropdown-bg);
    width: 180px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    overflow: hidden;
    z-index: 1000;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.1s;
}

.dropdown-item:hover {
    background: var(--dropdown-hover);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
}

.text-red {
    color: var(--accent-red);
}

/* --- CONTROLLER --- */
.controller-col {
    background: var(--panel-bg);
    border-radius: 25px;
    border: 1px solid var(--border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.control-grid {
    display: grid;
    grid-template-columns: 50px 1fr;
    grid-template-rows: 1fr 50px;
    gap: 10px;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-items: center;
}

/* Sliders */
.slider-v-wrap {
    grid-row: 1;
    grid-column: 1;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

input.v-slider {
    -webkit-appearance: none;
    appearance: none;
    background: #eee;
    height: 8px;
    width: 240px;
    border-radius: 5px;
    outline: none;
    transform: rotate(-90deg);
    cursor: pointer;
}

.slider-h-wrap {
    grid-row: 2;
    grid-column: 2;
    width: 100%;
    display: flex;
    justify-content: center;
}

input.h-slider {
    -webkit-appearance: none;
    appearance: none;
    background: #eee;
    height: 8px;
    width: 90%;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-red);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* --- 3D DIAL STYLES --- */
.dial-area {
    grid-row: 1;
    grid-column: 2;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dial-wrapper {
    width: 220px;
    height: 220px;
    position: relative;
    /* Essential for 3D depth */
    perspective: 800px;
}

.dial-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid var(--accent-blue);
    /* Main color */
    position: absolute;
    /* CRITICAL: Ensures children (the dot) rotate in 3D with the parent */
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out;
    box-shadow: 0 0 20px rgba(45, 108, 223, 0.3);
    /* Glow */
}

/* Fakes 3D thickness */
.dial-ring::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 6px solid #1e3a8a;
    /* Darker blue for depth */
    border-radius: 50%;
    transform: translateZ(-8px);
    pointer-events: none;
}

.control-dot {
    width: 24px;
    height: 24px;
    background: var(--accent-red);
    border: 3px solid white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    z-index: 10;
    /* Optional: prevents the dot itself from flattening if you want it to look like a sphere */
    /* transform-style: preserve-3d; */
}

/* Dial Decorations */
.crosshair-v {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #ddd;
}

.crosshair-h {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.notch {
    position: absolute;
    top: -6px;
    left: 50%;
    width: 12px;
    height: 12px;
    background: #333;
    transform: translateX(-50%);
    border-radius: 2px;
}

/* Readout */
.readout {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 12px;
    width: 100%;
    font-family: monospace;
    font-size: 14px;
    color: var(--text-muted);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 15px;
}

.readout b {
    color: var(--accent-blue);
}

@media (max-width: 900px) {
    body {
        height: auto;
        overflow-y: auto;
    }
}

/* --- Image Overlay Actions --- */
.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.remove-btn:hover {
    background: var(--accent-red);
}

.result-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.action-btn {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--accent-blue);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* --- SUBSCRIBE BUTTON --- */
.subscribe-btn {
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
    font-family: var(--font-family);
}

.subscribe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.6);
}



/* Plan Icons */
.plan-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
}

.icon-blue {
    background: #3b82f6;
}

.icon-yellow {
    background: #eab308;
}

.icon-red {
    background: #ef4444;
}

/* Pricing Grid */
.pricing-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    padding: 20px 0;
}

.pricing-card {
    background: var(--bg-color);
    border: 2px solid var(--border);
    /* Default */
    border-radius: 20px;
    padding: 35px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    flex: 1 1 300px;
    /* Reduced to fit 3-up more easily */
    min-width: 280px;
    /* Ensure they don't get too small */
    max-width: 400px;
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Card Accents - Full Border */
.card-blue {
    border-color: #3b82f6;
}

.card-yellow {
    border-color: #eab308;
}

.card-red {
    border-color: #ef4444;
}

/* Popular Tag */
.popular-tag {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #eab308;
    color: black;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Card Content */
.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.emoji-icon {
    font-size: 24px;
}

.card-header h3 {
    margin: 0;
    font-size: 22px;
    /* Slightly larger */
    color: var(--text-main);
    font-weight: 600;
}

.price {
    font-size: 42px;
    /* Bigger */
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 5px;
    letter-spacing: -1px;
}

.price span {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: normal;
}

.limit {
    font-size: 15px;
    font-weight: 700;
    color: #3b82f6;
    /* Distinct blue like screenshot */
    margin-bottom: 5px;
}

.math-note {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    margin: 5px 0 20px 0;
}

.features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    flex-grow: 1;
}

.features li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 15px;
    color: #555;
    /* Slightly darker */
}

.features li i {
    color: #3b82f6;
    /* Checkmarks are blue */
    font-size: 12px;
}

.positioning {
    font-style: italic;
    text-align: center;
    margin-bottom: 25px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 16px;
}

/* Plan Buttons */
.plan-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-family);
    transition: all 0.2s;
    border: none;
}

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

/* Outline Button Revert */
.btn-blue-outline {
    background: transparent;
    border: 2px solid #3b82f6;
    color: #3b82f6;
}

.btn-blue-outline:hover {
    background: #eff6ff;
    color: #3b82f6;
}

.btn-yellow {
    background: #eab308;
    color: black;
}

.btn-yellow:hover {
    background: #ca8a04;
}

.btn-red {
    background: #ef4444;
    color: white;
}

.btn-red:hover {
    background: #dc2626;
    color: white;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .pricing-card {
    background: var(--panel-bg);
    border-color: var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .btn-blue-outline {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

[data-theme="dark"] .btn-blue-outline:hover {
    background: var(--accent-blue);
    color: white;
}

/* --- PROFILE PAGE --- */
.profile-main-container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
    overflow-y: auto;
    height: calc(100vh - 60px);
}

.profile-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.cover-wrapper {
    height: 200px;
    width: 100%;
    background-color: #ddd;
    position: relative;
    overflow: hidden;
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info-bar {
    padding: 0 30px 25px 30px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: -50px;
    flex-wrap: wrap;
    gap: 20px;
}

.profile-identity {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--panel-bg);
    background: #ccc;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.user-details {
    padding-bottom: 5px;
    margin-top: 60px;
}

.user-details h1 {
    margin: 0;
    font-size: 28px;
    color: var(--text-main);
    font-weight: 700;
}

.user-handle {
    margin: 0;
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 500;
}

.profile-actions {
    padding-bottom: 10px;
    display: flex;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.stat-info h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-info p {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
}

.bg-purple {
    background: linear-gradient(135deg, #a855f7, #9333ea);
}

.bg-blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.bg-green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

/* History Section */
.history-section h2 {
    color: var(--text-main);
    margin: 0 0 20px 0;
    font-size: 20px;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 600px) {

    /* Header Adjustments */
    header {
        padding: 0 15px;
        height: 55px;
    }

    .logo {
        font-size: 20px;
    }

    .header-right {
        gap: 8px;
    }

    /* Compact Subscribe Button */
    .subscribe-btn {
        padding: 8px;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        justify-content: center;
    }

    .subscribe-btn span,
    .subscribe-btn text {
        display: none;
        /* Attempt to hide text nodes if wrapped, otherwise font-size fix */
    }

    .subscribe-btn {
        font-size: 0;
        /* Hides text */
    }

    .subscribe-btn i {
        font-size: 14px;
        /* Show icon */
        margin: 0;
    }

    /* Compact Token Pill */
    .token-pill {
        padding: 4px 10px;
        font-size: 12px;
    }

    /* Compact User Profile */
    .user-pill {
        padding: 4px;
        /* Just around avatar */
        border: none;
        /* Cleaner look on mobile */
        background: transparent;
    }

    .user-pill:hover {
        background: transparent;
    }

    .user-text {
        display: none;
    }

    .avatar {
        margin: 0;
        width: 36px;
        height: 36px;
    }

    .chevron-icon {
        display: none;
    }

    /* Hide History/Home text labels if any existed, ensure buttons are sized right */
    .nav-icon-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    /* Profile Page Mobile adjustments */
    .profile-info-bar {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-top: -60px;
        padding-bottom: 20px;
    }

    .profile-identity {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .user-details {
        margin-top: 10px;
        padding-bottom: 0;
    }

    .profile-actions {
        width: 100%;
        justify-content: center;
    }
}


/* History Card specific actions (Global) */
.history-card .card-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.history-btn {
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-family: var(--font-family);
    border: 1px solid transparent;
}

.history-btn.btn-download {
    width: 40px;
    background: var(--panel-bg);
    border-color: var(--border);
    color: var(--text-main);
    flex-shrink: 0;
}

.history-btn.btn-download:hover {
    background: var(--dropdown-hover);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.history-btn.btn-edit {
    flex-grow: 1;
    background: var(--accent-blue);
    color: white;
    font-weight: 600;
}

.history-btn.btn-edit:hover {
    background: #4a8df8;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(45, 108, 223, 0.2);
}/* --- TOAST NOTIFICATIONS --- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--panel-bg); color: var(--text-main); border: 1px solid var(--border); padding: 12px 20px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); display: flex; align-items: center; gap: 12px; min-width: 280px; animation: slideIn 0.3s ease-out; font-size: 14px; font-weight: 500; backdrop-filter: blur(10px); }
.toast.success { border-left: 4px solid #4caf50; }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast i { font-size: 16px; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }
/* Skeleton Loading Animation */
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
