/* === QR Generator specific styles === */

/* Type selector */
.type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.type-btn {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--dark);
    font-weight: 500;
}

.type-btn i {
    font-size: 1.8rem;
    color: var(--primary);
    transition: transform 0.3s;
}

.type-btn span {
    font-size: 0.85rem;
}

.type-btn:hover {
    background: #f3f4f6;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.type-btn:hover i {
    transform: scale(1.1);
}

.type-btn.active {
    background: var(--gradient);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 5px 15px rgba(102,126,234,0.3);
}

.type-btn.active i {
    color: white;
}

/* Color picker */
.color-picker-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-picker {
    width: 60px;
    height: 50px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    padding: 2px;
    background: white;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

.color-picker-wrapper .form-control {
    flex: 1;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

/* Preview panel */
.preview-panel {
    background: white;
    border-radius: 25px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.preview-header {
    padding: 25px 30px;
    background: var(--gradient);
    color: white;
}

.preview-header h3 {
    margin: 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-body {
    padding: 30px;
}

.qr-preview-empty {
    aspect-ratio: 1;
    background: #f9fafb;
    border: 3px dashed #cbd5e1;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    text-align: center;
    padding: 40px 20px;
}

.qr-preview-empty i {
    font-size: 5rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.qr-result {
    text-align: center;
}

.qr-result img {
    max-width: 100%;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    animation: scaleIn 0.4s ease;
}

/* Premium teaser */
.premium-teaser {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px dashed #f59e0b;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 30px 30px;
    position: relative;
}

.premium-badge {
    position: absolute;
    top: -12px;
    left: 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 4px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(245,158,11,0.4);
}

.premium-teaser h6 {
    margin: 10px 0 10px;
    color: #78350f;
    font-weight: 700;
}

.premium-teaser ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.premium-teaser li {
    padding: 4px 0;
    color: #92400e;
    font-size: 0.9rem;
}

/* Input groups */
.input-group-field {
    animation: fadeIn 0.3s ease;
}

.wifi-fields, .vcard-fields {
    display: grid;
    gap: 12px;
}

.wifi-fields {
    grid-template-columns: 2fr 2fr;
}

.vcard-fields {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
    .wifi-fields, .vcard-fields {
        grid-template-columns: 1fr;
    }
    
    .type-selector {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Form animations */
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* ================================ */
/* IMAGE OPTIMIZER - MODERN DESIGN  */
/* ================================ */

: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);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f9; 
    color: var(--dark);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* === Hero Section === */
.hero-section {
    background: var(--gradient);
    color: white;
    padding: 60px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.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: 5rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 1.3rem;
    opacity: 0.95;
    margin-bottom: 30px;
}

.hero-badges {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.badge-feature {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s;
}

.badge-feature:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-3px);
}

/* === Instructions === */
.instructions-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.instructions-toggle {
    padding: 20px 30px;
    cursor: pointer;
    background: white;
    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 30px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
}

.instructions-content.show {
    max-height: 2000px;
    padding: 20px 30px 30px;
}

.instruction-step {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 15px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.instruction-step:hover {
    background: #f3f4f6;
    transform: translateX(5px);
}

.step-number {
    width: 45px;
    height: 45px;
    background: var(--gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content h5 {
    margin: 0 0 8px;
    color: var(--dark);
}

.step-content p {
    margin: 0;
    color: #6b7280;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 15px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.feature-item i {
    font-size: 1.5rem;
    color: var(--primary);
}

/* === Upload Zone === */
.upload-zone-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.upload-zone {
    border: 3px dashed #cbd5e1;
    border-radius: 25px;
    padding: 60px 40px;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(102,126,234,0.05) 0%, rgba(118,75,162,0.05) 100%);
    transform: scale(1.01);
}

.upload-zone.dragover {
    border-style: solid;
    box-shadow: var(--shadow-lg);
}

.upload-icon {
    font-size: 5rem;
    color: var(--primary);
    margin-bottom: 20px;
    transition: transform 0.3s;
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
    transform: translateY(-10px) scale(1.1);
}

.upload-zone h3 {
    color: var(--dark);
    margin-bottom: 10px;
}

.upload-limits {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.limit-badge {
    background: #f3f4f6;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #6b7280;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* === Settings Panel === */
.settings-panel {
    background: white;
    border-radius: 25px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-header {
    padding: 25px 30px;
    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;
}

.settings-header .btn-link {
    color: white !important;
    text-decoration: none;
}

.settings-body {
    padding: 35px;
}

.setting-card {
    background: #f9fafb;
    padding: 25px;
    border-radius: 15px;
    height: 100%;
    transition: all 0.3s;
}

.setting-card:hover {
    background: #f3f4f6;
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}

.setting-label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--dark);
    font-size: 1.05rem;
}

.setting-label i {
    color: var(--primary);
    margin-right: 8px;
}

.form-select-lg, .form-control-lg {
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    padding: 12px 16px;
}

.form-select-lg:focus, .form-control-lg:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-range {
    height: 8px;
}

.form-range::-webkit-slider-thumb {
    background: var(--primary);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
}

.form-range::-webkit-slider-runnable-track {
    background: #e5e7eb;
    border-radius: 4px;
}

.quality-presets {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.quality-presets .btn {
    flex: 1;
    min-width: 80px;
}

/* === Optimize Button === */
.btn-optimize {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(102,126,234,0.4);
    transition: all 0.3s;
}

.btn-optimize:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102,126,234,0.5);
    color: white;
}

.btn-optimize:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* === Progress Section === */
.progress-section {
    max-width: 700px;
    margin: 0 auto;
}

.progress-card {
    background: white;
    border-radius: 25px;
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.animate-spin {
    animation: spin 2s linear infinite;
    color: var(--primary);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.progress {
    background: #e5e7eb;
    border-radius: 15px;
    overflow: hidden;
}

.progress-bar {
    background: var(--gradient);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Stats Card === */
.stats-card {
    background: white;
    border-radius: 25px;
    padding: 35px;
    box-shadow: var(--shadow-md);
}

.stat-item {
    padding: 20px;
    transition: all 0.3s;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-item.highlight {
    background: linear-gradient(135deg, rgba(16,185,129,0.1) 0%, rgba(5,150,105,0.1) 100%);
    border-radius: 15px;
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 5px;
}

.stat-label {
    color: #6b7280;
    font-size: 0.95rem;
}

/* === Files List === */
/* === Files List - Grid Layout === */
.files-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.file-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    animation: fadeIn 0.5s ease;
}

.file-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* Превью сверху */
.file-preview {
    width: 100%;
    aspect-ratio: 4/3;
    position: relative;
    cursor: pointer;
    background: #f3f4f6;
    overflow: hidden;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.file-preview:hover img {
    transform: scale(1.05);
}

.file-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
}

.file-preview:hover .file-preview-overlay {
    opacity: 1;
}

/* Информация под превью */
.file-info {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 600;
    margin-bottom: 10px;
    word-break: break-word;
    color: var(--dark);
    font-size: 0.95rem;
    line-height: 1.3;
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.82rem;
    color: #6b7280;
}

.file-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.savings-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(16,185,129,0.15) 0%, rgba(5,150,105,0.15) 100%);
    color: var(--success);
    margin-bottom: 12px;
    text-align: center;
}

/* Кнопки внизу */
.file-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding: 0 16px 16px;
}

.btn-download, .btn-compare {
    flex: 1;
    padding: 9px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
}

.btn-download {
    background: var(--gradient-success);
    color: white;
    border: none;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16,185,129,0.4);
    color: white;
}

.btn-compare {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-compare:hover {
    background: var(--primary);
    color: white;
}

/* === Адаптивность для grid === */
@media (max-width: 1200px) {
    .files-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .files-list {
        grid-template-columns: 1fr;
    }
    
    .file-preview {
        aspect-ratio: 16/9;
    }
}


/* === Action Buttons === */
.action-buttons {
    padding: 30px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.action-buttons .btn {
    border-radius: 50px;
    padding: 14px 30px;
    font-weight: 600;
}

.action-buttons .btn-success {
    background: var(--gradient-success);
    border: none;
    box-shadow: 0 10px 30px rgba(16,185,129,0.3);
}

/* === Compare Modal === */
.compare-container {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    border-radius: 15px;
    background: #000;
}

.compare-slider {
    position: relative;
    width: 100%;
    user-select: none;
}

.compare-image {
    display: block;
    width: 100%;
    height: auto;
}

.compare-after-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
}

.compare-after-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === НОВОЕ: Отдельная линия разделения === */
.compare-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    background: white;
    z-index: 9;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* === Ручка ползунка === */
.compare-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ew-resize;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    z-index: 10;
    color: var(--primary);
    font-size: 1.4rem;
    transition: transform 0.1s;
}

.compare-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.compare-handle:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Убираем старый псевдоэлемент с линией */
.compare-handle::before {
    display: none;
}

/* === Footer === */
.site-footer {
    background: var(--dark);
    color: white;
    padding: 30px 0;
    margin-top: 60px;
}

.site-footer a {
    color: #60a5fa;
}

/* === 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;
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.cookie-icon {
    font-size: 2rem;
}

.cookie-text {
    flex: 1;
    min-width: 200px;
}

.cookie-btn {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
}

/* === Responsive === */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    .hero-subtitle {
        font-size: 1rem;
    }
    .hero-icon {
        font-size: 3.5rem;
    }
    .file-card {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .file-preview {
        margin: 0 auto;
    }
    .file-actions {
        flex-direction: row;
        justify-content: center;
    }
    .settings-body {
        padding: 20px;
    }
    .stat-value {
        font-size: 1.5rem;
    }
}

/* === Animations === */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.scale-in {
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* === Form Switch === */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    font-weight: 500;
}

/* === 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);
}

/* === Selected Files Preview === */
.selected-files-preview {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.4s ease;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-header h4 {
    margin: 0;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-header h4 i {
    color: var(--primary);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.preview-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f4f6;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.preview-thumb:hover {
    transform: scale(1.05);
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-thumb-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 20px 8px 8px;
    color: white;
    font-size: 0.75rem;
}

.preview-thumb-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.preview-thumb-size {
    opacity: 0.9;
    margin-top: 2px;
}