/* ═══════════════════════════════════════════════════════════
   MeAndMyPet — Main Stylesheet
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg-color: #FAFAFC;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --card-bg: rgba(255, 255, 255, 0.7);
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 20px 50px rgba(0, 0, 0, 0.08);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    --purple: #8B5CF6;
    --pink: #EC4899;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
html, body { overflow-x: hidden; }
body { background-color: var(--bg-color); color: var(--text-main); }

/* Градиентные пятна */
.bg-glow  { position: absolute; width: 600px; height: 600px; background: radial-gradient(circle, rgba(236,72,153,0.15) 0%, transparent 70%); top: -100px; left: -100px; z-index: 0; border-radius: 50%; pointer-events: none; }
.bg-glow-2 { position: absolute; width: 500px; height: 500px; background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%); top: 20%; right: -100px; z-index: 0; border-radius: 50%; pointer-events: none; }


/* ═══════════════ ШАПКА ═══════════════ */
header { display: flex; justify-content: space-between; align-items: center; padding: 24px 40px; position: absolute; top: 0; left: 0; right: 0; z-index: 100; }
.logo { font-weight: 800; font-size: 24px; display: flex; align-items: center; gap: 8px; letter-spacing: -0.5px; }
.logo-text { background: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: inline-block; text-decoration: none; }
.logo-icon { width: 28px; height: 28px; color: var(--purple); }

.user-nav { display: flex; align-items: center; gap: 16px; }

/* Выбор языка */
.lang-switcher { position: relative; cursor: pointer; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 50px; border: var(--glass-border); background: rgba(255,255,255,0.9); backdrop-filter: blur(10px); box-shadow: 0 4px 12px rgba(0,0,0,0.03); transition: 0.2s; }
.lang-switcher:hover { background: white; }
.lang-menu { position: absolute; top: 45px; right: 0; background: white; border-radius: var(--radius-md); box-shadow: 0 15px 40px rgba(0,0,0,0.1); padding: 8px; display: none; flex-direction: column; min-width: 130px; border: 1px solid #E2E8F0; z-index: 200; }
.lang-menu.active { display: flex; animation: fadeIn 0.2s ease; }
.lang-item { padding: 10px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; transition: 0.2s; color: var(--text-main); }
.lang-item:hover { background: #F3F4F6; color: var(--purple); }

.balance-container { display: flex; align-items: center; gap: 16px; }
.free-bowls-link { font-size: 13px; font-weight: 600; color: var(--purple); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; transition: 0.2s; }
.free-bowls-link:hover { color: var(--pink); }

.balance { background: rgba(255,255,255,0.9); padding: 6px 16px; border-radius: 50px; font-weight: 700; font-size: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); display: flex; align-items: center; gap: 8px; border: var(--glass-border); backdrop-filter: blur(10px); }
.bowl-img { width: 24px; height: 24px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)); }
.bowl-img-btn { width: 20px; height: 20px; object-fit: contain; margin-right: 4px; vertical-align: middle; }

.login-btn { background: none; border: none; font-weight: 600; cursor: pointer; font-size: 16px; color: var(--text-main); transition: 0.2s; margin-left: 8px; }
.login-btn:hover { color: var(--pink); }

/* Пользовательский блок в шапке */
.user-header-info { display: flex; align-items: center; gap: 12px; }
.user-name-label { font-weight: 700; font-size: 15px; color: var(--text-main); }
.dashboard-link { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--purple); text-decoration: none; padding: 8px 16px; border-radius: 50px; background: rgba(139,92,246,0.08); transition: 0.2s; }
.dashboard-link:hover { background: rgba(139,92,246,0.15); }


/* ═══════════════ ГЛАВНЫЙ ЭКРАН ═══════════════ */
.hero { position: relative; min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 120px 20px 40px; text-align: center; z-index: 10; }
h1 { font-size: 64px; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 48px; line-height: 1.1; z-index: 10; }
.text-gradient { background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: inline-block; }

.floating-img { position: absolute; border-radius: var(--radius-lg); box-shadow: 0 15px 35px rgba(0,0,0,0.1); object-fit: cover; z-index: 1; animation: float 6s ease-in-out infinite; border: 4px solid white; }
.f-1 { top: 15%; left: 8%; width: 140px; height: 180px; animation-delay: 0s; }
.f-2 { top: 22%; right: 10%; width: 160px; height: 160px; border-radius: 50%; animation-delay: 1s; }
.f-3 { bottom: 15%; left: 12%; width: 130px; height: 130px; border-radius: 30px; animation-delay: 2s; }
.f-4 { bottom: 20%; right: 12%; width: 150px; height: 190px; animation-delay: 0.5s; }
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-20px); } 100% { transform: translateY(0px); } }

.generator-view { display: flex; flex-direction: column; align-items: center; }
.upload-container { display: flex; gap: 24px; z-index: 10; margin-bottom: 45px; }
.upload-box { width: 240px; height: 240px; background: var(--card-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: var(--glass-border); border-radius: var(--radius-lg); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; }
.upload-box::before { content: ''; position: absolute; inset: 0; border-radius: var(--radius-lg); border: 2px dashed #CBD5E1; opacity: 0.5; transition: 0.3s; }
.upload-box:hover { transform: translateY(-8px) scale(1.02); box-shadow: var(--shadow-hover); background: rgba(255,255,255,0.95); }
.upload-box:hover::before { border-color: var(--purple); opacity: 1; }
.gen-avatar { width: 80px; height: 80px; object-fit: contain; margin-bottom: 16px; filter: drop-shadow(0 10px 15px rgba(0,0,0,0.15)); transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.gen-avatar.uploaded-preview { border-radius: var(--radius-md); object-fit: cover; }
.upload-box:hover .gen-avatar { transform: scale(1.15) translateY(-5px); filter: drop-shadow(0 15px 25px rgba(139,92,246,0.3)); }
.upload-text { font-weight: 700; font-size: 18px; color: var(--text-main); position: relative; z-index: 2; }
.upload-subtext { font-size: 13px; color: var(--text-muted); margin-top: 8px; text-decoration: underline; padding: 4px; border-radius: 4px; position: relative; z-index: 2; }
.upload-subtext:hover { color: var(--purple); }
input[type="file"] { display: none; }

.upload-box.shake { animation: shake 0.5s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }

.selected-style-label { font-size: 13px; font-weight: 600; color: var(--purple); margin-top: 12px; padding: 6px 14px; background: rgba(139,92,246,0.08); border-radius: 50px; }

.action-bar { display: flex; align-items: center; gap: 16px; z-index: 100; position: relative; }

.filter-btn { width: 68px; height: 68px; border-radius: 50%; border: var(--glass-border); background: rgba(255,255,255,0.9); box-shadow: 0 10px 25px rgba(0,0,0,0.05); font-size: 28px; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(10px); }
.filter-btn:hover { transform: scale(1.1) rotate(15deg); box-shadow: 0 15px 30px rgba(139,92,246,0.2); }

.filter-menu { position: absolute; top: 85px; left: 0; background: white; border-radius: var(--radius-md); box-shadow: 0 20px 50px rgba(0,0,0,0.1); padding: 16px; display: none; flex-direction: column; gap: 8px; min-width: 220px; text-align: left; border: 1px solid #E2E8F0; z-index: 150; }
.filter-menu.active { display: flex; animation: fadeIn 0.2s ease; }
.filter-item { padding: 10px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--text-main); transition: 0.2s; }
.filter-item:hover { background: #F3F4F6; color: var(--purple); }

/* Кнопка 3D */
.btn-3d { background: linear-gradient(135deg, #374151 0%, #111827 100%); color: white; border: 1px solid #0f172a; border-radius: 50px; font-weight: 700; cursor: pointer; box-shadow: 0 15px 25px rgba(17,24,39,0.4), inset 0 4px 6px rgba(255,255,255,0.25), inset 0 -5px 8px rgba(0,0,0,0.6); transition: all 0.15s ease-out; display: flex; align-items: center; justify-content: center; text-shadow: 0 2px 4px rgba(0,0,0,0.6); }
.btn-3d:hover { background: linear-gradient(135deg, #4b5563 0%, #1f2937 100%); box-shadow: 0 20px 30px rgba(17,24,39,0.5), inset 0 5px 8px rgba(255,255,255,0.35), inset 0 -5px 8px rgba(0,0,0,0.7); }
.btn-3d:active { background: linear-gradient(135deg, #1f2937 0%, #111827 100%); box-shadow: 0 4px 10px rgba(17,24,39,0.3), inset 0 6px 10px rgba(0,0,0,0.7), inset 0 -2px 4px rgba(255,255,255,0.05); }
.generate-btn { padding: 0 48px; height: 68px; font-size: 20px; gap: 10px; }
.generate-btn:hover { transform: translateY(-2px); }
.generate-btn:active { transform: translateY(4px); }
.generate-btn span { opacity: 0.8; font-weight: 600; font-size: 16px; display: flex; align-items: center; }


/* ═══════════════ РЕЗУЛЬТАТ ГЕНЕРАЦИИ ═══════════════ */
.result-popup-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.9); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); display: none; align-items: center; justify-content: center; z-index: 9000; opacity: 0; transition: opacity 0.4s ease; padding: 20px; }
.result-popup-overlay.active { display: flex; opacity: 1; }
.close-overlay-btn { position: absolute; top: 30px; right: 40px; background: none; border: none; cursor: pointer; color: white; opacity: 0.6; transition: 0.2s; z-index: 100; padding: 10px; }
.close-overlay-btn:hover { opacity: 1; transform: rotate(90deg); }
.result-image-wrapper { position: relative; max-width: 90vw; max-height: 85vh; border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 30px 60px rgba(0,0,0,0.5); transform: scale(0.9); transition: transform 0.4s cubic-bezier(0.175,0.885,0.32,1.275); display: flex; }
.result-popup-overlay.active .result-image-wrapper { transform: scale(1); }
.result-image { display: block; width: 100%; max-height: 85vh; object-fit: contain; }
.result-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); display: flex; flex-direction: column; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; padding: 40px; text-align: center; }
.result-image-wrapper:hover .result-overlay { opacity: 1; }
.result-actions { display: flex; gap: 20px; margin-bottom: 30px; }
.action-icon-btn { width: 64px; height: 64px; border-radius: 50%; background: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 25px rgba(0,0,0,0.3); transition: 0.2s cubic-bezier(0.175,0.885,0.32,1.275); transform: translateY(15px); }
.result-image-wrapper:hover .action-icon-btn { transform: translateY(0); }
.action-icon-btn:hover { transform: scale(1.1) !important; background: #f8fafc; }
.action-icon-btn svg { width: 28px; height: 28px; color: #0F172A; }
.action-icon-btn.small { width: 44px; height: 44px; transform: none; }
.action-icon-btn.small svg { width: 20px; height: 20px; }
.action-icon-btn.active { background: var(--purple); }
.action-icon-btn.active svg { color: white; }

.publish-switch-wrapper.dark-theme { display: flex; align-items: center; gap: 16px; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.2); padding: 16px 24px; border-radius: var(--radius-md); cursor: pointer; transition: 0.2s; max-width: 400px; transform: translateY(15px); }
.result-image-wrapper:hover .publish-switch-wrapper.dark-theme { transform: translateY(0); }
.publish-switch-wrapper.dark-theme:hover { background: rgba(0,0,0,0.6); border-color: rgba(255,255,255,0.4); }
.publish-switch-wrapper.dark-theme .publish-text { color: white; font-size: 14px; font-weight: 500; text-align: left; line-height: 1.4; }
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.3); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: var(--purple); }
input:checked + .slider:before { transform: translateX(22px); }


/* ═══════════════ ОБЩИЕ ПОПАПЫ ═══════════════ */
.popup-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.6); backdrop-filter: blur(8px); display: none; align-items: flex-start; justify-content: center; z-index: 10000; opacity: 0; transition: opacity 0.3s ease; padding: 20px; overflow-y: auto; }
.popup-overlay.active { display: flex; opacity: 1; }
/* Центрируем модал вертикально когда он помещается на экран */
.popup-overlay::before { content: ''; flex: 1; min-height: 20px; }
.popup-overlay::after  { content: ''; flex: 1; min-height: 20px; }
.popup-modal { background: white; width: 100%; max-width: 440px; padding: 40px; border-radius: var(--radius-lg); box-shadow: 0 25px 50px rgba(0,0,0,0.25); position: relative; text-align: center; transform: scale(0.95); transition: transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275); flex-shrink: 0; align-self: center; }
.popup-overlay.active .popup-modal { transform: scale(1); }
.popup-close { position: absolute; top: 20px; right: 20px; background: none; border: none; cursor: pointer; color: #94A3B8; transition: 0.2s; padding: 8px; z-index: 1; }
.popup-close:hover { color: var(--text-main); transform: rotate(90deg); }
.popup-title { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.popup-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }


/* ═══════════════ АВТОРИЗАЦИЯ ═══════════════ */
.auth-tabs { display: flex; background: #F1F5F9; border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 10px; border: none; background: none; border-radius: 10px; font-weight: 600; font-size: 15px; cursor: pointer; color: var(--text-muted); transition: 0.2s; }
.auth-tab.active { background: white; color: var(--text-main); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-error { background: #FEF2F2; border: 1px solid #FECACA; color: #DC2626; padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; margin-bottom: 16px; text-align: left; animation: fadeIn 0.2s ease; }
.auth-input { width: 100%; padding: 14px 16px; border: 2px solid #E2E8F0; border-radius: 12px; font-size: 16px; margin-bottom: 12px; transition: 0.2s; outline: none; font-family: inherit; }
.auth-input:focus { border-color: var(--purple); }
.auth-btn { width: 100%; background: #0F172A; color: white; border: none; padding: 16px; border-radius: 12px; font-weight: 700; font-size: 16px; cursor: pointer; transition: 0.2s; margin-top: 4px; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-btn:hover { background: #1E293B; transform: translateY(-2px); }
.auth-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.auth-btn-outline { background: white; color: var(--text-main); border: 2px solid #E2E8F0; margin-top: 12px; }
.auth-btn-outline:hover { background: #F8FAFC; border-color: var(--purple); color: var(--purple); }
.auth-switch-text { font-size: 14px; color: var(--text-muted); margin-top: 16px; }
.auth-switch-link { color: var(--purple); font-weight: 600; cursor: pointer; text-decoration: underline; }
.auth-switch-link:hover { color: var(--pink); }


/* ═══════════════ МИСКИ КОНЧИЛИСЬ ═══════════════ */
.empty-bowl-icon { font-size: 64px; margin-bottom: 16px; }

/* ═══════════════ ТАРИФНЫЕ ПАКЕТЫ ═══════════════ */
.popup-modal-wide { max-width: 520px !important; }
.packages-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 0; }
/* pointer-events: all — гарантируем кликабельность поверх любых оверлеев */
.package-card { position: relative; background: #F8FAFC; border: 2px solid #E2E8F0; border-radius: 16px; padding: 16px 14px; cursor: pointer; transition: all 0.25s cubic-bezier(0.175,0.885,0.32,1.275); text-align: center; pointer-events: all; user-select: none; }
.package-card:hover { border-color: var(--purple); background: rgba(139,92,246,0.04); transform: translateY(-2px); }
.package-card.selected { border-color: var(--purple); background: rgba(139,92,246,0.08); box-shadow: 0 0 0 3px rgba(139,92,246,0.2); transform: translateY(-2px); }
.package-card.package-popular { border-color: var(--purple); }
.package-badge { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, var(--pink), var(--purple)); color: white; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 50px; white-space: nowrap; pointer-events: none; }
.package-name { font-size: 15px; font-weight: 800; color: var(--text-main); margin-bottom: 2px; pointer-events: none; }
.package-desc { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; pointer-events: none; }
.package-price { font-size: 22px; font-weight: 800; color: var(--text-main); margin-bottom: 4px; pointer-events: none; }
.package-bowls { font-size: 13px; font-weight: 700; color: var(--purple); margin-bottom: 2px; pointer-events: none; }
.package-images { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; pointer-events: none; }
.package-leftover { font-size: 11px; color: #94A3B8; pointer-events: none; }
.packages-note { font-size: 12px; color: var(--text-muted); margin-top: 8px; text-align: center; }
.package-skeleton { background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%); background-size: 200% 100%; border-radius: 16px; height: 140px; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }


/* ═══════════════ ПОПАП «КАК ПОЛУЧИТЬ» ═══════════════ */
.bowls-modal { max-width: 580px !important; padding: 32px !important; }
.tasks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.task-card { background: #F8FAFC; border: 2px solid transparent; border-radius: 20px; padding: 24px 16px 20px; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; transition: all 0.3s cubic-bezier(0.175,0.885,0.32,1.275); }
.task-card.interactive { cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
.task-card.interactive:hover { transform: translateY(-6px) scale(1.02); box-shadow: 0 15px 30px rgba(139,92,246,0.15); border-color: var(--purple); background: white; }
.task-icon { width: 64px; height: 64px; object-fit: contain; margin-bottom: 12px; filter: drop-shadow(0 8px 12px rgba(0,0,0,0.1)); transition: 0.3s; }
.task-card.interactive:hover .task-icon { transform: scale(1.1); }
.task-title { font-size: 16px; font-weight: 800; color: var(--text-main); margin-bottom: 6px; }
.task-desc { font-size: 13px; color: var(--text-muted); line-height: 1.4; font-weight: 500; }
.task-reward { position: absolute; top: 12px; right: 12px; background: white; padding: 6px 10px; border-radius: 50px; font-weight: 800; font-size: 14px; color: var(--text-main); display: flex; align-items: center; gap: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.08); }
.task-mini-bowl { width: 16px; height: 16px; }


/* ═══════════════ ВОДЯНОЙ ЗНАК ═══════════════ */
.watermark-badge { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.7); color: white; font-size: 13px; font-weight: 600; padding: 8px 20px; border-radius: 50px; display: flex; align-items: center; gap: 8px; white-space: nowrap; backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.15); }
.watermark-link { color: #F59E0B; text-decoration: underline; cursor: pointer; transition: 0.2s; }
.watermark-link:hover { color: #FBBF24; }

/* ═══════════════ МОДАЛ «ПОВТОРИТЬ СТИЛЬ» ═══════════════ */
.repeat-style-header { margin-bottom: 4px; }
.repeat-style-icon { font-size: 48px; margin-bottom: 8px; }
.repeat-style-badge { display: inline-flex; background: linear-gradient(135deg, var(--pink), var(--purple)); color: white; font-size: 13px; font-weight: 700; padding: 5px 14px; border-radius: 50px; margin-bottom: 16px; }
.repeat-upload-box { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #F8FAFC; border: 2px dashed #CBD5E1; border-radius: var(--radius-md); padding: 18px; cursor: pointer; margin-bottom: 12px; transition: 0.25s; }
.repeat-upload-box:hover { border-color: var(--purple); background: rgba(139,92,246,0.04); }
.required-upload { border-color: rgba(139,92,246,0.4); }
.required-star { color: #EF4444; font-weight: 900; }
.repeat-upload-box .gen-avatar { width: 52px; height: 52px; margin-bottom: 8px; }
.repeat-upload-box .upload-text { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.repeat-upload-box .upload-subtext { font-size: 12px; color: var(--text-muted); text-align: center; }
.bowl-img-btn-inline { width: 18px; height: 18px; vertical-align: middle; margin-left: 2px; }

/* ═══════════════ ЗАГРУЗЧИК (МАХАЧ) ═══════════════ */
.loader-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.85); backdrop-filter: blur(15px); z-index: 9500; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.4s ease; }
.loader-overlay.active { opacity: 1; pointer-events: all; }
.makhach-scene { position: relative; width: 180px; height: 180px; display: flex; align-items: center; justify-content: center; margin-bottom: 40px; }
.dust-cloud { position: relative; width: 130px; height: 130px; background: #F8FAFC; border-radius: 50%; box-shadow: -40px 20px 0 -10px #F8FAFC, 40px 10px 0 -10px #F8FAFC, 20px -30px 0 -10px #F8FAFC, -20px -20px 0 -5px #F8FAFC, inset -15px -15px 30px rgba(0,0,0,0.15); animation: makhach-shake 0.25s infinite alternate; z-index: 10; display: flex; align-items: center; justify-content: center; }
.dust-cloud::after { content: '💥'; font-size: 60px; animation: makhach-bam 0.7s infinite; }
@keyframes makhach-shake { 0% { transform: translate(3px, 4px) rotate(0deg) scale(1); } 25% { transform: translate(-4px, -3px) rotate(-6deg) scale(1.05); } 50% { transform: translate(5px, 2px) rotate(4deg) scale(0.95); } 75% { transform: translate(-3px, 5px) rotate(-3deg) scale(1.02); } 100% { transform: translate(4px, -4px) rotate(5deg) scale(1); } }
@keyframes makhach-bam { 0%,100% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.5); opacity: 1; } }
.fly-item { position: absolute; z-index: 5; opacity: 0; top: 50%; left: 50%; margin-top: -20px; margin-left: -20px; width: 40px; height: 40px; }
.fly-item img { width: 100%; height: 100%; object-fit: contain; }
.f-1-m { animation: fly-out 1.2s infinite 0.1s linear; } .f-2-m { animation: fly-out-2 1.4s infinite 0.4s linear; } .f-3-m { animation: fly-out-3 1.1s infinite 0.2s linear; } .f-4-m { animation: fly-out-4 1.5s infinite 0.7s linear; } .f-5-m { animation: fly-out-5 1.3s infinite 0.5s linear; } .f-6-m { animation: fly-out-6 1.0s infinite 0.8s linear; }
@keyframes fly-out   { 0% { transform: translate(0,0) rotate(0); opacity: 1; } 100% { transform: translate(-100px,-120px) rotate(-180deg) scale(1.5); opacity: 0; } }
@keyframes fly-out-2 { 0% { transform: translate(0,0) rotate(0); opacity: 1; } 100% { transform: translate(120px,-80px) rotate(180deg) scale(1.5); opacity: 0; } }
@keyframes fly-out-3 { 0% { transform: translate(0,0) rotate(0); opacity: 1; } 100% { transform: translate(-90px,110px) rotate(-90deg); opacity: 0; } }
@keyframes fly-out-4 { 0% { transform: translate(0,0) rotate(0); opacity: 1; } 100% { transform: translate(110px,100px) rotate(360deg); opacity: 0; } }
@keyframes fly-out-5 { 0% { transform: translate(0,0) rotate(0); opacity: 1; } 100% { transform: translate(0px,-140px) rotate(360deg); opacity: 0; } }
@keyframes fly-out-6 { 0% { transform: translate(0,0) rotate(0); opacity: 1; } 100% { transform: translate(0px,140px) rotate(-360deg); opacity: 0; } }
.loader-text { color: white; text-align: center; font-size: 32px; font-weight: 800; letter-spacing: -1px; text-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.loader-text span { font-size: 18px; font-weight: 500; color: #94A3B8; display: block; margin-top: 12px; animation: pulse-text 1.5s infinite alternate; }
@keyframes pulse-text { 0% { opacity: 0.5; transform: scale(0.98); } 100% { opacity: 1; transform: scale(1.02); } }
.loading-spinner { width: 48px; height: 48px; border: 4px solid #E2E8F0; border-top-color: var(--purple); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ═══════════════ ГАЛЕРЕЯ ═══════════════ */
.gallery-section { padding: 80px 40px; max-width: 1400px; margin: 0 auto; position: relative; }
.gallery-title { text-align: center; font-size: 36px; margin-bottom: 50px; font-weight: 800; letter-spacing: -1px; }
.masonry-grid { column-count: 4; column-gap: 24px; }
.gallery-item { break-inside: avoid; margin-bottom: 24px; position: relative; border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.gallery-item img { width: 100%; display: block; border-radius: var(--radius-lg); transition: transform 0.6s cubic-bezier(0.25,0.46,0.45,0.94); }
.gallery-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.1) 100%); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; border-radius: var(--radius-lg); }
.gallery-item:hover .gallery-overlay { opacity: 1; }
.gallery-item:hover > img { transform: scale(1.08); }
.repeat-btn { padding: 0 28px; height: 52px; font-size: 15px; position: absolute; opacity: 0; transform: translateY(20px); transition: all 0.2s cubic-bezier(0.175,0.885,0.32,1.275); }
.gallery-item:hover .repeat-btn { opacity: 1; transform: translateY(0); }
.repeat-btn:hover { transform: translateY(-4px) scale(1.05) !important; }


/* ═══════════════ TOAST ═══════════════ */
.toast-container { position: fixed; bottom: 32px; right: 32px; z-index: 99999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: white; border-radius: 14px; padding: 14px 20px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; min-width: 260px; max-width: 380px; transform: translateX(120%); transition: transform 0.35s cubic-bezier(0.175,0.885,0.32,1.275); border-left: 4px solid #8B5CF6; }
.toast.toast-show { transform: translateX(0); }
.toast.toast-error { border-left-color: #EF4444; }
.toast.toast-info { border-left-color: #3B82F6; }
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-text { line-height: 1.4; }


/* ═══════════════ ЛИЧНЫЙ КАБИНЕТ ═══════════════ */
.dashboard-page { max-width: 1100px; margin: 0 auto; padding: 120px 40px 80px; min-height: 100vh; }

.dashboard-hero { display: flex; align-items: center; gap: 24px; margin-bottom: 40px; }
.dashboard-avatar { width: 72px; height: 72px; background: linear-gradient(135deg, var(--pink), var(--purple)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 800; color: white; flex-shrink: 0; box-shadow: 0 10px 30px rgba(139,92,246,0.3); }
.dashboard-hero-info {}
.dashboard-welcome { font-size: 36px; font-weight: 800; letter-spacing: -1px; margin-bottom: 4px; }
.dashboard-email { color: var(--text-muted); font-size: 15px; }

.dashboard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 48px; }
.stat-card { background: white; border-radius: var(--radius-lg); padding: 28px; text-align: center; box-shadow: var(--shadow); border: 1px solid #F1F5F9; transition: 0.3s; }
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-4px); }
.stat-icon { font-size: 36px; margin-bottom: 12px; }
.stat-value { font-size: 40px; font-weight: 800; letter-spacing: -2px; color: var(--text-main); margin-bottom: 4px; }
.stat-label { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-bottom: 16px; }
.stat-btn { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--pink), var(--purple)); color: white; border: none; padding: 10px 24px; border-radius: 50px; font-size: 14px; font-weight: 700; cursor: pointer; transition: 0.2s; text-decoration: none; }
.stat-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(139,92,246,0.35); }

.dashboard-section { margin-bottom: 48px; }
.dashboard-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.dashboard-section-title { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.dashboard-section-link { color: var(--purple); font-weight: 600; font-size: 14px; text-decoration: none; padding: 8px 16px; border-radius: 50px; background: rgba(139,92,246,0.08); transition: 0.2s; }
.dashboard-section-link:hover { background: rgba(139,92,246,0.15); }

/* Сетка картинок в кабинете */
.my-images-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.my-image-card { position: relative; border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); aspect-ratio: 4/5; background: #F1F5F9; }
.my-image-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; display: block; }
.my-image-card:hover img { transform: scale(1.06); }
.my-image-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%); opacity: 0; transition: opacity 0.3s; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; }
.my-image-card:hover .my-image-overlay { opacity: 1; }
.my-image-meta { margin-bottom: 10px; }
.my-image-style { display: inline-block; background: rgba(255,255,255,0.2); color: white; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 50px; margin-bottom: 4px; }
.my-image-date { display: block; color: rgba(255,255,255,0.7); font-size: 12px; }
.my-image-actions { display: flex; gap: 8px; }

/* «Нет картинок» */
.no-images-msg { text-align: center; padding: 80px 20px; }
.no-images-icon { font-size: 72px; margin-bottom: 16px; }
.no-images-msg h3 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.no-images-msg p { color: var(--text-muted); font-size: 16px; }

/* «Загружаем» в кабинете */
.images-loading { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.images-loading p { margin-top: 16px; font-weight: 500; }


/* ═══════════════ АНИМАЦИИ ═══════════════ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }


/* ═══════════════ АДАПТИВНОСТЬ ═══════════════ */
@media (max-width: 1024px) {
    .masonry-grid { column-count: 3; }
    .floating-img { display: none; }
    h1 { font-size: 48px; }
    .dashboard-stats { grid-template-columns: repeat(3, 1fr); }
}

/* ═══════════════ БУРГЕР-МЕНЮ ═══════════════ */
.burger-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 300;
}

.burger-menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: left center;
}

.burger-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(2px, -1px);
}

.burger-menu-btn.active span:nth-child(2) {
    width: 0%;
    opacity: 0;
}

.burger-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(2px, 1px);
}

@media (max-width: 768px) {
    h1 { font-size: 40px; }
    .upload-container { flex-direction: column; gap: 16px; }
    .upload-box { width: 100%; max-width: 320px; height: 180px; }
    .masonry-grid { column-count: 2; }
    header {
        padding: 20px 24px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        background: rgba(250,250,252,0.85);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    }
    .logo { margin-bottom: 0; }
    .burger-menu-btn { display: flex; }
    .user-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 290px;
        height: 100vh;
        background: white;
        box-shadow: -10px 0 40px rgba(15,23,42,0.15);
        padding: 90px 24px 40px;
        display: flex;
        flex-direction: column;
        gap: 20px;
        transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 250;
        align-items: stretch;
        justify-content: flex-start;
    }
    .user-nav.active { right: 0; }
    .balance-container {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 12px;
        margin-top: 10px;
        border-bottom: 1px solid #F1F5F9;
        padding-bottom: 20px;
    }
    .balance { justify-content: center; width: 100%; }
    .free-bowls-link { text-align: center; }
    .lang-switcher { justify-content: center; width: 100%; }
    .lang-menu { width: 100%; left: 0; right: 0; top: 50px; }
    .user-header-info { flex-direction: column; align-items: stretch; gap: 12px; }
    .dashboard-link { justify-content: center; }
    .login-btn {
        margin-left: 0;
        text-align: center;
        width: 100%;
        padding: 14px;
        border-radius: var(--radius-md);
        background: #F1F5F9;
        font-weight: 700;
    }
    .login-btn:hover { background: #E2E8F0; }
    #logoutBtn { background: #FEF2F2; color: #EF4444; }
    #logoutBtn:hover { background: #FEE2E2; color: #DC2626; }
    .hero { padding-top: 160px; }

    .dashboard-page { padding: 100px 20px 60px; }
    .dashboard-stats { grid-template-columns: 1fr; }
    .dashboard-hero { flex-direction: column; text-align: center; }
    .dashboard-welcome { font-size: 28px; }
    .my-images-grid { grid-template-columns: repeat(2, 1fr); }

    .result-popup-overlay { padding: 16px; }
    .result-image-wrapper { flex-direction: column; overflow: visible; box-shadow: none; background: transparent; max-height: none; }
    .result-image { max-height: 50vh; border-radius: var(--radius-lg); box-shadow: 0 20px 40px rgba(0,0,0,0.4); }
    .result-overlay { position: relative; inset: auto; opacity: 1; background: transparent; backdrop-filter: none; padding: 24px 0 0 0; }
    .result-actions { margin-bottom: 20px; }
    .action-icon-btn { transform: translateY(0) !important; background: #0F172A; box-shadow: 0 10px 20px rgba(15,23,42,0.2); }
    .action-icon-btn svg { color: white; }
    .publish-switch-wrapper.dark-theme { transform: translateY(0) !important; background: white; border: 1px solid #E2E8F0; box-shadow: var(--shadow); }
    .publish-switch-wrapper.dark-theme .publish-text { color: var(--text-main); }
    .publish-switch-wrapper.dark-theme .slider { background-color: #CBD5E1; }
    .publish-switch-wrapper.dark-theme input:checked + .slider { background-color: var(--purple); }
}

@media (max-width: 600px) {
    .tasks-grid { grid-template-columns: 1fr; }
    .bowls-modal { padding: 24px !important; }
    .bg-glow { max-width: 100vw; left: 0; }
    .bg-glow-2 { max-width: 100vw; right: 0; }
    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast { min-width: 0; width: 100%; max-width: 100%; }
}

@media (max-width: 480px) {
    .masonry-grid { column-count: 1; }
    .action-bar { flex-direction: column; width: 100%; max-width: 320px; }
    .generate-btn { width: 100%; justify-content: center; }
    .filter-menu { top: auto; bottom: 85px; left: 50%; transform: translateX(-50%); }
    .login-btn { margin-left: 0; }
    .my-images-grid { grid-template-columns: 1fr; }
}

.styles-popup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 12px;
    max-height: 380px;
    overflow-y: auto;
    padding: 6px;
}

.style-select-card {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 20px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.style-select-card:hover {
    border-color: var(--purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(139,92,246,0.12);
}

.style-select-card.active {
    border-color: var(--purple);
    background: var(--purple);
}

.style-select-card.active .style-card-title {
    color: white;
}

.style-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    z-index: 10;
}

.style-select-card[data-style="space"] {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.03) 0%, rgba(139, 92, 246, 0.05) 100%);
}
.style-select-card[data-style="space"].active {
    background: var(--purple);
}
.style-select-card[data-style="pixar"] {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.03) 0%, rgba(59, 130, 246, 0.05) 100%);
}
.style-select-card[data-style="pixar"].active {
    background: var(--purple);
}
.style-select-card[data-style="medieval"] {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.03) 0%, rgba(120, 53, 4, 0.05) 100%);
}
.style-select-card[data-style="medieval"].active {
    background: var(--purple);
}
.style-select-card[data-style="random"] {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.03) 0%, rgba(236, 72, 153, 0.03) 100%);
}
.style-select-card[data-style="random"].active {
    background: var(--purple);
}

@media (max-width: 480px) {
    .styles-popup-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════ ФУТЕР ═══════════════ */
.site-footer {
    background: #F1F5F9;
    border-top: 1px solid #E2E8F0;
    padding: 60px 40px 30px;
    margin-top: 80px;
    position: relative;
    z-index: 10;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.footer-tagline {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.footer-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-info-list, .footer-links-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
}

.footer-info-list li {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.footer-link {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--purple);
}

.footer-bottom {
    max-width: 1200px;
    margin: 60px auto 0;
    padding-top: 30px;
    border-top: 1px solid #E2E8F0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 1024px) {
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 600px) {
    .footer-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .site-footer {
        padding: 40px 20px 20px;
        margin-top: 40px;
    }
}

/* ═══════════════ СТРАНИЦЫ ДОКУМЕНТОВ ═══════════════ */
.doc-page {
    padding: 140px 20px 60px;
    max-width: 800px;
    margin: 0 auto;
    min-height: 80vh;
}

.doc-container {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid #E2E8F0;
    text-align: left;
}

.doc-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--text-main);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.doc-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #E2E8F0;
}

.doc-content h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 28px 0 14px;
    color: var(--text-main);
}

.doc-content p {
    font-size: 15px;
    color: #334155;
    line-height: 1.7;
    margin-bottom: 16px;
}

.doc-content ul {
    margin-bottom: 16px;
    padding-left: 20px;
}

.doc-content li {
    font-size: 15px;
    color: #334155;
    line-height: 1.7;
    margin-bottom: 8px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--purple);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 24px;
    transition: transform 0.2s;
}

.back-link:hover {
    transform: translateX(-4px);
}

@media (max-width: 600px) {
    .doc-container {
        padding: 24px;
    }
    .doc-title {
        font-size: 24px;
    }
}

/* ═══════════════ COOKIE BANNER ═══════════════ */
.cookie-banner {
    position: fixed;
    bottom: -120px;
    left: 20px;
    right: 20px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 11000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: bottom 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.show {
    bottom: 20px;
}

.cookie-text {
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.cookie-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.cookie-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.cookie-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        left: 12px;
        right: 12px;
        padding: 16px;
    }
    .cookie-text {
        text-align: center;
    }
    .cookie-btn {
        width: 100%;
    }
}

