/* ============================================================================
   AI Photoshoot Mini App - Redesigned Styles
   ============================================================================ */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1a1a1a;
    --bg-hover: #242424;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #f5c542;
    --accent-hover: #d4a832;
    --accent-light: rgba(245, 197, 66, 0.1);
    --danger: #ff4757;
    --success: #2ed573;
    --border: #2a2a2a;
    --border-light: #333333;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ============================================================================
   Header with Search
   ============================================================================ */

.app-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.search-container {
    flex: 1;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

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

.user-mini-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.user-mini-profile:hover {
    background: var(--bg-hover);
}

.mini-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    overflow: hidden;
}

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

.mini-name {
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================================
   Main Content
   ============================================================================ */

.main-content {
    padding: 16px;
    padding-bottom: 100px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.section-subtitle {
    font-size: 1rem;
    font-weight: 600;
    margin: 24px 0 12px;
}

/* ============================================================================
   Create Section
   ============================================================================ */

.create-section {
    margin-bottom: 32px;
}

.create-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.create-cards::-webkit-scrollbar {
    display: none;
}

.create-card {
    flex: 0 0 auto;
    width: 100px;
    padding: 16px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.create-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.create-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.create-card.disabled:hover {
    transform: none;
    border-color: var(--border);
}

.create-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 8px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.photo-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.video-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.vision-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.create-label {
    font-size: 0.8rem;
    color: var(--text-primary);
    display: block;
}

.coming-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 6px;
    background: var(--accent);
    color: var(--bg-primary);
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

/* ============================================================================
   Feed Section & Filters
   ============================================================================ */

.feed-section {
    margin-bottom: 20px;
}

/* Filters as Dropdowns */
.filters-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0a0' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

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

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

.filter-select option:disabled {
    color: var(--text-muted);
}

/* ============================================================================
   Posts Grid
   ============================================================================ */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.posts-grid.small {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.post-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    transition: transform 0.2s;
}

.post-card:hover {
    transform: scale(1.02);
}

.post-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
}

.posts-grid.small .post-card img {
    aspect-ratio: 1;
}

/* Repeat Button on Post Card */
.repeat-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}

.repeat-btn:hover {
    background: var(--accent);
    transform: scale(1.1);
}

.repeat-btn svg {
    width: 20px;
    height: 20px;
}

.post-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    padding-right: 56px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.post-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.post-model {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
}

.post-likes {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
}

.post-likes i {
    color: var(--danger);
}

/* Card Action Buttons */
.card-btn {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1rem;
    position: absolute;
    z-index: 5;
}

.card-btn:hover {
    transform: scale(1.1);
}

/* Like button - top right with count */
.card-btn.like-btn {
    top: 10px;
    right: 10px;
    width: auto;
    min-width: 36px;
    height: 32px;
    padding: 0 10px;
    border-radius: 16px;
    gap: 4px;
    font-size: 0.8rem;
}

.card-btn.like-btn i {
    font-size: 0.9rem;
}

.card-btn.like-btn:hover,
.card-btn.like-btn.liked {
    background: var(--danger);
}

.card-btn.like-btn.liked i {
    color: white;
}

/* Price badge - above repeat button */
.card-price-badge {
    position: absolute;
    bottom: 52px;
    right: 10px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    z-index: 5;
}

/* Repeat button - bottom right */
.card-btn.repeat-btn {
    bottom: 10px;
    right: 10px;
}

.card-btn.repeat-btn:hover {
    background: var(--accent);
}

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

/* ============================================================================
   Reference Photos Section (Profile)
   ============================================================================ */

.reference-section {
    margin: 24px 0;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

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

.section-header .section-subtitle {
    margin: 0;
}

.photos-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.section-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.reference-photos {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.add-reference-btn {
    width: 80px;
    height: 80px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.add-reference-btn i {
    font-size: 1.5rem;
}

.add-reference-btn span {
    font-size: 0.7rem;
}

.add-reference-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.add-reference-btn.hidden {
    display: none;
}

.reference-photo {
    position: relative;
    width: 80px;
    height: 80px;
}

.reference-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
}

.reference-photo.selected img {
    border-color: var(--accent);
}

.reference-photo .delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--danger);
    border: 2px solid var(--bg-secondary);
    border-radius: 50%;
    color: white;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.reference-photo:hover .delete-btn {
    opacity: 1;
}

/* ============================================================================
   Bottom Navigation
   ============================================================================ */

.nav-tabs {
    display: flex;
    justify-content: space-around;
    padding: 8px 16px;
    background: var(--bg-secondary);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-top: 1px solid var(--border);
    max-width: 480px;
    margin: 0 auto;
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: var(--radius-md);
}

.nav-tab i {
    font-size: 1.3rem;
}

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

.nav-tab:hover {
    background: var(--bg-hover);
}

/* ============================================================================
   Tab Content
   ============================================================================ */

.tab-content {
    padding: 16px;
    padding-bottom: 100px;
}

.tab-content.hidden {
    display: none;
}

/* ============================================================================
   Profile Section
   ============================================================================ */

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-secondary);
    overflow: hidden;
}

.avatar.small {
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

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

.profile-info h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.username {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.profile-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

/* ============================================================================
   Modal Base
   ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background: var(--bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* ============================================================================
   Form Elements
   ============================================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group .optional {
    color: var(--text-muted);
    font-weight: 400;
}

.form-group .hint {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    resize: none;
    font-family: inherit;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea[readonly] {
    background: var(--bg-card);
    color: var(--text-secondary);
}

/* Model Cards */
.model-cards {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.model-cards::-webkit-scrollbar {
    display: none;
}

.model-card {
    flex: 0 0 auto;
    min-width: 100px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.model-card:hover {
    border-color: var(--text-muted);
}

.model-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.model-card .model-name {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
}

.model-card .model-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
}

/* Photo Selector */
.photo-selector {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.photo-selector::-webkit-scrollbar {
    display: none;
}

.add-photo-btn {
    width: 64px;
    height: 64px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.add-photo-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.saved-photo {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.saved-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s;
}

.saved-photo.selected img {
    border-color: var(--accent);
}

.saved-photo .remove-photo {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.7rem;
    cursor: pointer;
    display: none;
}

.saved-photo:hover .remove-photo {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Aspect Ratio Selector */
.aspect-ratio-selector {
    display: flex;
    gap: 8px;
}

.aspect-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.aspect-btn:hover {
    background: var(--bg-hover);
}

.aspect-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    font-weight: 600;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-primary .price {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.btn-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-follow {
    padding: 8px 16px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-follow.following {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-copy {
    margin-top: 8px;
    width: auto;
}

/* ============================================================================
   Vision Modal Specific
   ============================================================================ */

.description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.upload-area i {
    font-size: 2.5rem;
    color: var(--text-muted);
}

.upload-area span {
    color: var(--text-secondary);
}

.vision-preview {
    position: relative;
    margin-bottom: 20px;
}

.vision-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.vision-preview .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
}

.vision-result {
    margin-top: 20px;
}

.vision-result label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

/* ============================================================================
   Post Modal Specific
   ============================================================================ */

.modal-post .modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
}

.modal-image {
    width: 100%;
    max-height: 50vh;
    overflow: hidden;
}

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

.modal-info {
    padding: 20px;
}

.modal-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.author-info {
    flex: 1;
}

.author-name {
    display: block;
    font-weight: 600;
}

.author-username {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-prompt {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 8px;
}

.modal-model {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.modal-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.stat-btn:hover {
    background: var(--bg-hover);
}

.stat-btn.liked, .stat-btn.liked i {
    color: var(--danger);
}

.stat-btn.saved, .stat-btn.saved i {
    color: var(--accent);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.repeat-icon {
    width: 20px;
    height: 20px;
}

/* ============================================================================
   Repeat Modal Specific
   ============================================================================ */

.original-preview {
    position: relative;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.original-preview img {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
}

.original-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.original-model {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.original-author {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================================================
   Toast
   ============================================================================ */

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    z-index: 2000;
    animation: toastIn 0.3s ease;
}

.toast.hidden {
    display: none;
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================================
   Loading
   ============================================================================ */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.spin {
    animation: spin 1s linear infinite;
}

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

.load-more {
    text-align: center;
    padding: 20px;
}

.load-more.hidden {
    display: none;
}

.load-more button {
    padding: 12px 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
}

/* ============================================================================
   Utilities
   ============================================================================ */

.hidden {
    display: none !important;
}

/* ============================================================================
   Header Balance
   ============================================================================ */

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

.balance-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius-xl);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.balance-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

/* ============================================================================
   Profile Balance
   ============================================================================ */

.profile-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 16px 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.balance-display {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.balance-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.balance-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
}

.btn-topup {
    padding: 8px 14px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ============================================================================
   Payment Modal
   ============================================================================ */

.modal-payment .modal-body {
    padding: 20px;
}

.balance-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.balance-info .balance-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.balance-info .balance-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

.payment-packages {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.package-card {
    position: relative;
    padding: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.package-card:hover {
    border-color: var(--text-muted);
}

.package-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.package-amount {
    font-size: 1.3rem;
    font-weight: 700;
}

.package-bonus {
    font-size: 0.8rem;
    color: var(--success);
    margin-top: 4px;
    min-height: 16px;
}

.package-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    padding: 4px 8px;
    background: var(--accent);
    color: var(--bg-primary);
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.btn-pay {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.payment-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 12px;
}

/* ============================================================================
   Video Modal
   ============================================================================ */

.video-mode-selector {
    display: flex;
    gap: 8px;
}

.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn i {
    font-size: 1.5rem;
}

.mode-btn span {
    font-size: 0.85rem;
}

.mode-btn:hover {
    border-color: var(--text-muted);
}

.mode-btn.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--text-primary);
}

.video-source-preview {
    position: relative;
    margin-top: 12px;
}

.video-source-preview img {
    width: 100%;
    max-height: 150px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.video-source-preview .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
}

/* ============================================================================
   User Generations
   ============================================================================ */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0 12px;
}

.section-badge {
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.generation-card {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
}

.generation-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.generation-card .gen-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.generation-card .gen-model {
    font-size: 0.7rem;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
}

.generation-card.pending,
.generation-card.processing {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gen-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.gen-loading i {
    font-size: 1.5rem;
    color: var(--accent);
}

.generation-card.failed {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gen-failed {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--danger);
    font-size: 0.8rem;
}

.gen-failed i {
    font-size: 1.5rem;
}

/* Share button on cards */
.share-btn {
    right: 50px !important;
}
