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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

header { text-align: center; padding: 60px 0 40px; position: relative; }
.header-nav {
    position: absolute; top: 15px; left: 20px; right: 20px;
    display: flex; justify-content: space-between; align-items: center;
}
.header-nav a {
    color: #888; text-decoration: none; font-size: 0.875rem;
    padding: 8px 16px; border-radius: 20px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s;
}
.header-nav a:hover { color: #fff; background: rgba(255,255,255,0.1); }
@media (max-width: 600px) {
    header { padding: 70px 0 30px; }
    .header-nav a { padding: 6px 12px; font-size: 0.8rem; }
}
.logo {
    font-size: 2.5rem; font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.tagline { color: #888; margin-top: 10px; font-size: 1.1rem; }

/* Tabs */
.tabs { display: flex; justify-content: center; gap: 10px; margin-bottom: 30px; }
.tab {
    padding: 12px 24px; background: rgba(255,255,255,0.1);
    border: none; border-radius: 25px; color: #fff;
    cursor: pointer; font-size: 1rem; transition: all 0.3s;
    text-decoration: none; display: inline-block;
}
.tab:hover { background: rgba(255,255,255,0.2); color: #fff; }
.tab.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }

/* My Reels Grid */
.my-reels-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.reel-card {
    background: rgba(255,255,255,0.05); border-radius: 16px;
    overflow: hidden; border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s;
}
.reel-card:hover { transform: translateY(-5px); border-color: #667eea; }
.reel-thumbnail {
    aspect-ratio: 9/16; background: rgba(0,0,0,0.3);
    position: relative; overflow: hidden;
}
.reel-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.reel-thumbnail .play-overlay {
    position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,0.4); opacity: 0; transition: opacity 0.3s;
}
.reel-card:hover .play-overlay { opacity: 1; }
.play-overlay span { font-size: 3rem; }
.reel-status {
    position: absolute; top: 10px; right: 10px;
    padding: 4px 12px; border-radius: 20px; font-size: 0.75rem;
    font-weight: 600;
}
.reel-status.completed { background: #10b981; }
.reel-status.processing { background: #f59e0b; }
.reel-status.failed { background: #ef4444; }
.reel-status.expired { background: #6b7280; }
.reel-info { padding: 15px; }
.reel-title {
    font-weight: 600; font-size: 0.95rem; margin-bottom: 8px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reel-meta { display: flex; gap: 15px; font-size: 0.8rem; color: #888; margin-bottom: 12px; }
.reel-actions { display: flex; gap: 8px; }
.reel-actions button {
    flex: 1; padding: 8px 12px; border: none; border-radius: 8px;
    cursor: pointer; font-size: 0.85rem; transition: all 0.2s;
}
.btn-download { background: #667eea; color: white; }
.btn-download:hover { background: #764ba2; }
.btn-download:disabled { background: #4a5568; cursor: not-allowed; }
.btn-regenerate { background: rgba(255,255,255,0.1); color: white; }
.btn-regenerate:hover { background: rgba(255,255,255,0.2); }
.btn-delete { background: rgba(239,68,68,0.2); color: #ef4444; }
.btn-delete:hover { background: rgba(239,68,68,0.4); }
.empty-reels {
    text-align: center; padding: 60px 20px; color: #888;
}
.empty-reels span { font-size: 4rem; display: block; margin-bottom: 20px; }

/* Main Content */
.main-content { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
@media (max-width: 900px) { .main-content { grid-template-columns: 1fr; } }

/* Cards */
.card {
    background: rgba(255,255,255,0.05); border-radius: 20px; padding: 25px;
    backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1);
}
.card-title {
    font-size: 1.3rem; font-weight: 600; margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}
.card-title span { font-size: 1.5rem; }

/* Form */
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; color: #aaa; font-size: 0.9rem; }
input, textarea, select {
    width: 100%; padding: 12px 15px; background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2); border-radius: 10px;
    color: #fff; font-size: 1rem; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #667eea; }
textarea { resize: vertical; min-height: 80px; }
select option { background: #1a1a2e; }

/* Upload Zone */
.upload-zone {
    border: 2px dashed rgba(255,255,255,0.3); border-radius: 15px;
    padding: 30px; text-align: center; cursor: pointer;
    transition: all 0.3s; margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: #667eea; background: rgba(102, 126, 234, 0.1);
}
.upload-icon { font-size: 3rem; margin-bottom: 10px; }
.upload-text { color: #aaa; margin-bottom: 10px; }
.upload-hint { font-size: 0.8rem; color: #666; }
.upload-input { display: none; }

/* Uploaded Images */
.uploaded-images {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px; margin-bottom: 20px;
}
.uploaded-image-item {
    position: relative; border-radius: 12px; overflow: hidden;
    background: rgba(0,0,0,0.3); border: 2px solid transparent;
    cursor: grab; transition: transform 0.2s, opacity 0.2s;
}
.uploaded-image-item:active { cursor: grabbing; }
.uploaded-image-item.selected { border-color: #667eea; }
.uploaded-image-item.dragging { opacity: 0.5; transform: scale(0.95); }
.uploaded-image-item.drag-over { border-color: #ffc107; transform: scale(1.05); }
.uploaded-image-item img { width: 100%; aspect-ratio: 9/16; object-fit: cover; }
.uploaded-image-item .remove-btn {
    position: absolute; top: 5px; right: 5px;
    background: rgba(255,0,0,0.7); border: none; color: #fff;
    width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
}
.uploaded-image-item .image-number {
    position: absolute; bottom: 5px; left: 5px;
    background: rgba(0,0,0,0.7); padding: 2px 10px;
    border-radius: 10px; font-size: 0.8rem;
}
.uploaded-image-item .edit-btn {
    position: absolute; bottom: 5px; right: 5px;
    background: rgba(102, 126, 234, 0.9); border: none; color: #fff;
    padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 0.85rem;
    transition: all 0.2s;
}
.uploaded-image-item .edit-btn:hover {
    background: rgba(102, 126, 234, 1); transform: scale(1.1);
}
.uploaded-image-item.has-custom .edit-btn {
    background: rgba(76, 175, 80, 0.9);
}

/* Crop Preview Modal */
.crop-preview-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9); display: flex; align-items: center;
    justify-content: center; z-index: 1000;
}
.crop-preview-content {
    background: #1a1a2e; border-radius: 15px; padding: 25px;
    max-width: 900px; width: 95%;
}
.crop-preview-content h3 { margin-bottom: 15px; text-align: center; }
.crop-container {
    display: flex; gap: 30px; justify-content: center; align-items: flex-start;
    flex-wrap: wrap; margin-bottom: 20px;
}
.crop-editor {
    position: relative; display: inline-block;
}
.crop-editor img {
    max-width: 400px; max-height: 400px; display: block;
    border-radius: 8px;
}
.crop-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); pointer-events: none;
}
.crop-box {
    position: absolute; border: 3px solid #667eea;
    background: transparent; cursor: move;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.6);
    border-radius: 4px;
}
.crop-box::before {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 30px; height: 30px;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 50%;
}
.crop-preview-side {
    text-align: center;
}
.crop-side-label {
    font-size: 0.9rem; color: #888; margin-bottom: 8px;
}
.crop-result-container {
    width: 135px; height: 240px; /* 9:16 ratio */
    border-radius: 8px; overflow: hidden;
    border: 2px solid #667eea;
    background: #000;
}
.crop-result {
    width: 100%; height: 100%; object-fit: cover;
}
.crop-info {
    font-size: 0.85rem; color: #888; text-align: center; margin-bottom: 15px;
}

/* Image Narration Editor */
.image-narration-editor {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8); display: flex; align-items: center;
    justify-content: center; z-index: 1000;
}
.narration-editor-content {
    background: #1a1a2e; border-radius: 15px; padding: 25px;
    max-width: 500px; width: 90%;
}
.narration-editor-content h3 { margin-bottom: 15px; }
.narration-editor-content textarea { min-height: 100px; margin-bottom: 15px; }

/* Mode Selector */
.mode-selector { display: flex; gap: 15px; margin-bottom: 20px; }
.mode-option {
    flex: 1; padding: 15px; background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1); border-radius: 12px;
    cursor: pointer; transition: all 0.3s; text-align: center;
}
.mode-option:hover { background: rgba(255,255,255,0.1); }
.mode-option.selected {
    border-color: #667eea; background: rgba(102, 126, 234, 0.15);
}
.mode-option .mode-icon { font-size: 2rem; margin-bottom: 8px; }
.mode-option .mode-name { font-weight: 600; margin-bottom: 4px; }
.mode-option .mode-desc { font-size: 0.8rem; color: #888; }
.mode-option .mode-price {
    margin-top: 8px; font-size: 0.75rem; padding: 3px 10px;
    background: rgba(255,255,255,0.1); border-radius: 10px; display: inline-block;
}
.mode-option.selected .mode-price { background: rgba(102, 126, 234, 0.3); }

/* Settings Row */
.settings-row { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; }
.settings-row .form-group { flex: 1; min-width: 120px; margin-bottom: 0; }

/* Toggle */
.toggle-row { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.toggle-switch { position: relative; width: 50px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.2); transition: 0.3s; border-radius: 26px;
}
.toggle-slider:before {
    position: absolute; content: ""; height: 20px; width: 20px;
    left: 3px; bottom: 3px; background-color: white;
    transition: 0.3s; border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(24px); }

/* Voice Options */
.voice-options { display: flex; gap: 10px; flex-wrap: wrap; }
.voice-option {
    padding: 10px 16px; background: rgba(255,255,255,0.1);
    border: 2px solid transparent; border-radius: 20px;
    cursor: pointer; transition: all 0.3s;
}
.voice-option:hover { background: rgba(255,255,255,0.15); }
.voice-option.selected { border-color: #667eea; background: rgba(102, 126, 234, 0.2); }

/* Buttons */
.btn {
    padding: 12px 24px; border: none; border-radius: 10px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: all 0.3s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff; width: 100%; justify-content: center; font-size: 1.1rem; padding: 15px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.cost-badge {
    background: rgba(255,255,255,0.2); padding: 3px 8px; border-radius: 10px;
    font-size: 0.8rem; margin-left: 8px; font-weight: 500;
}
.btn-secondary { background: rgba(255,255,255,0.1); color: #fff; }
.btn-secondary:hover { background: rgba(255,255,255,0.2); }
.btn-download {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff; padding: 15px 30px; font-size: 1.1rem;
}

/* AI Story Prompt */
.story-prompt-section {
    margin-top: 15px; padding: 15px; background: rgba(102, 126, 234, 0.1);
    border-radius: 10px; border: 1px solid rgba(102, 126, 234, 0.3);
}
.story-prompt-section textarea { font-size: 0.9rem; }

/* Manual Mode Hint */
.manual-mode-hint {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 15px; background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.4); border-radius: 10px;
    margin-bottom: 15px;
}
.manual-mode-hint .hint-icon { font-size: 1.5rem; }
.manual-mode-hint .hint-text { font-size: 0.9rem; color: #ffc107; }

/* Generated Plan */
.generated-plan { margin-bottom: 20px; }
.plan-scene {
    background: rgba(255,255,255,0.05); border-radius: 12px;
    padding: 15px; margin-bottom: 15px; position: relative;
}
.plan-scene-number {
    position: absolute; top: -10px; left: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 4px 12px; border-radius: 15px; font-size: 0.8rem; font-weight: 600;
}
.plan-scene label { font-size: 0.8rem; margin-bottom: 5px; }
.plan-scene input, .plan-scene textarea { font-size: 0.9rem; margin-bottom: 10px; }
.plan-scene textarea { min-height: 60px; }

/* Preview */
.preview-panel { position: sticky; top: 20px; }
.video-preview {
    width: 100%; aspect-ratio: 9/16; max-height: 500px;
    background: #000; border-radius: 15px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.video-preview video { width: 100%; height: 100%; object-fit: contain; }
.video-placeholder { text-align: center; color: #555; }
.video-placeholder span { font-size: 4rem; display: block; margin-bottom: 15px; }

/* Progress */
.progress-container { margin-top: 20px; }
.progress-bar { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.progress-fill {
    height: 100%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px; transition: width 0.3s;
}
.progress-text { display: flex; justify-content: space-between; margin-top: 10px; font-size: 0.9rem; color: #888; }
.status-text { color: #667eea; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.processing .status-text { animation: pulse 1.5s infinite; }

/* Scene Timeline */
.scene-timeline { margin-top: 15px; }
.scene-timeline-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.scene-timeline-item:last-child { border-bottom: none; }
.scene-number {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,0.1); display: flex;
    align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 600; flex-shrink: 0;
}
.scene-number.completed { background: #10b981; }
.scene-number.processing { background: #f59e0b; animation: pulse 1s infinite; }
.scene-number.failed { background: #ef4444; }
.scene-content { flex: 1; }
.scene-title { font-weight: 500; margin-bottom: 4px; }
.scene-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.scene-step {
    font-size: 0.75rem; padding: 2px 8px; border-radius: 10px;
    background: rgba(255,255,255,0.1); color: #888;
}
.scene-step.completed { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.scene-step.processing { background: rgba(245, 158, 11, 0.2); color: #f59e0b; animation: pulse 1s infinite; }
.scene-step-time { font-size: 0.7rem; color: #666; margin-left: 4px; }
.scene-duration { font-size: 0.8rem; color: #667eea; margin-top: 4px; }

.download-section { margin-top: 20px; text-align: center; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* Auth Modal */
.auth-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8); display: flex; align-items: center;
    justify-content: center; z-index: 2000;
}
.auth-content {
    background: #1a1a2e; border-radius: 20px; padding: 30px;
    max-width: 400px; width: 90%; text-align: center;
}
.auth-content h2 { margin-bottom: 10px; font-size: 1.8rem; }
.auth-content .subtitle { color: #888; margin-bottom: 25px; }
.auth-tabs { display: flex; margin-bottom: 20px; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,0.1); }
.auth-tab { flex: 1; padding: 12px; border: none; background: transparent; color: #fff; cursor: pointer; transition: 0.3s; }
.auth-tab.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.auth-form { text-align: left; }
.auth-form .form-group { margin-bottom: 15px; }
.auth-form input { margin-top: 5px; }
.auth-divider { display: flex; align-items: center; margin: 20px 0; color: #666; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.2); }
.auth-divider span { padding: 0 15px; }
.btn-google {
    width: 100%; padding: 12px; border: 1px solid rgba(255,255,255,0.3);
    border-radius: 10px; background: transparent; color: #fff;
    font-size: 1rem; cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 10px; transition: 0.3s;
}
.btn-google:hover { background: rgba(255,255,255,0.1); }
.btn-google svg { width: 20px; height: 20px; }
.auth-error { color: #ff6b6b; font-size: 0.9rem; margin-bottom: 15px; padding: 10px; background: rgba(255,107,107,0.1); border-radius: 8px; }
.auth-success { color: #4caf50; font-size: 0.9rem; margin-bottom: 15px; padding: 10px; background: rgba(76,175,80,0.1); border-radius: 8px; }
.auth-close { position: absolute; top: 15px; right: 15px; background: transparent; border: none; color: #888; font-size: 1.5rem; cursor: pointer; }

/* Message Modal */
.message-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8); display: flex; align-items: center;
    justify-content: center; z-index: 3000;
}
.message-content {
    background: #1a1a2e; border-radius: 20px; padding: 30px;
    max-width: 400px; width: 90%; text-align: center;
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
.message-icon { font-size: 3rem; margin-bottom: 15px; }
.message-content h3 { margin-bottom: 15px; font-size: 1.4rem; }
.message-content p { color: #aaa; margin-bottom: 25px; line-height: 1.5; }
.message-buttons { display: flex; gap: 10px; justify-content: center; }
.message-buttons .btn { min-width: 100px; padding: 12px 20px; }
.message-modal.error .message-icon { color: #ff6b6b; }
.message-modal.success .message-icon { color: #38ef7d; }
.message-modal.warning .message-icon { color: #ffc107; }
.message-modal.info .message-icon { color: #667eea; }

/* Video Modal */
.video-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9); display: flex; align-items: center;
    justify-content: center; z-index: 3000;
}
.video-modal-content {
    position: relative; max-width: 400px; width: 90%;
    animation: modalSlideIn 0.3s ease;
}
.video-modal-close {
    position: absolute; top: -40px; right: 0;
    background: transparent; border: none; color: #fff;
    font-size: 2rem; cursor: pointer; z-index: 10;
}
.video-modal-close:hover { color: #ff6b6b; }
.video-modal video {
    width: 100%; border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* User Menu */
.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo-section { flex: 1; text-align: center; }
.user-section { display: flex; align-items: center; gap: 15px; }
.credits-badge {
    background: rgba(102, 126, 234, 0.2); padding: 8px 15px;
    border-radius: 20px; font-size: 0.9rem; display: flex; align-items: center; gap: 8px;
    position: relative; cursor: pointer; transition: 0.2s;
}
.credits-badge:hover { background: rgba(102, 126, 234, 0.35); }
.credits-badge .credits-num { font-weight: 600; color: #667eea; }
.credits-dropdown {
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    background: #1a1a2e; border-radius: 12px; padding: 12px;
    padding-top: 20px; margin-top: -8px;
    min-width: 180px; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: none; z-index: 100;
}
.credits-dropdown::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 20px;
    background: transparent;
}
.credits-badge:hover .credits-dropdown { display: block; }
.credits-dropdown-title { font-size: 0.8rem; color: #888; margin-bottom: 8px; text-align: center; }
.credits-pack {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; border-radius: 8px; margin-bottom: 6px;
    background: rgba(255,255,255,0.05); cursor: pointer; transition: 0.2s;
}
.credits-pack:hover { background: rgba(102, 126, 234, 0.3); }
.credits-pack:last-child { margin-bottom: 0; }
.credits-pack .pack-credits { font-weight: 600; color: #fff; }
.credits-pack .pack-price { color: #667eea; font-weight: 600; }
.user-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; cursor: pointer; position: relative;
}
.user-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.user-dropdown {
    position: absolute; top: 50px; right: 0; background: #1a1a2e;
    border-radius: 12px; padding: 10px 0; min-width: 200px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5); display: none; z-index: 100;
}
.user-dropdown.show { display: block; }
.user-dropdown-header { padding: 10px 15px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.user-dropdown-header .name { font-weight: 600; }
.user-dropdown-header .email { font-size: 0.8rem; color: #888; }
.user-dropdown-item {
    display: block; width: 100%; padding: 10px 15px; border: none;
    background: transparent; color: #fff; text-align: left;
    cursor: pointer; transition: 0.2s;
}
.user-dropdown-item:hover { background: rgba(255,255,255,0.1); }
.user-dropdown-item.upgrade { color: #667eea; }
.btn-login {
    padding: 10px 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none; border-radius: 20px; color: #fff; font-weight: 600;
    cursor: pointer; transition: 0.3s;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4); }
.pro-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 3px 10px; border-radius: 10px; font-size: 0.7rem;
    font-weight: 600; margin-left: 5px;
}

/* Dashboard/History Modal */
.dashboard-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); display: flex; align-items: center;
    justify-content: center; z-index: 2000; padding: 20px;
}
.dashboard-content {
    background: #1a1a2e; border-radius: 20px; padding: 25px;
    max-width: 700px; width: 100%; max-height: 85vh; overflow-y: auto;
    position: relative;
}
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.dashboard-header h2 { margin: 0; font-size: 1.5rem; }
.dashboard-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px;
}
.stat-card {
    background: rgba(255,255,255,0.05); padding: 15px; border-radius: 12px; text-align: center;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: #667eea; }
.stat-card .stat-label { font-size: 0.85rem; color: #888; margin-top: 5px; }
.history-section { margin-top: 20px; }
.history-section h3 { font-size: 1.1rem; margin-bottom: 15px; color: #ccc; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
    background: rgba(255,255,255,0.03); padding: 12px 15px; border-radius: 10px;
    display: flex; justify-content: space-between; align-items: center;
    border-left: 3px solid transparent;
}
.history-item.type-login { border-left-color: #4CAF50; }
.history-item.type-register { border-left-color: #2196F3; }
.history-item.type-generate { border-left-color: #FF9800; }
.history-item.type-subscription_started { border-left-color: #E91E63; }
.history-item.type-subscription_renewed { border-left-color: #9C27B0; }
.history-item.type-subscription_cancelled { border-left-color: #F44336; }
.history-item.type-credits_refunded { border-left-color: #4CAF50; }
.history-item-left { flex: 1; }
.history-item-desc { font-size: 0.95rem; }
.history-item-time { font-size: 0.75rem; color: #666; margin-top: 3px; }
.history-item-right { text-align: right; }
.history-item-credits {
    font-weight: 600; font-size: 0.9rem;
}
.history-item-credits.positive { color: #4CAF50; }
.history-item-credits.negative { color: #FF5722; }
.history-item-credits.neutral { color: #888; }
.history-item-balance { font-size: 0.75rem; color: #666; }
.history-empty { text-align: center; color: #666; padding: 30px; }
.load-more-btn {
    width: 100%; padding: 10px; margin-top: 15px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; color: #888;
    cursor: pointer; transition: 0.2s;
}
.load-more-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Stripe loading overlay */
#stripeLoaderOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
#stripeLoaderOverlay.visible {
    opacity: 1;
    visibility: visible;
}
.stripe-loader-content {
    text-align: center;
    color: #fff;
}
.stripe-loader-content p {
    margin-top: 20px;
    font-size: 1.1rem;
}
.stripe-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: stripe-spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes stripe-spin {
    to { transform: rotate(360deg); }
}

/* ========== MOBILE RESPONSIVE STYLES ========== */

/* Tablets and smaller */
@media (max-width: 768px) {
    .container { padding: 15px; }
    header { padding: 60px 0 25px; }

    .logo { font-size: 2rem; }
    .tagline { font-size: 0.95rem; }

    /* Tabs */
    .tabs { gap: 6px; flex-wrap: wrap; justify-content: center; }
    .tab { padding: 10px 16px; font-size: 0.9rem; }

    /* Cards */
    .card { padding: 20px; border-radius: 16px; }
    .card-title { font-size: 1.15rem; }

    /* Mode selector - 2 columns on tablet */
    .mode-selector { gap: 10px; }
    .mode-option { padding: 12px; }
    .mode-option .mode-icon { font-size: 1.6rem; }
    .mode-option .mode-name { font-size: 0.9rem; }
    .mode-option .mode-desc { font-size: 0.75rem; }

    /* Settings row */
    .settings-row { gap: 10px; }
    .settings-row .form-group { min-width: 100px; }

    /* Voice options */
    .voice-options { gap: 8px; }
    .voice-option { padding: 8px 12px; font-size: 0.9rem; }

    /* Buttons */
    .btn-primary { padding: 14px; font-size: 1rem; }

    /* Preview panel */
    .video-preview { max-height: 400px; }

    /* Scene timeline */
    .scene-timeline-item { padding: 8px 0; }
    .scene-steps { gap: 4px; }
    .scene-step { font-size: 0.7rem; padding: 2px 6px; }

    /* Dashboard */
    .dashboard-stats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .stat-card { padding: 12px 8px; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .stat-card .stat-label { font-size: 0.75rem; }

    /* My Reels Grid */
    .my-reels-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container { padding: 10px; }
    header { padding: 55px 0 20px; }

    /* Header nav - stack on very small */
    .header-nav {
        top: 8px; left: 10px; right: 10px;
        gap: 8px;
    }
    .header-nav a {
        padding: 5px 10px;
        font-size: 0.7rem;
    }

    .logo { font-size: 1.6rem; }
    .tagline { font-size: 0.85rem; margin-top: 6px; }

    /* User section */
    .user-section { gap: 8px; }
    .credits-badge {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    .btn-login {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    .user-avatar { width: 34px; height: 34px; }

    /* Tabs - horizontal scroll on tiny screens */
    .tabs {
        gap: 5px;
        overflow-x: auto;
        padding-bottom: 5px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }
    .tab {
        padding: 8px 14px;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Cards */
    .card { padding: 15px; border-radius: 14px; }
    .card-title { font-size: 1.05rem; margin-bottom: 15px; }
    .card-title span { font-size: 1.2rem; }

    /* Mode selector - stack vertically */
    .mode-selector {
        flex-direction: column;
        gap: 10px;
    }
    .mode-option {
        padding: 12px 15px;
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: left;
    }
    .mode-option .mode-icon {
        font-size: 1.8rem;
        margin-bottom: 0;
    }
    .mode-option .mode-name { font-size: 0.95rem; }
    .mode-option .mode-desc { font-size: 0.8rem; }
    .mode-option .mode-price { margin-top: 4px; }

    /* Form elements */
    .form-group { margin-bottom: 15px; }
    label { font-size: 0.85rem; margin-bottom: 6px; }
    input, textarea, select {
        padding: 10px 12px;
        font-size: 0.95rem;
        border-radius: 8px;
    }
    textarea { min-height: 70px; }

    /* Settings row - stack */
    .settings-row {
        flex-direction: column;
        gap: 12px;
    }
    .settings-row .form-group {
        min-width: 100%;
        width: 100%;
    }

    /* Toggle */
    .toggle-row { gap: 8px; }
    .toggle-row label { font-size: 0.85rem; }

    /* Voice options - wrap nicely */
    .voice-options { gap: 6px; }
    .voice-option {
        padding: 8px 12px;
        font-size: 0.85rem;
        border-radius: 16px;
    }

    /* Upload zone */
    .upload-zone { padding: 20px 15px; }
    .upload-icon { font-size: 2.5rem; }
    .upload-text { font-size: 0.9rem; }
    .upload-hint { font-size: 0.75rem; }

    /* Uploaded images */
    .uploaded-images {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px;
    }
    .uploaded-image-item .remove-btn {
        width: 20px; height: 20px;
        font-size: 0.7rem;
    }
    .uploaded-image-item .image-number {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
    .uploaded-image-item .edit-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    /* Buttons */
    .btn { padding: 10px 18px; font-size: 0.9rem; }
    .btn-primary {
        padding: 12px;
        font-size: 0.95rem;
    }
    .cost-badge {
        padding: 2px 6px;
        font-size: 0.7rem;
    }

    /* Story prompt section */
    .story-prompt-section { padding: 12px; }
    .story-prompt-section textarea { font-size: 0.85rem; }

    /* Generated plan scenes */
    .plan-scene { padding: 12px; padding-top: 20px; }
    .plan-scene-number { font-size: 0.75rem; padding: 3px 10px; }
    .plan-scene label { font-size: 0.75rem; }
    .plan-scene input, .plan-scene textarea { font-size: 0.85rem; }

    /* Preview */
    .preview-panel { position: relative; top: 0; }
    .video-preview {
        max-height: 350px;
        border-radius: 12px;
    }
    .video-placeholder span { font-size: 3rem; }

    /* Progress */
    .progress-text { font-size: 0.8rem; }

    /* Scene timeline */
    .scene-timeline-item { padding: 8px 0; gap: 10px; }
    .scene-number { width: 24px; height: 24px; font-size: 0.7rem; }
    .scene-title { font-size: 0.9rem; }
    .scene-steps { gap: 4px; }
    .scene-step { font-size: 0.65rem; padding: 2px 5px; }
    .scene-duration { font-size: 0.75rem; }

    /* Download section */
    .download-section .btn-download {
        padding: 12px 24px;
        font-size: 1rem;
    }

    /* Modals */
    .auth-content, .message-content {
        padding: 20px;
        width: 95%;
    }
    .auth-content h2 { font-size: 1.5rem; }
    .auth-tab { padding: 10px; font-size: 0.9rem; }

    .dashboard-content { padding: 15px; }
    .dashboard-header h2 { font-size: 1.2rem; }
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .stat-card { padding: 10px 5px; }
    .stat-card .stat-value { font-size: 1.2rem; }
    .stat-card .stat-label { font-size: 0.65rem; }

    /* Crop preview modal */
    .crop-preview-content { padding: 15px; width: 98%; }
    .crop-container { gap: 15px; }
    .crop-editor img { max-width: 280px; max-height: 280px; }
    .crop-result-container { width: 100px; height: 178px; }

    /* My Reels Grid */
    .my-reels-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    .reel-info { padding: 10px; }
    .reel-title { font-size: 0.85rem; }
    .reel-meta { font-size: 0.7rem; gap: 8px; margin-bottom: 10px; }
    .reel-actions { gap: 6px; }
    .reel-actions button {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    .reel-status {
        padding: 3px 8px;
        font-size: 0.65rem;
    }

    /* Video modal */
    .video-modal-content { width: 95%; }
    .video-modal-close { top: -35px; font-size: 1.5rem; }

    /* User dropdown */
    .user-dropdown { min-width: 180px; }
    .user-dropdown-item { padding: 8px 12px; font-size: 0.9rem; }

    /* Credits dropdown */
    .credits-dropdown { min-width: 160px; padding: 10px; }
    .credits-pack { padding: 6px 10px; }
    .credits-pack .pack-credits { font-size: 0.85rem; }
    .credits-pack .pack-price { font-size: 0.85rem; }
}

/* Very small phones (iPhone SE, etc.) */
@media (max-width: 360px) {
    .container { padding: 8px; }
    header { padding: 50px 0 15px; }

    .header-nav a { padding: 4px 8px; font-size: 0.65rem; }
    .logo { font-size: 1.4rem; }
    .tagline { font-size: 0.8rem; }

    .tabs { gap: 4px; }
    .tab { padding: 7px 10px; font-size: 0.8rem; }

    .card { padding: 12px; }
    .card-title { font-size: 1rem; }

    .mode-option { padding: 10px 12px; }
    .mode-option .mode-icon { font-size: 1.5rem; }

    input, textarea, select { padding: 9px 10px; font-size: 0.9rem; }

    .btn-primary { padding: 11px; font-size: 0.9rem; }

    .uploaded-images { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); }

    .my-reels-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

    .stat-card .stat-value { font-size: 1rem; }
    .stat-card .stat-label { font-size: 0.6rem; }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .tab, .mode-option, .voice-option, .btn,
    .reel-actions button, .credits-pack, .user-dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mode-option {
        justify-content: flex-start;
    }

    .uploaded-image-item .remove-btn {
        min-width: 28px;
        min-height: 28px;
    }

    .uploaded-image-item .edit-btn {
        min-height: 32px;
    }
}
