/* ============================================
   CONVERTIFY — Glassmorphism Design System
   ============================================ */

/* --- CSS Variables --- */
:root {
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-blur: 20px;
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --text-primary: #f0f0f0;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent: #6c63ff;
    --accent-light: #a78bfa;
    --success: #34d399;
    --error: #f87171;
    --info: #60a5fa;
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    color: var(--text-primary);
    background: linear-gradient(-45deg, #0f0c29, #302b63, #24243e, #1a1a2e, #16213e, #0f0c29);
    background-size: 400% 400%;
    animation: gradientBG 20s ease infinite;
    overflow-x: hidden;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    25% { background-position: 50% 100%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 50% 0%; }
    100% { background-position: 0% 50%; }
}

/* Floating orbs background decoration */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}
body::before {
    width: 600px;
    height: 600px;
    background: var(--accent);
    top: -200px;
    right: -200px;
    animation: floatOrb1 25s ease-in-out infinite;
}
body::after {
    width: 500px;
    height: 500px;
    background: #e040fb;
    bottom: -150px;
    left: -150px;
    animation: floatOrb2 30s ease-in-out infinite;
}

@keyframes floatOrb1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-100px, 100px); }
}
@keyframes floatOrb2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(80px, -80px); }
}

/* --- Glass Effect --- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius);
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
    50% { transform: scale(1.03); box-shadow: 0 0 20px 8px rgba(52, 211, 153, 0.2); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes borderDance {
    0% { background-position: 0 0, 100% 0, 100% 100%, 0 100%; }
    100% { background-position: 100% 0, 100% 100%, 0 100%, 0 0; }
}

@keyframes progressGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(108, 99, 255, 0.4); }
    50% { box-shadow: 0 0 20px rgba(108, 99, 255, 0.7); }
}

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

/* --- Header --- */
.header {
    text-align: center;
    padding: 40px 20px 10px;
    animation: fadeInUp 0.8s ease;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px rgba(108, 99, 255, 0.5));
}

.logo h1 {
    font-size: 2.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

/* --- Container --- */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Converter Card --- */
.converter-card {
    padding: 36px 32px;
    animation: fadeInUp 0.9s ease;
}

/* --- Format Row --- */
.format-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 28px;
}

.format-group {
    flex: 1;
}

.format-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.format-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.format-select:hover,
.format-select:focus {
    border-color: var(--accent);
    background-color: rgba(108, 99, 255, 0.1);
    box-shadow: 0 0 12px rgba(108, 99, 255, 0.15);
}

.format-select option,
.format-select optgroup {
    background: #1e1e3f;
    color: var(--text-primary);
}

.format-arrow {
    font-size: 1.5rem;
    color: var(--accent-light);
    padding-bottom: 10px;
    flex-shrink: 0;
}

/* --- Drop Zone --- */
.dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
}

.dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.05), rgba(224, 64, 251, 0.05));
    opacity: 0;
    transition: var(--transition);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    border-style: solid;
    background: rgba(108, 99, 255, 0.08);
}

.dropzone:hover::before,
.dropzone.dragover::before {
    opacity: 1;
}

.dropzone.dragover {
    animation: borderDance 2s linear infinite;
    background-image:
        linear-gradient(90deg, var(--accent) 50%, transparent 50%),
        linear-gradient(90deg, var(--accent) 50%, transparent 50%),
        linear-gradient(0deg, var(--accent) 50%, transparent 50%),
        linear-gradient(0deg, var(--accent) 50%, transparent 50%);
    background-size: 20px 2px, 20px 2px, 2px 20px, 2px 20px;
    background-position: 0 0, 100% 100%, 0 100%, 100% 0;
    background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
    border: none;
    padding: 50px 26px;
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.dropzone-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.dropzone-link {
    color: var(--accent-light);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.dropzone.has-file {
    border-color: var(--success);
    border-style: solid;
}

.dropzone.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* --- File Name --- */
.file-name {
    font-size: 0.85rem;
    color: var(--accent-light);
    min-height: 20px;
    margin-bottom: 20px;
    text-align: center;
    word-break: break-all;
}

/* --- Convert Button --- */
.btn-convert {
    display: block;
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-convert::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: var(--transition);
}

.btn-convert:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(108, 99, 255, 0.4);
}

.btn-convert:hover:not(:disabled)::after {
    opacity: 1;
}

.btn-convert:active:not(:disabled) {
    transform: translateY(0);
}

.btn-convert:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #444;
}

.btn-icon {
    margin-right: 6px;
}

/* --- Limit Counter --- */
.limit-counter {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 16px;
}

.limit-counter #limitRemaining {
    color: var(--accent-light);
    font-weight: 700;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

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

.modal-content {
    width: calc(100% - 40px);
    max-width: 420px;
    padding: 24px 22px;
    position: relative;
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Modal Close --- */
.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-close:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.modal-close:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* --- Modal Banner --- */
.modal-banner {
    display: block;
    text-decoration: none;
    margin-bottom: 24px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(224, 64, 251, 0.15));
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.modal-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.3);
    border-color: var(--accent);
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
}

.banner-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
}

.banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.banner-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

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

.banner-arrow {
    font-size: 1.5rem;
    color: var(--accent-light);
    flex-shrink: 0;
    transition: var(--transition);
}

.modal-banner:hover .banner-arrow {
    transform: translateX(4px);
}

/* --- Progress Bar --- */
.progress-section {
    margin-top: 12px;
    margin-bottom: 16px;
}

.progress-bar-container {
    width: 100%;
    height: 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #8b5cf6, #a78bfa);
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
    animation: progressGlow 2s ease-in-out infinite;
}

.progress-bar-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s ease-in-out infinite;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.85rem;
}

.progress-status {
    color: var(--text-secondary);
}

.progress-percent {
    color: var(--accent-light);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* --- Download Button --- */
.download-section {
    text-align: center;
}

.btn-download {
    display: inline-block;
    padding: 18px 48px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    animation: pulse 2s ease-in-out infinite;
    transition: var(--transition);
}

.btn-download:hover {
    box-shadow: 0 8px 28px rgba(52, 211, 153, 0.4);
    transform: translateY(-2px);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    max-width: 380px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    animation: slideInRight 0.4s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

.toast-error {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

.toast-success {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.3);
    color: #6ee7b7;
}

.toast-info {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.3);
    color: #93c5fd;
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ============================================
   SEO SECTIONS
   ============================================ */

/* --- Popular Conversions --- */
.popular-section {
    margin-top: 48px;
    animation: fadeInUp 1.1s ease;
}

.popular-section h2 {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #fff, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.popular-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    cursor: pointer;
    text-align: center;
}

.popular-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(108, 99, 255, 0.25);
}

.popular-from, .popular-to {
    font-weight: 700;
    font-size: 0.85rem;
}

.popular-from {
    color: var(--accent-light);
}

.popular-to {
    color: var(--success);
}

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

/* --- How To Section --- */
.howto-section {
    margin-top: 48px;
    animation: fadeInUp 1.2s ease;
}

.howto-section h2 {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #fff, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.howto-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.howto-step {
    padding: 28px 20px;
    text-align: center;
    position: relative;
    transition: var(--transition);
}

.howto-step:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.step-number {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.step-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    margin-top: 8px;
}

.howto-step h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.howto-step p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- FAQ Section --- */
.faq-section {
    margin-top: 48px;
    margin-bottom: 40px;
    animation: fadeInUp 1.3s ease;
}

.faq-section h2 {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #fff, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.faq-item {
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--accent);
}

.faq-question {
    width: 100%;
    padding: 18px 20px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.faq-chevron {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.faq-item.open .faq-chevron {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 20px;
}

.faq-item.open .faq-answer {
    max-height: 200px;
    padding: 0 20px 18px;
}

.faq-answer p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   IMAGE EDITOR
   ============================================ */

/* --- Editor Panel --- */
.editor-panel {
    margin-top: 16px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    animation: editorSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes editorSlideIn {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 1000px;
        transform: translateY(0);
    }
}

/* --- Editor Preview --- */
.editor-preview {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 200px;
    max-height: 400px;
}

#editorCanvas {
    max-width: 100%;
    max-height: 400px;
    display: block;
    border-radius: 4px;
    image-rendering: auto;
    touch-action: none;
}

/* --- Crop Overlay --- */
.crop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: crosshair;
    z-index: 10;
}

.crop-selection {
    position: absolute;
    border: 2px dashed var(--accent-light);
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
    min-width: 20px;
    min-height: 20px;
}

.crop-selection::after {
    content: '&#10003; Натисніть двічі для обрізки';
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--accent-light);
    white-space: nowrap;
    pointer-events: none;
}

/* --- File Info Card (non-images) --- */
.file-info-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px 24px;
    width: 100%;
}

.file-info-icon {
    font-size: 3rem;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 99, 255, 0.15);
    border-radius: 12px;
}

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

.file-info-name {
    font-weight: 600;
    font-size: 1rem;
    word-break: break-all;
}

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

.file-info-type {
    color: var(--accent-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Editor Toolbar --- */
.editor-toolbar {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Tool Buttons --- */
.tool-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tool-btn:hover {
    background: rgba(108, 99, 255, 0.2);
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(108, 99, 255, 0.15);
}

.tool-btn:active {
    transform: scale(0.96);
}

.tool-btn--accent {
    background: rgba(108, 99, 255, 0.15);
    border-color: rgba(108, 99, 255, 0.3);
    color: var(--accent-light);
}

.tool-btn--reset {
    margin-left: auto;
    color: var(--error);
    border-color: rgba(248, 113, 113, 0.2);
}

.tool-btn--reset:hover {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.4);
    box-shadow: none;
}

/* --- Sliders --- */
.toolbar-sliders {
    flex-direction: column;
    align-items: stretch;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-row label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 90px;
}

.slider-row input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(108, 99, 255, 0.4);
    transition: var(--transition);
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(108, 99, 255, 0.6);
}

.slider-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.slider-val {
    font-size: 0.75rem;
    color: var(--accent-light);
    min-width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* --- Filter Buttons --- */
.toolbar-filters {
    gap: 6px;
}

.filter-btn {
    padding: 6px 14px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.filter-btn.active {
    color: var(--accent-light);
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.15);
}

/* --- Resize Inputs --- */
.toolbar-resize {
    align-items: center;
}

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

.resize-input {
    width: 72px;
    padding: 6px 10px;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    outline: none;
    transition: var(--transition);
}

.resize-input:focus {
    border-color: var(--accent);
}

.resize-input::placeholder {
    color: var(--text-secondary);
}

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

.aspect-lock {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.aspect-lock input {
    display: none;
}

.aspect-lock span {
    opacity: 0.6;
    transition: var(--transition);
}

.aspect-lock input:checked + span {
    opacity: 1;
    color: var(--accent-light);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 24px 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 1.8rem;
    }

    .converter-card {
        padding: 28px 20px;
    }

    .format-row {
        flex-direction: column;
        gap: 12px;
    }

    .format-arrow {
        text-align: center;
        transform: rotate(90deg);
        padding: 0;
    }

    .popular-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .howto-steps {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .modal-content {
        width: calc(100% - 20px);
        max-width: 100%;
        padding: 28px 22px;
    }

    .toolbar-group {
        flex-wrap: wrap;
    }

    .toolbar-resize {
        flex-wrap: wrap;
    }

    .slider-row label {
        min-width: 70px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 24px 16px 8px;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .container {
        padding: 12px;
    }

    .converter-card {
        padding: 20px 16px;
    }

    .dropzone {
        padding: 32px 16px;
    }

    .dropzone-icon {
        font-size: 2.2rem;
    }

    .popular-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .popular-card {
        padding: 12px 8px;
        font-size: 0.8rem;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }

    .tool-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .filter-btn {
        padding: 10px 14px;
        font-size: 0.8rem;
    }

    .modal-overlay {
        padding: 10px;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        top: 8px;
        right: 8px;
    }

    .modal-content {
        width: calc(100% - 20px);
        max-width: 100%;
        padding: 20px 16px;
    }

    /* Slider thumb увеличен для touch */
    .slider-row input[type="range"]::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }

    .slider-row input[type="range"]::-moz-range-thumb {
        width: 22px;
        height: 22px;
    }

    .slider-row input[type="range"] {
        height: 8px;
    }

    .slider-row label {
        min-width: 50px;
        font-size: 0.72rem;
    }

    /* Editor compact */
    .editor-toolbar {
        padding: 12px 10px;
        gap: 10px;
    }

    .editor-preview {
        max-height: 280px;
        min-height: 140px;
    }

    .toolbar-resize {
        flex-wrap: wrap;
    }

    .resize-input {
        width: 60px;
    }

    .file-info-card {
        padding: 20px 16px;
        gap: 14px;
    }

    .file-info-icon {
        font-size: 2.2rem;
        width: 48px;
        height: 48px;
    }
}

/* --- Mobile editor & canvas fixes --- */
@media (max-width: 480px) {
    .editor-panel {
        margin-top: 10px;
        margin-bottom: 14px;
    }

    #editorCanvas {
        max-height: 250px;
        touch-action: none;
    }

    .crop-overlay {
        touch-action: none;
    }

    .crop-selection::after {
        display: none;
    }

    .toolbar-sliders {
        padding: 0 4px;
    }

    .toolbar-filters {
        justify-content: center;
    }

    .toolbar-resize label {
        width: 100%;
        margin-bottom: 4px;
    }
}

/* --- Ultra-small: 360px and below --- */
@media (max-width: 360px) {
    .logo h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .container {
        padding: 8px;
    }

    .converter-card {
        padding: 16px 12px;
    }

    .dropzone {
        padding: 24px 12px;
    }

    .dropzone-icon {
        font-size: 1.8rem;
    }

    .dropzone-text {
        font-size: 0.85rem;
    }

    .popular-grid {
        gap: 6px;
    }

    .popular-card {
        padding: 10px 6px;
        gap: 4px;
    }

    .popular-from, .popular-to {
        font-size: 0.75rem;
    }

    .popular-arrow {
        font-size: 0.65rem;
    }

    .popular-section h2,
    .howto-section h2,
    .faq-section h2 {
        font-size: 1.15rem;
    }

    .howto-step {
        padding: 20px 14px;
    }

    .howto-step h3 {
        font-size: 0.9rem;
    }

    .howto-step p {
        font-size: 0.75rem;
    }

    .faq-question {
        padding: 14px 16px;
        font-size: 0.85rem;
    }

    .faq-answer p {
        font-size: 0.8rem;
    }

    /* Editor ultra-compact */
    .toolbar-group {
        gap: 4px;
    }

    .tool-btn {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .toolbar-sliders {
        gap: 6px;
    }

    .slider-row label {
        min-width: 40px;
        font-size: 0.68rem;
    }

    .slider-val {
        font-size: 0.68rem;
        min-width: 22px;
    }

    .filter-btn {
        padding: 8px 10px;
        font-size: 0.72rem;
    }

    .resize-input {
        width: 52px;
        padding: 5px 8px;
        font-size: 0.8rem;
    }

    .editor-toolbar {
        padding: 10px 8px;
        gap: 8px;
    }

    .editor-preview {
        max-height: 220px;
        min-height: 120px;
    }

    .modal-content {
        width: calc(100% - 12px);
        padding: 16px 12px;
    }

    .btn-download {
        padding: 14px 28px;
        font-size: 0.95rem;
    }

    .btn-convert {
        padding: 14px 20px;
        font-size: 1rem;
    }

    .format-select {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .toast {
        padding: 10px 14px;
        font-size: 0.82rem;
    }
}
