/* ──────────────────────────────────────────────────────────
   Grok Imagine Playground — Design System
   Dark mode, glassmorphism, modern aesthetic
   ────────────────────────────────────────────────────────── */

/* ─── Reset & Base ────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    --text-primary: #f5f5f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-1: #6366f1;
    --accent-2: #8b5cf6;
    --accent-3: #a78bfa;
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;
    --bkash: #e2136e;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 60px rgba(99, 102, 241, 0.15);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background-color: #030303;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* ─── Premium Background ───────────────────────────────── */
.bg-glow {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 70%);
    filter: blur(100px);
    z-index: -1;
    animation: pulse-glow 10s infinite alternate;
}

.bg-glow-2 {
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent 70%);
    filter: blur(100px);
    z-index: -1;
    animation: pulse-glow 12s infinite alternate-reverse;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    mask-image: radial-gradient(circle at center, black, transparent 80%);
}

@keyframes pulse-glow {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.5;
    }

    50% {
        transform: translate(5%, 5%) scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: translate(-2%, 8%) scale(1);
        opacity: 0.5;
    }
}

/* ─── Header ──────────────────────────────────────────── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 18px;
}

.logo-icon {
    color: var(--accent-1);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.credits-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-3);
}

.credits-badge svg {
    opacity: 0.7;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.btn-accent {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-3);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.btn-accent:hover {
    background: rgba(99, 102, 241, 0.25);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.btn-google {
    background: white;
    color: #333;
    width: 100%;
    justify-content: center;
    padding: 12px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-google:hover {
    background: #f8f8f8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-bkash {
    background: linear-gradient(135deg, var(--bkash), #c9115e);
    color: white;
    width: 100%;
    justify-content: center;
    padding: 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 4px 16px rgba(226, 19, 110, 0.3);
}

.btn-bkash:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(226, 19, 110, 0.45);
    transform: translateY(-1px);
}

/* ─── Main ────────────────────────────────────────────── */
.main {
    max-width: 800px;
    margin: 0 auto;
    padding: 76px 24px 40px;
}

/* ─── Hero ────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 20px 0 16px;
    position: relative;
}

.hero-glow {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 200px;
    background: radial-gradient(ellipse, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* ─── Tabs ────────────────────────────────────────────── */
.tabs-container {
    position: relative;
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition);
    position: relative;
    z-index: 1;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active {
    color: #fff;
    font-weight: 600;
}

.tab.active svg {
    color: var(--accent-1);
}

.tab-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
    pointer-events: none;
}

/* ─── Generation Panel ────────────────────────────────── */
.gen-container {
    position: relative;
}

.gen-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.gen-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gen-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.gen-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: block;
}

.gen-textarea {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 15px;
    resize: vertical;
    transition: border-color var(--transition);
    line-height: 1.5;
}

.gen-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
}

.gen-textarea::placeholder {
    color: var(--text-muted);
}

.gen-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 12px;
}

.gen-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gen-cost {
    font-size: 13px;
    color: var(--text-muted);
}

.gen-cost strong {
    color: var(--accent-3);
}

.gen-balance {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.8;
}

.gen-balance strong {
    color: var(--success);
}

/* ─── Generation Options ──────────────────────────────── */
.gen-options {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.gen-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 100px;
}

.option-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.option-select {
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    transition: border-color var(--transition);
    cursor: pointer;
}

.option-select:focus {
    outline: none;
    border-color: var(--border-focus);
}

.option-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ─── Upload Zone ─────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover {
    border-color: var(--accent-1);
    background: rgba(99, 102, 241, 0.05);
}

.upload-zone.has-image {
    padding: 0;
    border-style: solid;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.upload-placeholder svg {
    opacity: 0.5;
}

.upload-preview {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--radius-md);
}

/* ─── Output Area ─────────────────────────────────────── */
.output-area {
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.output-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.output-content {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.output-content img,
.output-content video {
    width: 100%;
    border-radius: var(--radius-md);
    display: block;
}

/* ─── Loading ─────────────────────────────────────────── */
.loading-area {
    margin-top: 24px;
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    animation: fadeIn 0.4s ease;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 16px;
    font-weight: 500;
}

.loading-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── History ─────────────────────────────────────────── */
.history-section {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 12px;
}

.history-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.history-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
    cursor: pointer;
}

.history-item:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.history-item img,
.history-item video {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.history-item-info {
    padding: 8px 10px;
}

.history-item-type {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-3);
    font-weight: 600;
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.1);
}

.history-item-prompt {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-item-placeholder {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 13px;
}

.history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}

.page-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

.page-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.page-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-3);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 6px;
}

/* ─── Modals ──────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.15s ease-out;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 420px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-icon {
    text-align: center;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

.modal-desc {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin: 8px 0 24px;
}

/* ─── Slider ──────────────────────────────────────────── */
.slider-container {
    margin-bottom: 20px;
}

.credit-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.credit-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.slider-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-3);
}

.price-display {
    text-align: center;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.price-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.price-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── Forms ───────────────────────────────────────────── */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    transition: border-color var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

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

/* ─── Toast ───────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 14px;
    min-width: 280px;
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    border-color: var(--success);
}

.toast.success::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
}

.toast.error {
    border-color: var(--error);
}

.toast.error::before {
    content: '✕';
    color: var(--error);
    font-weight: 700;
    font-size: 16px;
}

.toast.info {
    border-color: var(--accent-1);
}

.toast.info::before {
    content: 'ℹ';
    color: var(--accent-1);
    font-weight: 700;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─── Footer ──────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    margin-top: 48px;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-links {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--accent-3);
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
    .hero-title {
        font-size: 24px;
    }

    .hero-sub {
        font-size: 13px;
    }

    .hero {
        padding: 12px 0 10px;
    }

    .tab {
        font-size: 12px;
        padding: 10px 8px;
        gap: 4px;
    }

    .tab svg {
        display: none;
    }

    .header-inner {
        padding: 0 16px;
    }

    .main {
        padding: 70px 16px 32px;
    }

    .gen-form {
        padding: 14px;
    }

    .credits-badge {
        font-size: 12px;
        padding: 4px 10px;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 12px;
    }
}