/* ======================================= */
/* PHOTO CONSTRUCTOR v2.0 — CLEAN REDESIGN */
/* ======================================= */

html, body {
    overflow-x: hidden !important;
    max-width: 100%;
    box-sizing: border-box;
}

* { box-sizing: border-box; }

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --light: #f9fafb;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f9;
    color: var(--dark);
    margin: 0;
    padding: 0;
}

/* === Hero === */
.hero-section {
    background: var(--gradient);
    color: white;
    padding: 40px 0 60px;
    position: relative;
    overflow: hidden;
}

.hero-section::before, .hero-section::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}
.hero-section::before {
    top: -50%; right: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}
.hero-section::after {
    bottom: -30%; left: -5%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
}

.btn-back {
    color: white !important;
    border-color: rgba(255,255,255,0.3) !important;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.1);
    transition: all 0.3s;
}
.btn-back:hover { background: rgba(255,255,255,0.2); transform: translateX(-3px); }

.hero-content { position: relative; z-index: 2; }
.hero-icon { font-size: 4rem; margin-bottom: 15px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-10px);} }
.hero-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 10px; text-shadow: 0 2px 20px rgba(0,0,0,0.2); }
.hero-subtitle { font-size: 1.15rem; opacity: 0.95; margin-bottom: 20px; }
.hero-badges { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.badge-feature {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 8px 18px;
    border-radius: 30px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.2);
}

/* === Instructions === */
.instructions-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.instructions-toggle {
    padding: 15px 25px;
    cursor: pointer;
    transition: background 0.3s;
}
.instructions-toggle:hover { background: #f9fafb; }
.instructions-toggle h4 {
    margin: 0; color: var(--primary);
    display: flex; align-items: center; gap: 10px;
}
.instructions-toggle .bi-chevron-down {
    transition: transform 0.3s;
    margin-left: auto;
}
.instructions-toggle .bi-chevron-down.rotated { transform: rotate(180deg); }
.instructions-content {
    padding: 0 25px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
}
.instructions-content.show {
    max-height: 500px;
    padding: 15px 25px 25px;
}
.instruction-step {
    display: flex; gap: 15px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 10px;
    margin-bottom: 10px;
}
.step-number {
    width: 36px; height: 36px;
    background: var(--gradient);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; flex-shrink: 0;
}
.step-content h5 { margin: 0 0 5px; font-size: 0.95rem; }
.step-content p { margin: 0; color: #6b7280; font-size: 0.85rem; }

/* === Comparison Panel (ОРИГИНАЛ | РЕЗУЛЬТАТ) === */
.comparison-panel {
    animation: fadeIn 0.5s ease;
}

.comparison-card {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    height: 480px;
    display: flex;
    flex-direction: column;
}

.comparison-header {
    padding: 12px 20px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.comparison-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--dark);
}
.comparison-title i {
    color: var(--primary);
    margin-right: 6px;
}

.comparison-meta {
    font-size: 0.8rem;
    color: #6b7280;
    font-family: 'Courier New', monospace;
}

.comparison-body {
    flex: 1;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fafbfc;
    position: relative;
}

/* Upload zone (внутри левой карточки) */
.upload-zone {
    width: 100%;
    height: 100%;
    border: 3px dashed #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: white;
    position: relative;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(102,126,234,0.04);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 10px;
}
.upload-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin: 5px 0;
}

.file-input {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
}

.preview-image-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.preview-image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: block;
}

.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(239,68,68,0.95);
    color: white;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.btn-remove:hover { background: #dc2626; }

/* Result area */
.result-area {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.result-area img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.result-empty {
    text-align: center;
    color: #9ca3af;
}
.result-empty p {
    margin-top: 10px;
    font-size: 0.95rem;
}

/* === Action Bar (панель действий) === */
.action-bar {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 10px 15px;
    position: sticky;
    top: 10px;
    z-index: 100;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

.action-bar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    min-width: 44px;
    min-height: 44px;
}

.action-btn-primary {
    background: var(--gradient-success);
    color: white;
    padding: 10px 24px;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.action-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16,185,129,0.4);
}

.action-divider {
    width: 1px;
    height: 28px;
    background: #e5e7eb;
    margin: 0 4px;
}

.share-btn.share-vk { background: #0077ff; color: white; }
.share-btn.share-vk:hover { background: #0055cc; color: white; transform: translateY(-2px); }
.share-btn.share-ok { background: #ee8208; color: white; }
.share-btn.share-ok:hover { background: #d97706; color: white; transform: translateY(-2px); }
.share-btn.share-mail { background: #005ff9; color: white; }
.share-btn.share-mail:hover { background: #0047cc; color: white; transform: translateY(-2px); }
.share-btn.share-max { background: #7c3aed; color: white; }
.share-btn.share-max:hover { background: #6d28d9; color: white; transform: translateY(-2px); }
.share-btn.share-telegram { background: #0088cc; color: white; }
.share-btn.share-telegram:hover { background: #006699; color: white; transform: translateY(-2px); }
.share-btn.share-copy { background: #f9fafb; color: #374151; border: 2px solid #e5e7eb; }
.share-btn.share-copy:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-2px); }

/* === Settings Panel === */
.settings-panel {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-top: 10px;
}
.settings-header {
    padding: 18px 25px;
    background: var(--gradient);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.settings-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}
.settings-body {
    padding: 25px;
}

.settings-section {
    padding: 20px 0;
    border-bottom: 1px solid #e5e7eb;
}
.settings-section:last-child { border-bottom: none; padding-bottom: 0; }
.settings-section:first-child { padding-top: 0; }

.section-title {
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    background: var(--gradient);
    color: white;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
}

/* Pixel art params */
.pixelart-params {
    margin-top: 15px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    animation: slideDown 0.3s ease;
}

.param-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-select-sm, .form-control-sm {
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    padding: 8px 12px;
}
.form-select-sm:focus, .form-control-sm:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-range {
    width: 100%;
    height: 6px;
    margin-top: 8px;
}

/* === Style Chips === */
.style-chips {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.style-chip, .frame-chip {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    user-select: none;
}

.style-chip:hover, .frame-chip:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.15);
}

.style-chip.active, .frame-chip.active {
    background: var(--gradient);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 5px 15px rgba(102,126,234,0.35);
}

.chip-icon { font-size: 1.3rem; }

/* === Effects Toggles === */
.effects-toggles {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.effect-toggle {
    display: flex;
    cursor: pointer;
    user-select: none;
}
.effect-toggle input[type="checkbox"] { display: none; }

.toggle-label {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 4px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s;
}

.effect-toggle input:checked + .toggle-label {
    background: var(--gradient-success);
    border-color: #10b981;
    color: white;
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}
.effect-toggle:hover .toggle-label {
    border-color: #10b981;
    transform: translateY(-1px);
}

/* === Footer === */
.site-footer {
    background: var(--dark);
    color: white;
    padding: 25px 0;
    margin-top: 50px;
}

/* === Cookie Banner === */
.cookie-banner {
    position: fixed;
    bottom: 20px; left: 20px; right: 20px;
    max-width: 600px; margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    display: none;
}

/* === Compressing indicator === */
.compressing-indicator {
    text-align: center;
    color: var(--primary);
}
.compressing-indicator p {
    margin: 10px 0 0;
    font-size: 0.9rem;
    font-weight: 600;
}

/* === Responsive === */
@media (max-width: 991px) {
    .comparison-card { height: 420px; }
    .style-chips { grid-template-columns: repeat(4, 1fr); }
    .effects-toggles { grid-template-columns: repeat(4, 1fr); }
    .pixelart-params { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
    .hero-title { font-size: 1.8rem; }
    .hero-icon { font-size: 3rem; }
    .comparison-card { height: 380px; }
    .settings-body { padding: 18px; }
    .style-chips { grid-template-columns: repeat(3, 1fr); }
    .effects-toggles { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 576px) {
    .style-chips { grid-template-columns: repeat(2, 1fr); }
    .effects-toggles { grid-template-columns: repeat(3, 1fr); }
    .action-bar-inner { gap: 5px; }
    .action-btn { padding: 8px 10px; font-size: 0.8rem; }
    .action-btn-primary { padding: 10px 16px; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* === Animation === */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }