﻿/* ============================================
   AI Image Studio - Stylesheet
   ============================================ */

:root {
    --bg: #0a0f1a;
    --surface: #111827;
    --surface-hover: #1f2937;
    --surface-active: #374151;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: rgba(59, 130, 246, 0.1);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --yandex-red: #fc3f1d;
    --yandex-red-hover: #e63917;
    --gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

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

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo i {
    font-size: 1.75rem;
    -webkit-text-fill-color: #3b82f6;
}

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

.nav-tabs {
    display: flex;
    gap: 12px;
    background: var(--surface);
    padding: 6px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.nav-tab {
    padding: 14px 32px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.nav-tab.active {
    background: var(--gradient);
    color: white;
    box-shadow: 0 8px 20px -5px rgba(59, 130, 246, 0.4);
}

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

/* ============================================
   User Actions
   ============================================ */

.user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.btn-icon:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.btn-login {
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-login:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* ============================================
   User Profile (Authorized)
   ============================================ */

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   Credits Badge
   ============================================ */

.credits-badge {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    color: #60a5fa;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.credits-badge:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.credits-badge i {
    color: #fbbf24;
    font-size: 0.9rem;
}

/* Premium Button (Crown) */
.btn-premium {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.1));
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    position: relative;
    overflow: hidden;
}

.btn-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-premium:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(251, 191, 36, 0.2));
    border-color: rgba(245, 158, 11, 0.6);
    color: #fbbf24;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -5px rgba(245, 158, 11, 0.3);
}

.btn-premium:hover::before {
    left: 100%;
}

.btn-premium i {
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.6));
}

/* ============================================
   Auth Modal
   ============================================ */

.auth-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-modal.active {
    display: flex;
}

.auth-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.9);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.auth-modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    margin: 20px;
    box-shadow: var(--shadow);
    animation: slideUp 0.3s ease;
    z-index: 1;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.auth-modal-close:hover {
    background: var(--surface-active);
    color: var(--text-primary);
}

.auth-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-modal-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

/* ============================================
   Auth Providers
   ============================================ */

.auth-providers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-provider {
    width: 100%;
    padding: 16px 24px;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
}

.auth-provider i {
    font-size: 1.4rem;
}

/* Yandex Provider - Brand Colors */
.auth-provider.yandex {
    background: var(--yandex-red);
    color: white;
    box-shadow: 0 4px 20px -5px rgba(252, 63, 29, 0.4);
}

.auth-provider.yandex:hover {
    background: var(--yandex-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -5px rgba(252, 63, 29, 0.5);
}

.auth-provider.yandex:active {
    transform: translateY(0);
}

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

.payment-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.payment-modal.active {
    opacity: 1;
    visibility: visible;
}

.payment-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(10px);
}

.payment-modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 1100px;
    margin: 20px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s ease;
}

.payment-modal.active .payment-modal-content {
    transform: scale(1) translateY(0);
}

.payment-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    z-index: 10;
}

.payment-modal-close:hover {
    background: var(--surface-active);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Payment Header */
.payment-header {
    text-align: center;
    margin-bottom: 32px;
}

.payment-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.payment-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Payment Status Banner */
.payment-status-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.payment-status-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.payment-status-info i {
    font-size: 2rem;
    color: var(--success);
}

.payment-status-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.payment-status-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payment-status-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.payment-status-value.unlimited {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Payment Cards Grid */
.payment-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.payment-card {
    background: var(--surface-hover);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 24px 16px;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.payment-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 20px 40px -10px rgba(59, 130, 246, 0.3);
}

.payment-card.featured {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(251, 191, 36, 0.05));
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 40px -10px rgba(245, 158, 11, 0.2);
}

.payment-card.featured:hover {
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 0 20px 40px -10px rgba(245, 158, 11, 0.3);
}

.payment-card.test {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.05));
    border-color: rgba(16, 185, 129, 0.3);
}

.payment-card.test:hover {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 20px 40px -10px rgba(16, 185, 129, 0.3);
}

.payment-card.starter {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.05));
    border-color: rgba(139, 92, 246, 0.3);
}

.payment-card.starter:hover {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 20px 40px -10px rgba(139, 92, 246, 0.3);
}

/* Badges */
.payment-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.3);
}

.payment-badge.popular {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #000;
}

.payment-badge.test {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: #000;
}

.payment-badge.starter {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    color: #fff;
}

/* Card Header */
.payment-card-header {
    text-align: center;
    margin-bottom: 20px;
}

.payment-card-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.payment-card-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.payment-card-price .price {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
}

.payment-card.test .price {
    background: linear-gradient(135deg, #10b981, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.payment-card.starter .price {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.payment-card.featured .price {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.payment-card:not(.test):not(.starter):not(.featured) .price {
    color: var(--text-primary);
}

.payment-card-price .currency {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.payment-card-price .period {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Credits Display */
.payment-credits {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin-bottom: 20px;
}

.payment-credits-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.payment-card.test .payment-credits-value {
    color: #10b981;
}

.payment-card.starter .payment-credits-value {
    color: #8b5cf6;
}

.payment-card.featured .payment-credits-value {
    color: #fbbf24;
}

.payment-credits-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Features */
.payment-features {
    flex: 1;
    margin-bottom: 20px;
}

.payment-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.payment-feature:last-child {
    border-bottom: none;
}

.payment-feature i {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.payment-feature i.fa-check {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.payment-feature i.fa-times {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

.payment-feature i.fa-infinity {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* Payment Button */
.payment-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 2px solid transparent;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

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

.payment-btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 20px -5px rgba(59, 130, 246, 0.4);
}

.payment-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -5px rgba(59, 130, 246, 0.6);
}

.payment-btn-test {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: #000;
    box-shadow: 0 4px 20px -5px rgba(16, 185, 129, 0.4);
}

.payment-btn-test:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -5px rgba(16, 185, 129, 0.6);
}

.payment-btn-starter {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    color: #fff;
    box-shadow: 0 4px 20px -5px rgba(139, 92, 246, 0.4);
}

.payment-btn-starter:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -5px rgba(139, 92, 246, 0.6);
}

.payment-btn-pro {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #000;
    box-shadow: 0 4px 20px -5px rgba(245, 158, 11, 0.4);
}

.payment-btn-pro:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -5px rgba(245, 158, 11, 0.6);
}

.payment-btn-current {
    background: transparent;
    border-color: var(--success);
    color: var(--success);
    cursor: default;
}

/* Payment Processing */
.payment-processing {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 26, 0.98);
    backdrop-filter: blur(20px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.payment-processing.active {
    display: flex;
}

.payment-processing-spinner {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

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

.payment-processing-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.payment-processing-subtext {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Payment Info Footer */
.payment-info {
    text-align: center;
    padding: 20px;
    background: var(--surface-hover);
    border-radius: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    border: 1px dashed var(--border);
}

.payment-info-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.payment-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.payment-info i {
    color: var(--accent);
}

/* Low Credits Warning */
.low-credits-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(245, 158, 11, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: pulseWarning 2s infinite;
}

@keyframes pulseWarning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.2); }
}

.low-credits-banner i {
    font-size: 2rem;
    color: #ef4444;
}

.low-credits-text {
    flex: 1;
}

.low-credits-title {
    font-weight: 700;
    color: #fca5a5;
    margin-bottom: 4px;
}

.low-credits-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

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

.main {
    padding-top: 90px;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 40px;
}

/* ============================================
   Mode Sections
   ============================================ */

.mode-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.mode-section.active {
    display: block;
}

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

/* ============================================
   Generate Mode Layout
   ============================================ */

.generate-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 30px;
    align-items: start;
}

.panel {
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.panel-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-body {
    padding: 24px;
}

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

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

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prompt-input {
    width: 100%;
    min-height: 140px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s;
    font-family: inherit;
}

.prompt-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

/* ============================================
   Aspect Ratio Grid
   ============================================ */

.aspect-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.aspect-btn {
    position: relative;
    padding: 16px 12px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.aspect-btn:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

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

.aspect-icon {
    width: 28px;
    height: 28px;
    border: 2px solid currentColor;
    border-radius: 4px;
    opacity: 0.6;
}

.aspect-btn.active .aspect-icon {
    opacity: 1;
    color: var(--accent);
}

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

.aspect-btn.active .aspect-label {
    color: var(--accent);
}

.aspect-res {
    font-size: 0.7rem;
    color: var(--text-muted);
}

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

.btn-primary {
    width: 100%;
    padding: 16px 24px;
    border-radius: 12px;
    border: none;
    background: var(--gradient);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -10px rgba(59, 130, 246, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    background: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary.loading {
    color: transparent;
    pointer-events: none;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-secondary {
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: none;
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

/* ============================================
   Result Areas
   ============================================ */

.result-area {
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 20px;
    border: 2px dashed var(--border);
    position: relative;
    overflow: hidden;
}

.result-area.has-image {
    border-style: solid;
    border-color: var(--border);
}

.result-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 60px;
}

.result-placeholder i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.result-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.result-actions {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.result-area.has-image:hover .result-actions,
.result-area.has-image .result-actions {
    opacity: 1;
    pointer-events: all;
}

/* ============================================
   Edit Mode
   ============================================ */

.edit-layout-simple {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 30px;
    align-items: start;
}

.edit-panel {
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.edit-panel-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.edit-panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-panel-body {
    padding: 24px;
}

.upload-area-simple {
    padding: 40px 24px;
    text-align: center;
    border: 2px dashed var(--border);
    border-radius: 16px;
    margin-bottom: 24px;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
}

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

.upload-area-simple.has-file {
    border-style: solid;
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.upload-area-simple i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.edit-preview-container {
    width: 100%;
    margin-bottom: 24px;
    display: none;
}

.edit-preview-container.active {
    display: block;
}

.edit-preview-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 12px;
    border: 2px solid var(--border);
}

.edit-preview-label {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ============================================
   Strength Slider
   ============================================ */

.strength-slider {
    width: 100%;
    margin-top: 8px;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-hover);
    outline: none;
}

.strength-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.strength-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.strength-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   Edit Result Area
   ============================================ */

.edit-result-area {
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 20px;
    border: 2px dashed var(--border);
    position: relative;
    overflow: hidden;
}

.edit-result-area.has-image {
    border-style: solid;
    border-color: var(--border);
}

.edit-result-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.edit-result-actions {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.edit-result-area.has-image:hover .edit-result-actions,
.edit-result-area.has-image .edit-result-actions {
    opacity: 1;
    pointer-events: all;
}

/* ============================================
   Generation Modal
   ============================================ */

.generation-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 26, 0.98);
    backdrop-filter: blur(20px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: modalFadeIn 0.5s ease;
}

.generation-modal.active {
    display: flex;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.generation-content {
    text-align: center;
    padding: 40px;
    max-width: 500px;
}

/* Magic Orb Animation */

.magic-orb {
    width: 120px;
    height: 120px;
    margin: 0 auto 40px;
    position: relative;
}

.orb-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--gradient);
    position: relative;
    animation: orbPulse 3s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(59, 130, 246, 0.5), 0 0 100px rgba(139, 92, 246, 0.3);
}

.orb-core::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: var(--gradient);
    opacity: 0.3;
    animation: orbRipple 3s ease-in-out infinite;
}

.orb-core::after {
    content: '';
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0.2;
    animation: orbRotate 8s linear infinite;
}

@keyframes orbPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes orbRipple {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 0; }
}

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

/* Particles */

.particles {
    position: absolute;
    inset: -50px;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    animation: particleFloat 4s ease-in-out infinite;
}

.particle:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { top: 80%; left: 20%; animation-delay: 0.5s; }
.particle:nth-child(3) { top: 30%; right: 15%; animation-delay: 1s; }
.particle:nth-child(4) { top: 70%; right: 25%; animation-delay: 1.5s; }
.particle:nth-child(5) { top: 50%; left: 5%; animation-delay: 2s; }
.particle:nth-child(6) { top: 10%; right: 30%; animation-delay: 2.5s; }

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
    50% { transform: translateY(-20px) scale(1.5); opacity: 1; }
}

.generation-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 16px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.generation-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 20px;
    animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(245, 158, 11, 0.2); }
}

.generation-time {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.generation-time strong {
    color: var(--text-primary);
}

/* ============================================
   Keep Alive Indicator
   ============================================ */

.keep-alive-indicator {
    position: fixed;
    top: 80px;
    right: 30px;
    background: rgba(245, 158, 11, 0.9);
    color: #000;
    border-radius: 8px;
    padding: 8px 14px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 999;
    animation: slideDown 0.3s ease;
}

.keep-alive-indicator.active {
    display: flex;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.toast-container {
    position: fixed;
    top: 90px;
    right: 30px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    padding: 16px 24px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    max-width: 400px;
    pointer-events: all;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent); }
.toast.warning { border-left: 4px solid var(--warning); }

/* ============================================
   Responsive - Tablet
   ============================================ */

@media (max-width: 1024px) {
    .payment-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .generate-layout,
    .edit-layout-simple {
        grid-template-columns: 1fr;
    }
    
    .result-area,
    .edit-result-area {
        min-height: 400px;
    }

    .nav-tabs {
        gap: 8px;
        padding: 4px;
    }

    .nav-tab {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

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

/* ============================================
   Responsive - Mobile
   ============================================ */

@media (max-width: 600px) {
    .header {
        padding: 0 12px;
        height: 65px;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .logo span {
        display: none;
    }

    .logo i {
        font-size: 1.5rem;
    }
    
    .container {
        padding: 16px;
    }
    
    /* Mobile Navigation - Compact */
    .nav-tabs {
        gap: 4px;
        padding: 4px;
        border-radius: 12px;
        max-width: calc(100vw - 120px);
    }
    
    .nav-tab {
        padding: 10px 14px;
        font-size: 0.8rem;
        font-weight: 600;
        border-radius: 10px;
        flex-direction: row;
        gap: 6px;
        min-width: auto;
        white-space: nowrap;
    }

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

    .nav-tab span {
        display: inline;
        font-size: 0.8rem;
    }
    
    /* Hide login text on mobile */
    .btn-login span {
        display: none;
    }
    
    .btn-login {
        padding: 10px;
    }
    
    .panel-body,
    .edit-panel-body {
        padding: 16px;
    }
    
    .aspect-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .result-actions,
    .edit-result-actions {
        opacity: 1 !important;
        pointer-events: all !important;
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin-top: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .result-area.has-image,
    .edit-result-area.has-image {
        padding-bottom: 20px;
    }

    .keep-alive-indicator {
        top: 70px;
        right: 10px;
        left: 10px;
        justify-content: center;
    }

    /* Mobile Modal */
    .generation-content {
        padding: 20px;
    }

    .magic-orb {
        width: 100px;
        height: 100px;
    }

    .generation-title {
        font-size: 1.4rem;
    }

    .generation-warning {
        font-size: 0.9rem;
        padding: 10px 16px;
    }

    .generation-time {
        font-size: 0.85rem;
    }

    .btn-icon {
        width: 40px;
        height: 40px;
    }

    /* Mobile Auth Modal */
    .auth-modal-content {
        padding: 30px 20px;
        margin: 16px;
    }

    .auth-modal-title {
        font-size: 1.3rem;
    }

    .auth-modal-subtitle {
        font-size: 0.9rem;
    }

    .auth-provider {
        padding: 14px 20px;
    }

    /* Mobile User Profile */
    .user-profile {
        padding: 4px 8px 4px 4px;
    }

    .user-name {
        max-width: 80px;
        font-size: 0.8rem;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    /* Mobile Payment Modal */
    .payment-modal-content {
        padding: 24px 16px;
        margin: 10px;
    }
    
    .payment-cards {
        grid-template-columns: 1fr;
    }
    
    .payment-title {
        font-size: 1.5rem;
    }
    
    .payment-status-banner {
        flex-direction: column;
        text-align: center;
    }
    
    .payment-card-price .price {
        font-size: 1.8rem;
    }

    .credits-badge {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .credits-badge span {
        display: none;
    }

    .btn-premium {
        width: 40px;
        height: 40px;
        padding: 0;
    }
    
    .btn-premium i {
        margin: 0;
    }
}

/* ============================================
   GALLERY MODAL
   ============================================ */

.gallery-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.gallery-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.gallery-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(10px);
}

.gallery-modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    margin: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.gallery-modal.active .gallery-modal-content {
    transform: scale(1);
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-hover);
    flex-shrink: 0;
}

.gallery-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.gallery-title i {
    color: var(--accent);
}

.gallery-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.gallery-close:hover {
    background: var(--surface-active);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.gallery-stats {
    display: flex;
    gap: 32px;
    padding: 20px 32px;
    background: var(--surface-hover);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.gallery-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.gallery-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === ОСНОВНОЙ ФИКС: Грид галереи === */
.gallery-grid {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: grid;
    /* Автозаполнение с минимальной шириной 200px, максимум 1fr */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    /* Важно: выравнивание по началу, но без ломки высоты */
    align-items: start;
    /* Автоматические строки по контенту */
    grid-auto-rows: min-content;
}

.gallery-item {
    position: relative;
    /* Фикс: соотношение сторон 1:1 для квадратных фото */
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    /* Фикс: явная высота строки */
    height: fit-content;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.4);
    border-color: var(--accent);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Оверлей с кнопками - всегда наверху */
.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
    z-index: 5;
    pointer-events: none; /* Фикс: клики проходят через невидимый оверлей */
}

.gallery-item:hover .gallery-item-overlay,
.gallery-item:active .gallery-item-overlay {
    opacity: 1;
    pointer-events: all; /* Включаем клики при наведении */
}

.gallery-item-type {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--accent);
    color: white;
    z-index: 10;
    pointer-events: none;
}

.gallery-item-type.edit {
    background: var(--warning);
}

.gallery-item-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.gallery-item-actions {
    display: flex;
    gap: 8px;
}

.gallery-item-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    backdrop-filter: blur(4px);
    pointer-events: all; /* Фикс: кнопки кликабельны */
}

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

.gallery-item-btn.delete:hover {
    background: var(--danger);
}

.gallery-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 60px;
}

.gallery-empty i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.gallery-empty p {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.gallery-empty span {
    font-size: 0.9rem;
}



/* ============================================
   PROFILE MODAL
   ============================================ */

.profile-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.profile-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.profile-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(10px);
}

.profile-modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    margin: 20px;
    padding: 32px;
    box-shadow: var(--shadow);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.profile-modal.active .profile-modal-content {
    transform: scale(1);
}

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

.profile-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.profile-title i {
    color: var(--accent);
}

.profile-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.profile-close:hover {
    background: var(--surface-active);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.profile-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface-hover);
    border-radius: 16px;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-provider {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-credits-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.profile-credits-card,
.profile-plan-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface-hover);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.profile-credits-icon,
.profile-plan-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
}

.profile-plan-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.profile-credits-info,
.profile-plan-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-credits-label,
.profile-plan-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-credits-value,
.profile-plan-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-credits-value.unlimited,
.profile-plan-value.pro {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.profile-btn {
    width: 100%;
    padding: 16px 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-hover);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.profile-btn:hover {
    background: var(--surface-active);
    transform: translateY(-2px);
}

.profile-btn-primary {
    background: var(--gradient);
    border-color: transparent;
    color: white;
}

.profile-btn-primary:hover {
    box-shadow: 0 8px 20px -5px rgba(59, 130, 246, 0.4);
}

.profile-btn-danger {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.profile-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

/* ============================================
   MENU MODAL (MOBILE)
   ============================================ */

.menu-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.menu-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.menu-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.8);
    backdrop-filter: blur(5px);
}

.menu-modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-height: 70vh;
    padding: 24px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.menu-modal.active .menu-modal-content {
    transform: translateY(0);
}

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

.menu-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.menu-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    width: 100%;
    padding: 16px 20px;
    border-radius: 12px;
    border: none;
    background: var(--surface-hover);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
}

.menu-item:hover {
    background: var(--surface-active);
}

.menu-item i {
    width: 24px;
    text-align: center;
    color: var(--accent);
    font-size: 1.1rem;
}

/* ============================================
   DESKTOP/MOBILE VISIBILITY
   ============================================ */

.desktop-only {
    display: flex;
}

/* ============================================
   RESPONSIVE - MOBILE HEADER FIX
   ============================================ */

@media (max-width: 600px) {
    .header {
        padding: 0 12px;
        height: 75px; /* Увеличена высота шапки */
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .logo {
        font-size: 1.1rem;
        order: 1;
    }
    
    .logo span {
        display: none;
    }

    .logo i {
        font-size: 1.4rem;
    }
    
    /* Навигация в центре */
    .nav-tabs {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 8px;
        padding: 4px;
        border-radius: 12px;
        margin-top: 4px;
    }
    
    .nav-tab {
        flex: 1;
        padding: 10px 16px;
        font-size: 0.85rem;
        border-radius: 10px;
        justify-content: center;
    }

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

    .nav-tab span {
        font-size: 0.85rem;
    }
    
    /* Правая часть шапки */
    .user-actions {
        order: 2;
        gap: 8px;
    }
    
    /* Скрываем десктоп элементы */
    .desktop-only {
        display: none !important;
    }
    
    /* Кнопка меню всегда видна */
    #settingsBtn {
        display: flex !important;
    }
    
    /* Контейнер сдвигается ниже из-за высокой шапки */
    .main {
        padding-top: 100px;
    }
    
    .container {
        padding: 12px;
    }
    
    /* Галерея на весь экран на мобильном */
    .gallery-modal-content {
        margin: 0;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 16px;
    }
    
    .gallery-header,
    .gallery-stats {
        padding: 16px 20px;
    }
    
    .gallery-stats {
        gap: 20px;
        justify-content: center;
    }
    
    .gallery-stat {
        text-align: center;
    }
    
    .gallery-stat-value {
        font-size: 1.2rem;
    }
    
    .gallery-stat-label {
        font-size: 0.7rem;
    }
    
    /* Профиль на мобильном */
    .profile-modal-content {
        margin: 0;
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .profile-actions {
        margin-top: auto;
    }
    
    /* Compact Aspect Ratio Buttons for Mobile */
    .aspect-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .aspect-btn {
        padding: 8px 4px;
        gap: 4px;
        border-radius: 8px;
    }
    
    .aspect-icon {
        width: 18px;
        height: 18px;
        border-width: 1.5px;
    }
    
    .aspect-label {
        font-size: 0.7rem;
    }
    
    .aspect-res {
        font-size: 0.6rem;
    }
    
     /* Compact Aspect Ratio Buttons for Mobile */
    .aspect-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .aspect-btn {
        padding: 8px 4px;
        gap: 4px;
        border-radius: 8px;
    }
    
    .aspect-icon {
        width: 18px;
        height: 18px;
        border-width: 1.5px;
    }
    
    .aspect-label {
        font-size: 0.7rem;
    }
    
    .aspect-res {
        font-size: 0.6rem;
    }
    
    /* Gallery Mobile Fix - крестик всегда виден */
    .gallery-modal-content {
        margin: 0;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        padding-top: 20px;
    }
    
    .gallery-header {
        padding: 16px 20px;
        padding-top: 40px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--surface-hover);
    }
    
    .gallery-close {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
        background: var(--surface-active);
        border: 2px solid var(--border-strong);
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    
    .gallery-grid {
        padding-top: 20px;
    }
    
    @media (max-width: 600px) {
    /* ============================================
       GALLERY MOBILE - ПОЛНЫЙ РЕМОНТ
       ============================================ */
    
    .gallery-modal {
        align-items: flex-start; /* Не центрируем */
    }
    
    .gallery-modal-content {
        margin: 0;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    /* Шапка - фиксированная */
    .gallery-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 16px;
        background: var(--surface-hover);
        border-bottom: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: space-between;
        z-index: 1000;
        flex-shrink: 0;
    }
    
    .gallery-title {
        font-size: 1.1rem;
        gap: 8px;
    }
    
    .gallery-title i {
        font-size: 1.2rem;
    }
    
    /* КРЕСТИК - огромный и видный */
    .gallery-close {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--surface-active);
        border: 2px solid var(--border-strong);
        color: var(--text-primary);
        font-size: 1.3rem;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 15px rgba(0,0,0,0.4);
        position: relative;
        z-index: 1001;
    }
    
    /* Статистика - под шапкой */
    .gallery-stats {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        padding: 12px 20px;
        background: var(--surface-hover);
        border-bottom: 1px solid var(--border);
        display: flex;
        justify-content: space-around;
        z-index: 999;
        gap: 0;
    }
    
    .gallery-stat {
        text-align: center;
    }
    
    .gallery-stat-value {
        font-size: 1.4rem;
        font-weight: 700;
        color: var(--accent);
    }
    
    .gallery-stat-label {
        font-size: 0.7rem;
        color: var(--text-muted);
        text-transform: uppercase;
    }
    
    /* СЕТКА - главное фикс */
    .gallery-grid {
        flex: 1;
        margin-top: 110px; /* 56px шапка + 54px статистика */
        padding: 16px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        overflow-y: auto;
        height: calc(100vh - 110px);
        align-content: start; /* Важно! */
    }
    
    /* Карточка фото */
    .gallery-item {
        position: relative;
        width: 100%;
        aspect-ratio: 1;
        border-radius: 12px;
        overflow: hidden;
        background: var(--surface-hover);
        border: 1px solid var(--border);
    }
    
    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* Не вылезает */
        display: block; /* Убираем отступы */
    }
    
    /* Бейдж типа */
    .gallery-item-type {
        position: absolute;
        top: 8px;
        left: 8px;
        padding: 4px 10px;
        border-radius: 20px;
        font-size: 0.65rem;
        font-weight: 700;
        text-transform: uppercase;
        background: var(--accent);
        color: white;
        z-index: 10;
    }
    
    .gallery-item-type.edit {
        background: var(--warning);
    }
    
    /* Оверлей с кнопками */
    .gallery-item-overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
        opacity: 0;
        transition: opacity 0.2s;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        padding: 12px;
        z-index: 5;
    }
    
    .gallery-item:active .gallery-item-overlay,
    .gallery-item:hover .gallery-item-overlay {
        opacity: 1;
    }
    
    .gallery-item-date {
        font-size: 0.75rem;
        color: var(--text-secondary);
        margin-bottom: 8px;
    }
    
    /* КНОПКИ СКАЧАТЬ/УДАЛИТЬ */
    .gallery-item-actions {
        display: flex;
        gap: 8px;
    }
    
    .gallery-item-btn {
        flex: 1;
        height: 36px;
        border-radius: 8px;
        border: none;
        background: rgba(255,255,255,0.15);
        color: white;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        backdrop-filter: blur(4px);
    }
    
    .gallery-item-btn:active {
        background: var(--accent);
        transform: scale(0.95);
    }
    
    .gallery-item-btn.delete:active {
        background: var(--danger);
    }
    
    /* Пустое состояние */
    .gallery-empty {
        margin-top: 110px;
        padding: 40px 20px;
    }
    
    /* ============================================
       ASPECT RATIO - компактные кнопки
       ============================================ */
    
    .aspect-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .aspect-btn {
        padding: 10px 4px;
        gap: 4px;
        border-radius: 10px;
        border-width: 1px;
    }
    
    .aspect-icon {
        width: 20px;
        height: 20px;
        border-width: 1.5px;
    }
    
    .aspect-label {
        font-size: 0.75rem;
    }
    
    .aspect-res {
        font-size: 0.6rem;
    }
}
}

/* ============================================
   PROMO CODE MODAL
   ============================================ */

.promo-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.promo-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.promo-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(10px);
}

.promo-modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    margin: 20px;
    padding: 32px;
    box-shadow: var(--shadow);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.promo-modal.active .promo-modal-content {
    transform: scale(1);
}

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

.promo-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.promo-title i {
    color: var(--accent);
}

.promo-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.promo-close:hover {
    background: var(--surface-active);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.promo-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.promo-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
    margin: 0;
}

.promo-input-group {
    display: flex;
    gap: 12px;
}

.promo-input {
    flex: 1;
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.promo-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.promo-input::placeholder {
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: normal;
}

.promo-btn {
    padding: 16px 24px;
    border-radius: 12px;
    border: none;
    background: var(--gradient);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.promo-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -5px rgba(59, 130, 246, 0.4);
}

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

.promo-message {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    display: none;
}

.promo-message.success {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.promo-message.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.promo-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: var(--surface-hover);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border: 1px dashed var(--border);
}

.promo-hint i {
    color: var(--accent);
    font-size: 1.1rem;
}

/* ============================================
   MENU UPDATES (Promo & Support)
   ============================================ */

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

.menu-item-support {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    position: relative;
}

.menu-item-support i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
}

.menu-item-support span {
    margin-left: 36px;
    font-weight: 600;
}

.menu-item-support small {
    margin-left: 36px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.menu-item-support:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent);
}

/* Mobile Promo Modal */
@media (max-width: 600px) {
    .promo-modal-content {
        margin: 16px;
        padding: 24px;
    }
    
    .promo-title {
        font-size: 1.3rem;
    }
    
    .promo-input-group {
        flex-direction: column;
    }
    
    .promo-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   LOGO & BRANDING UPDATES
   ============================================ */

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

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    text-transform: lowercase;
    letter-spacing: 1px;
}

/* ============================================
   TOOLS DROPDOWN BUTTON (Desktop)
   ============================================ */

.btn-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-tools:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-tools .fa-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.btn-tools.active .fa-chevron-down {
    transform: rotate(180deg);
}

/* ============================================
   MOBILE TOOLS BUTTON (Icon only)
   ============================================ */

.btn-tools-mobile {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    align-items: center;
    justify-content: center;
}

.btn-tools-mobile:hover,
.btn-tools-mobile:active {
    background: var(--surface-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* ============================================
   TOOLS DROPDOWN MODAL (Desktop)
   ============================================ */

.tools-dropdown-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tools-dropdown-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.tools-dropdown-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.8);
    backdrop-filter: blur(5px);
}

.tools-dropdown-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    margin: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.tools-dropdown-modal.active .tools-dropdown-content {
    transform: scale(1);
}

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

.tools-dropdown-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tools-dropdown-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.tools-dropdown-close:hover {
    background: var(--surface-active);
    color: var(--text-primary);
    transform: rotate(90deg);
}

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

.tools-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.tools-dropdown-item:hover {
    background: var(--surface-active);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.tools-dropdown-item i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 1rem;
}

/* ============================================
   MOBILE TOOLS MODAL (Dropdown from top)
   ============================================ */

.mobile-tools-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-tools-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.mobile-tools-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.9);
    backdrop-filter: blur(5px);
}

.mobile-tools-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 20px 20px;
    width: 100%;
    max-height: 70vh;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.mobile-tools-modal.active .mobile-tools-content {
    transform: translateY(0);
}

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

.mobile-tools-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-tools-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.mobile-tools-close:hover {
    background: var(--surface-active);
    color: var(--text-primary);
}

.mobile-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.mobile-tools-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    border-radius: 12px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s;
}

.mobile-tools-item:hover {
    background: var(--surface-active);
    border-color: var(--accent);
}

.mobile-tools-item i {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 1.2rem;
}

/* ============================================
   MOBILE HEADER - COMPLETE REDESIGN
   ============================================ */

@media (max-width: 600px) {
    /* Header - single row, logo left */
    .header {
        height: 70px;
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 8px;
    }
    
    /* Logo - left side (order: 0) */
    .logo {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        order: 0;
    }
    
    .logo-img {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }
    
    .logo-text {
        display: flex;
        flex-direction: column;
        line-height: 1.1;
    }
    
    .logo-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--text-primary);
        letter-spacing: -0.3px;
    }
    
    .logo-subtitle {
        font-size: 0.65rem;
        font-weight: 500;
        color: var(--accent);
        text-transform: lowercase;
        letter-spacing: 0.5px;
    }
    
    /* Show mobile tools button */
    .btn-tools-mobile {
        display: flex;
        order: 1;
    }
    
    /* Navigation - center (order: 2) */
    .nav-tabs {
        display: flex;
        gap: 4px;
        padding: 3px;
        border-radius: 10px;
        background: var(--surface);
        border: 1px solid var(--border);
        flex-shrink: 1;
        order: 2;
        margin: 0 8px;
    }
    
    .nav-tab {
        padding: 8px 14px;
        font-size: 0.8rem;
        font-weight: 600;
        border-radius: 8px;
        white-space: nowrap;
    }

    .nav-tab i {
        font-size: 0.9rem;
        margin-right: 6px;
    }
    
    /* User actions - right side (order: 3) */
    .user-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
        order: 3;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Compact icon buttons */
    .btn-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }
    
    /* Main content padding */
    .main {
        padding-top: 85px;
    }
    
    .container {
        padding: 12px;
    }
    
    /* Generation modal */
    .generation-content {
        padding: 20px;
    }

    .magic-orb {
        width: 100px;
        height: 100px;
    }

    .generation-title {
        font-size: 1.4rem;
    }
    
    /* Payment modal */
    .payment-modal-content {
        padding: 20px 16px;
        margin: 10px;
    }
    
    .payment-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .payment-card {
        padding: 20px 16px;
    }
    
    .payment-card-price .price {
        font-size: 1.8rem;
    }
    
    /* Auth modal */
    .auth-modal-content {
        padding: 24px 20px;
        margin: 16px;
    }
    
    /* Gallery modal */
    .gallery-modal-content {
        margin: 0;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .gallery-header {
        padding: 16px 20px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 16px;
    }
    
    /* Profile modal */
    .profile-modal-content {
        margin: 0;
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    /* Aspect ratio grid */
    .aspect-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .aspect-btn {
        padding: 10px 4px;
        gap: 4px;
    }
    
    .aspect-icon {
        width: 20px;
        height: 20px;
    }
    
    .aspect-label {
        font-size: 0.75rem;
    }
    
    .aspect-res {
        font-size: 0.6rem;
    }
    
    /* Result areas */
    .result-area,
    .edit-result-area {
        min-height: 350px;
    }
    
    .result-actions,
    .edit-result-actions {
        opacity: 1 !important;
        pointer-events: all !important;
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin-top: 16px;
    }
}

/* ============================================
   TABLET ADJUSTMENTS
   ============================================ */

@media (max-width: 1024px) and (min-width: 601px) {
    .tools-dropdown-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .payment-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   DESKTOP SPECIFIC
   ============================================ */

@media (min-width: 601px) {
    .btn-tools-mobile {
        display: none !important;
    }
    
    .mobile-tools-modal {
        display: none !important;
    }
}

/* ============================================
   AUTH MODAL - TERMS AGREEMENT
   ============================================ */

.auth-terms-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.auth-terms-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.auth-terms-checkbox {
    display: none;
}

.auth-terms-checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border-strong);
    border-radius: 4px;
    background: var(--surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: 2px;
}

.auth-terms-checkbox:checked + .auth-terms-checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.auth-terms-checkbox:checked + .auth-terms-checkmark::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    color: white;
}

.auth-terms-text {
    flex: 1;
}

.auth-terms-text a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent);
    transition: all 0.2s;
}

.auth-terms-text a:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
}

.auth-terms-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: var(--danger);
    font-size: 0.85rem;
}

.auth-terms-error i {
    font-size: 1rem;
}

/* ============================================
   TERMS MODAL (Privacy & User Agreement)
   ============================================ */

.terms-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.terms-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.terms-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(10px);
}

.terms-modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    width: 100%;
    max-width: 900px;
    height: 85vh;
    margin: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.terms-modal.active .terms-modal-content {
    transform: scale(1);
}

.terms-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    z-index: 10;
}

.terms-modal-close:hover {
    background: var(--surface-active);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.terms-tabs {
    display: flex;
    gap: 0;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-hover);
    flex-shrink: 0;
}

.terms-tab {
    padding: 20px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    position: relative;
}

.terms-tab:hover {
    color: var(--text-primary);
    background: var(--surface-active);
}

.terms-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--surface);
}

.terms-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    line-height: 1.7;
}

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

.terms-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.terms-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

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

.terms-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 16px;
    margin-top: 24px;
}

.terms-section p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.terms-section ul {
    margin-left: 20px;
    margin-bottom: 16px;
}

.terms-section li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.terms-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Mobile Terms Modal */
@media (max-width: 600px) {
    .terms-modal-content {
        margin: 0;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .terms-tabs {
        padding: 0 16px;
    }
    
    .terms-tab {
        padding: 16px 12px;
        font-size: 0.85rem;
    }
    
    .terms-content {
        padding: 20px;
    }
    
    .terms-content h1 {
        font-size: 1.4rem;
    }
    
    .terms-section h2 {
        font-size: 1.1rem;
    }
}