/* ═══════════════════════════════════════════════════════════════
   SiMoMedya — Premium AI Video Platform Stylesheet
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(18, 18, 30, 0.7);
    --bg-card-hover: rgba(25, 25, 40, 0.8);
    --border: rgba(139, 92, 246, 0.15);
    --border-hover: rgba(139, 92, 246, 0.35);

    --text-primary: #f0f0f5;
    --text-secondary: #8b8ba0;
    --text-muted: #55556a;

    --accent-purple: #a78bfa;
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    --accent-green: #34d399;
    --accent-orange: #f59e0b;

    --gradient-main: linear-gradient(135deg, #a78bfa 0%, #06b6d4 50%, #34d399 100%);
    --gradient-purple: linear-gradient(135deg, #a78bfa, #7c3aed);
    --gradient-warm: linear-gradient(135deg, #f59e0b, #ec4899);

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.15);

    --font: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ─── PARTICLE CANVAS ─── */
#particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ─── GRADIENT TEXT ─── */
.gradient-text {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline;
}

/* ─── HEADER ─── */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 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;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 36px; height: 36px;
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-accent {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 4px;
}

.nav-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}

.nav-tab.active {
    color: #fff;
    background: var(--gradient-purple);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.tab-icon {
    font-size: 1rem;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.badge-dot {
    width: 6px; height: 6px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.badge-text {
    display: inline;
}

/* ─── MAIN ─── */
main {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 60px;
    min-height: calc(100vh - 140px);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

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

/* ─── HERO ─── */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.15;
    margin-bottom: 14px;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ─── GENERATION CARD ─── */
.generation-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.model-selector, .aspect-selector {
    display: flex;
    gap: 6px;
}

.model-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.model-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.model-btn.active {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
}

.model-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-badge.pro {
    background: var(--gradient-purple);
    color: #fff;
}

.model-badge.ultra {
    background: var(--gradient-warm);
    color: #fff;
}

.aspect-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--mono);
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.3s;
}

.aspect-btn:hover { border-color: var(--border-hover); }
.aspect-btn.active {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
}

/* ─── PROMPT AREA ─── */
.prompt-area {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: border-color 0.3s;
}

.prompt-area:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

#video-prompt {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

#video-prompt::placeholder {
    color: var(--text-muted);
}

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

.char-count {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.generate-btn {
    background: var(--gradient-purple);
    border: none;
    color: #fff;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.45);
}

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

.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

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

/* ─── PROGRESS ─── */
.progress-section {
    margin-top: 24px;
}

.progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-main);
    border-radius: 4px;
    transition: width 1s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.progress-time {
    font-family: var(--mono);
    color: var(--accent-cyan);
}

/* ─── RESULT ─── */
.result-section {
    margin-top: 24px;
}

.result-video-wrapper {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.result-video-wrapper video {
    width: 100%;
    display: block;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.action-btn.primary {
    background: var(--gradient-main);
    color: #000;
}

.action-btn.secondary {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.action-btn:hover {
    transform: translateY(-2px);
}

.result-meta {
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--mono);
    text-align: center;
}

/* ─── CHAT ─── */
.chat-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    max-height: 700px;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.free-badge {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-green);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.model-dropdown-wrapper {
    position: relative;
}

.model-dropdown {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 8px 14px;
    padding-right: 32px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8ba0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.model-dropdown:hover {
    border-color: var(--border-hover);
}

.model-dropdown:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

.model-dropdown option {
    background: #1a1a2e;
    color: var(--text-primary);
    padding: 8px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: msgIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: rgba(255,255,255,0.06);
}

.message.user .message-avatar {
    background: var(--gradient-purple);
}

.message-content {
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 12px 16px;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-primary);
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .message-content {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.message.bot .message-content {
    border: 1px solid var(--border);
}

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    resize: none;
    outline: none;
    max-height: 120px;
    transition: border-color 0.3s;
}

#chat-input:focus {
    border-color: var(--accent-purple);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: var(--gradient-purple);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.chat-send-btn svg {
    width: 18px; height: 18px;
}

/* ─── CREDITS ─── */
.credits-dashboard {
    padding: 10px 0;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

.sub-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.credits-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.credit-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(12px);
    transition: all 0.3s;
}

.credit-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.credit-card.balance { border-left: 3px solid var(--accent-green); }
.credit-card.used { border-left: 3px solid var(--accent-orange); }
.credit-card.count { border-left: 3px solid var(--accent-purple); }
.credit-card.gemini-card { border-left: 3px solid var(--accent-cyan); }

.credit-icon {
    font-size: 2rem;
}

.credit-info {
    display: flex;
    flex-direction: column;
}

.credit-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.credit-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--mono);
}

.free-text {
    color: var(--accent-green) !important;
}

/* ─── USAGE TABLE ─── */
.usage-table-wrapper {
    overflow-x: auto;
}

.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.usage-table th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.usage-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-primary);
}

.usage-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

/* ─── HISTORY ─── */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

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

.history-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
}

.history-item video {
    width: 100%;
    display: block;
}

.history-item-info {
    padding: 12px;
}

.history-item-info p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-info span {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* ─── IMAGE GENERATION (DALL-E) ─── */
#image-prompt {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}
#image-prompt::placeholder { color: var(--text-muted); }

.img-size-btn, .img-style-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.img-size-btn:hover, .img-style-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.img-size-btn.active { border-color: var(--accent-pink); background: rgba(236,72,153,0.12); color: var(--accent-pink); }
.img-style-btn.active { border-color: var(--accent-orange); background: rgba(245,158,11,0.12); color: var(--accent-orange); }

.dalle-btn { background: linear-gradient(135deg, #ec4899, #f59e0b) !important; box-shadow: 0 4px 15px rgba(236,72,153,0.3) !important; }
.dalle-btn:hover { box-shadow: 0 6px 25px rgba(236,72,153,0.45) !important; }

.result-image-wrapper {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.result-image-wrapper img { width: 100%; display: block; transition: transform 0.3s; }
.result-image-wrapper:hover img { transform: scale(1.02); }
.img-history-grid .history-item img { width: 100%; display: block; aspect-ratio: 1; object-fit: cover; }

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

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    color: var(--text-primary);
    font-size: 0.85rem;
    backdrop-filter: blur(20px);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
    box-shadow: var(--shadow);
    max-width: 360px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-pink); }
.toast.info { border-left: 3px solid var(--accent-cyan); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* ─── FOOTER ─── */
footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.2);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.4);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 10px;
    }

    .header-badge { display: none; }

    .nav-tabs {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .nav-tab {
        font-size: 0.78rem;
        padding: 6px 12px;
    }

    .tab-icon { display: none; }

    main { padding: 20px 16px 40px; }

    .hero-title { font-size: 1.8rem; }
    .hero-subtitle { font-size: 0.9rem; }

    .generation-card { padding: 18px; }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .model-selector, .aspect-selector {
        width: 100%;
    }

    .model-btn, .aspect-btn {
        flex: 1;
        justify-content: center;
    }

    .result-actions { flex-direction: column; }

    .credits-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .credit-card { padding: 16px; }
    .credit-value { font-size: 1.2rem; }
    .credit-icon { font-size: 1.5rem; }

    .chat-container {
        height: calc(100vh - 180px);
    }

    .usage-table { font-size: 0.75rem; }
    .usage-table th, .usage-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.5rem; }

    .credits-cards {
        grid-template-columns: 1fr;
    }

    .nav-tab {
        font-size: 0.72rem;
        padding: 6px 10px;
    }
}
