/* ═══════════════════════════════════════════
   FileTools.ru — v8 Visual Upgrade
   ═══════════════════════════════════════════ */

:root {
    --bg: #f0f4f8;
    --bg-card: #ffffff;
    --bg-dark: #0f172a;
    --text: #1e293b;
    --text-light: #64748b;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --border: #e2e8f0;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
    --font: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.2s ease;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ─── Header ─── */
.header {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.3s;
}
.header.scrolled { box-shadow: 0 2px 20px rgba(0,0,0,0.08); }
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.logo {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--text);
    font-weight: 800; font-size: 1.25rem;
}
.logo-icon { font-size: 1.4rem; }
.logo-dot { color: var(--primary); }

/* Nav */
.nav { display: flex; align-items: center; gap: 2px; }
.nav-link {
    text-decoration: none; color: var(--text-light);
    font-weight: 600; font-size: 0.85rem;
    padding: 7px 14px; border-radius: var(--radius-sm);
    transition: var(--transition); white-space: nowrap;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.nav-dropdown { position: relative; }
.nav-dropdown-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 7px 14px; font-size: 0.85rem; font-weight: 600;
    color: var(--text-light); cursor: pointer; border: none;
    background: none; font-family: var(--font); border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav-dropdown-btn:hover { color: var(--primary); background: var(--primary-light); }
.nav-dropdown-menu {
    display: none; position: absolute; top: calc(100% + 4px); right: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 6px 0; min-width: 200px; z-index: 200;
    animation: fadeInUp 0.15s ease-out;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block; padding: 9px 18px; font-size: 0.88rem;
    font-weight: 600; color: var(--text); text-decoration: none;
    transition: var(--transition);
}
.nav-dropdown-menu a:hover { background: var(--primary-light); color: var(--primary); }
.menu-btn {
    display: none; background: none; border: none;
    font-size: 1.5rem; cursor: pointer; color: var(--text);
}

/* ─── Content Grid ─── */
.main { flex: 1; padding: 28px 0; }
.content-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 28px;
    align-items: start;
}
.content-main { min-width: 0; }

/* ─── Sidebar ─── */
.sidebar { position: sticky; top: 76px; }
.sidebar-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.sidebar-box h3 { font-size: 0.92rem; font-weight: 700; margin-bottom: 12px; }
.sidebar-link {
    display: block; padding: 8px 0;
    text-decoration: none; color: var(--text-light);
    font-size: 0.86rem; font-weight: 600;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.sidebar-link:last-child { border-bottom: none; }
.sidebar-link:hover { color: var(--primary); padding-left: 6px; }

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

/* ─── Hero ─── */
.hero {
    text-align: center;
    padding: 52px 0 44px;
}
.hero h1 {
    font-size: 2.5rem; font-weight: 800; line-height: 1.15;
    margin-bottom: 14px; animation: fadeInUp 0.6s ease-out;
}
.hero h1 .highlight {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: 1.1rem; color: var(--text-light);
    max-width: 560px; margin: 0 auto 28px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}
.hero .stats {
    display: flex; justify-content: center; gap: 36px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}
.hero .stat-item { text-align: center; }
.hero .stat-num { font-size: 1.7rem; font-weight: 800; color: var(--primary); }
.hero .stat-label { font-size: 0.82rem; color: var(--text-light); margin-top: 2px; }

/* ─── Tool Cards ─── */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}
.tool-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none; color: var(--text);
    transition: all 0.25s ease;
    animation: fadeInUp 0.4s ease-out both;
    opacity: 0;
}
.tools-grid .tool-card:nth-child(1) { animation-delay: 0.03s; }
.tools-grid .tool-card:nth-child(2) { animation-delay: 0.06s; }
.tools-grid .tool-card:nth-child(3) { animation-delay: 0.09s; }
.tools-grid .tool-card:nth-child(4) { animation-delay: 0.12s; }
.tools-grid .tool-card:nth-child(5) { animation-delay: 0.15s; }
.tools-grid .tool-card:nth-child(n+6) { animation-delay: 0.18s; }
.tool-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.tool-card:hover .tool-icon { transform: scale(1.15); }
.tool-card .tool-icon { font-size: 1.7rem; flex-shrink: 0; transition: transform 0.2s; }
.tool-card .tool-name { font-weight: 700; font-size: 0.93rem; }
.tool-card .tool-desc { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }

/* ─── Category ─── */
.category-section { margin-bottom: 36px; }
.category-title {
    font-size: 1.25rem; font-weight: 800;
    margin-bottom: 14px; padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
    display: flex; align-items: center; gap: 8px;
}

/* ─── Tool Page ─── */
.tool-header { text-align: center; margin-bottom: 28px; }
.tool-header h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 8px; }
.tool-header p { color: var(--text-light); font-size: 1rem; }

/* ─── Upload Area ─── */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fafbff 0%, #f0f4f8 100%);
}
.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.12);
}
.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.01);
}
.upload-area .icon { font-size: 2.8rem; margin-bottom: 10px; }
.upload-area .label { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.upload-area .hint { font-size: 0.85rem; color: var(--text-light); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 24px; border: none; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 0.95rem; font-weight: 700;
    cursor: pointer; transition: all 0.25s ease; text-decoration: none;
}
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79,70,229,0.35); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(16,185,129,0.3); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Progress ─── */
.progress-bar {
    width: 100%; height: 5px; background: var(--border);
    border-radius: 3px; overflow: hidden; margin: 16px 0; display: none;
}
.progress-bar .fill {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), #7c3aed, var(--primary));
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
    box-shadow: 0 0 8px rgba(79,70,229,0.4);
    transition: width 0.3s; width: 0%;
}

/* ─── Result ─── */
.result { display: none; text-align: center; padding: 28px; }
.result.show { display: block; animation: fadeInUp 0.5s ease-out; }
.result .success-icon { font-size: 2.8rem; margin-bottom: 10px; }
.result .filename { font-weight: 700; margin-bottom: 14px; }

/* ─── Preview ─── */
.preview-container { margin: 16px 0; text-align: center; animation: fadeIn 0.3s ease-out; }
.preview-container img {
    max-width: 100%; max-height: 280px;
    border-radius: var(--radius); border: 1px solid var(--border);
    box-shadow: var(--shadow); object-fit: contain;
}
.preview-info { margin-top: 6px; font-size: 0.83rem; color: var(--text-light); }

/* ─── Breadcrumbs ─── */
.breadcrumbs { padding: 10px 0; font-size: 0.83rem; }
.breadcrumbs a { color: var(--text-light); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { color: var(--text-light); margin: 0 6px; }

/* ─── FAQ ─── */
.faq { margin-top: 36px; }
.faq h2 { font-size: 1.2rem; margin-bottom: 14px; }
.faq-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq-q {
    font-weight: 700; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
}
.faq-q::after { content: "+"; font-size: 1.2rem; color: var(--text-light); transition: var(--transition); }
.faq-item.open .faq-q::after { content: "−"; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; color: var(--text-light); line-height: 1.7; }
.faq-item.open .faq-a { max-height: 300px; padding-top: 8px; }

/* ─── SEO text ─── */
.seo-text {
    margin-top: 36px; padding: 22px;
    background: var(--bg); border-radius: var(--radius);
    color: var(--text-light); font-size: 0.9rem; line-height: 1.8;
}
.seo-text h2 { color: var(--text); font-size: 1.1rem; margin-bottom: 10px; }

/* ─── Ad blocks ─── */
.ad-block { margin-bottom: 20px; min-height: 90px; }

/* ─── Footer ─── */
.footer {
    background: var(--bg-dark); color: #cbd5e1;
    padding: 36px 0 20px; margin-top: auto;
}
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.footer-col h4 { color: #fff; margin-bottom: 10px; font-size: 0.92rem; }
.footer-col a {
    display: block; color: #94a3b8; text-decoration: none;
    font-size: 0.86rem; padding: 3px 0; transition: var(--transition);
}
.footer-col a:hover { color: #fff; }
.footer-col p { font-size: 0.86rem; margin-top: 8px; }
.footer-bottom {
    grid-column: 1 / -1; border-top: 1px solid #334155;
    padding-top: 16px; margin-top: 16px;
    font-size: 0.8rem; color: #64748b;
}

/* ─── Spinner ─── */
.spinner {
    display: none; width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 16px auto;
}

/* ─── Filter buttons ─── */
.ratio-btn {
    display: inline-flex; align-items: center;
    padding: 9px 18px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); font-weight: 700; font-size: 0.88rem;
    cursor: pointer; transition: var(--transition);
    background: var(--bg-card); color: var(--text); user-select: none;
}
.ratio-btn:hover { border-color: var(--primary); color: var(--primary); }
.ratio-btn.active { background: var(--gradient); color: #fff; border-color: transparent; }

/* ─── Stat boxes ─── */
.stat-box {
    background: var(--bg); padding: 14px 18px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    text-align: center; min-width: 90px;
}
.stat-box-num { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.stat-box-label { font-size: 0.78rem; color: var(--text-light); margin-top: 3px; }

/* ─── Payment Modal ─── */
.payment-modal {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999; align-items: center; justify-content: center;
}
.payment-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
}
.payment-box {
    position: relative; background: var(--bg-card);
    border-radius: 18px; padding: 36px 28px;
    max-width: 480px; width: 90%; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25); z-index: 1;
    animation: fadeInUp 0.3s ease-out;
}
.payment-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; font-size: 1.4rem;
    cursor: pointer; color: var(--text-light);
}
.payment-icon { font-size: 2.8rem; margin-bottom: 10px; }
.payment-box h2 { font-size: 1.4rem; margin-bottom: 6px; }
.payment-box > p { color: var(--text-light); margin-bottom: 20px; font-size: 0.92rem; }
.payment-plans { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.plan {
    border: 2px solid var(--border); border-radius: var(--radius);
    padding: 22px 18px; cursor: pointer; transition: all 0.25s ease;
    flex: 1; min-width: 170px; position: relative;
}
.plan:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.plan.popular { border-color: var(--primary); background: var(--primary-light); }
.plan-badge {
    position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
    background: var(--gradient); color: #fff;
    font-size: 0.72rem; font-weight: 700; padding: 2px 12px; border-radius: 10px;
}
.plan-price { font-size: 1.7rem; font-weight: 800; color: var(--primary); }
.plan-name { font-weight: 700; margin: 3px 0; font-size: 0.92rem; }
.plan-desc { font-size: 0.82rem; color: var(--text-light); }

/* ─── Animations ─── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.main { animation: fadeIn 0.25s ease-out; }
.result.show .download-btn { animation: fadeInUp 0.4s ease 0.2s both; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .content-grid { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .footer-inner { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.7rem; }
    .hero .stats { gap: 16px; }
    .tools-grid { grid-template-columns: 1fr 1fr; }
    .nav {
        display: none; flex-direction: column;
        position: absolute; top: 60px; left: 0; right: 0;
        background: var(--bg-card); border-bottom: 1px solid var(--border);
        padding: 12px; box-shadow: var(--shadow-lg);
    }
    .nav.open { display: flex; }
    .nav-dropdown-menu { position: static; box-shadow: none; border: none; padding: 0 0 0 16px; }
    .nav-dropdown:hover .nav-dropdown-menu { display: block; }
    .menu-btn { display: block; }
    .hide-mobile { display: none; }
    .card { padding: 20px; }
    .nav-sep { display: none; }
}
@media (max-width: 480px) {
    .tools-grid { grid-template-columns: 1fr; }
    .upload-area { padding: 28px 16px; }
    .payment-plans { flex-direction: column; }
}
