/* ============================================
   GLOBAL CSS
   Общие стили для всех страниц сайта
   - CSS Variables (цвета, шрифты, отступы)
   - Reset / Normalize
   - Typography
   - Buttons
   - Header & Navigation
   - Footer
   - Newsletter
   - Toast Notifications
   - FAQ (Accordion)
   - How-it-works (Steps)
   - Tools Grid (карточки инструментов)
   ============================================ */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    /* Brand Colors */
    --color-primary: #00f0ff;
    --color-secondary: #7b2ff7;
    --color-accent: #ff2d95;
    
    /* Backgrounds */
    --bg-dark: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-glass: rgba(20, 20, 35, 0.8);
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    
    /* Borders */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 240, 255, 0.3);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #7b2ff7 0%, #00f0ff 100%);
    --gradient-glow: linear-gradient(135deg, rgba(123, 47, 247, 0.4) 0%, rgba(0, 240, 255, 0.4) 100%);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 64px;
    --space-3xl: 96px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;
    --font-size-3xl: 48px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;
}

/* ============================================
   RESET / NORMALIZE
   ============================================ */

[hidden] {
    display: none !important;
}

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

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   UTILITIES
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--text-primary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

/* ============================================
   BUTTONS (глобальные)
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

.btn--primary {
    background: var(--gradient-primary);
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.25);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 240, 255, 0.4);
}

.btn--outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn--outline:hover {
    border-color: var(--color-primary);
    background: rgba(0, 240, 255, 0.05);
    color: var(--color-primary);
}

.btn--small {
    padding: 8px 16px;
    font-size: var(--font-size-sm);
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: var(--space-md) 0;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    transition: box-shadow var(--transition-base);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-primary);
}

.logo__text {
    font-size: var(--font-size-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav__list {
    display: flex;
    gap: var(--space-xl);
}

.nav__link {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
}

.nav__link:hover {
    color: var(--text-primary);
}

.nav__link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-base);
    border-radius: 1px;
}

.nav__link:hover::after {
    width: 100%;
}

/* ============================================
   SECTION HEADINGS (общие)
   ============================================ */
.section__title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

.section__subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
    font-size: var(--font-size-base);
}

/* ============================================
   TOOLS GRID (карточки инструментов)
   ============================================ */
.tools {
    padding: var(--space-3xl) 0;
}

.tools__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.tool-card {
    position: relative;
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.tool-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 240, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card__icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
    background: rgba(0, 240, 255, 0.1);
    color: var(--color-primary);
}

.tool-card__icon--convert { background: rgba(123, 47, 247, 0.15); color: #a855f7; }
.tool-card__icon--desaturate { background: rgba(255, 255, 255, 0.08); color: #e0e0e0; }
.tool-card__icon--resize { background: rgba(0, 240, 255, 0.1); color: var(--color-primary); }
.tool-card__icon--improvement { background: rgba(255, 214, 0, 0.1); color: #ffd600; }
.tool-card__icon--watermark { background: rgba(255, 45, 149, 0.1); color: var(--color-accent); }

.tool-card__title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.tool-card__link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.tool-card__link:hover {
    color: var(--color-primary);
}

.tool-card__desc {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* ============================================
   HOW IT WORKS (Steps)
   ============================================ */
.how-it-works {
    padding: var(--space-3xl) 0;
    background: linear-gradient(180deg, transparent 0%, rgba(123, 47, 247, 0.03) 100%);
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-xl);
    margin-top: var(--space-xl);
}

.step {
    text-align: center;
    padding: var(--space-lg);
    position: relative;
}

.step__number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--text-primary);
    font-size: var(--font-size-xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.3);
}

.step__title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.step__desc {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* ============================================
   FAQ (Accordion)
   ============================================ */
.seo-text {
    padding: var(--space-3xl) 0;
}

.faq {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.faq__item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    overflow: hidden;
    transition: border-color var(--transition-base);
}

.faq__item[open] {
    border-color: rgba(0, 240, 255, 0.2);
}

.faq__question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    cursor: pointer;
    list-style: none;
    font-weight: 500;
    transition: background var(--transition-fast);
}

.faq__question::-webkit-details-marker {
    display: none;
}

.faq__question:hover {
    background: var(--bg-card-hover);
}

.faq__question h3 {
    font-size: var(--font-size-base);
    font-weight: 600;
    flex: 1;
    padding-right: var(--space-md);
}

.faq__chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform var(--transition-base);
}

.faq__item[open] .faq__chevron {
    transform: rotate(180deg);
    color: var(--color-primary);
}

.faq__answer {
    padding: 0 var(--space-lg) var(--space-lg);
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: var(--font-size-sm);
    animation: slideDown 0.3s ease;
}

.faq__answer a {
    color: var(--color-primary);
    text-decoration: underline;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   NEWSLETTER
   ============================================ */
.newsletter {
    padding: var(--space-3xl) 0;
}

.newsletter__card {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-2xl);
    border-radius: var(--radius-xl);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    text-align: center;
    overflow: hidden;
    transition: all var(--transition-slow);
}

.newsletter__glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(0, 240, 255, 0.05), transparent, rgba(123, 47, 247, 0.05), transparent);
    animation: rotate 20s linear infinite;
    pointer-events: none;
}

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

.newsletter__title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--space-sm);
    position: relative;
}

.newsletter__subtitle {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    font-size: var(--font-size-sm);
    position: relative;
}

.newsletter__form {
    position: relative;
}

.newsletter__input-group {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.newsletter__input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
    transition: border-color var(--transition-fast);
}

.newsletter__input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

.newsletter__input::placeholder {
    color: var(--text-muted);
}

.newsletter__help {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

/* Checkbox */
.checkbox {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox__mark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    position: relative;
    margin-top: 2px;
}

.checkbox input:checked + .checkbox__mark {
    background: var(--gradient-primary);
    border-color: transparent;
}

.checkbox input:checked + .checkbox__mark::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox__label a {
    color: var(--color-primary);
    text-decoration: underline;
}

/* Newsletter Success */
.newsletter__success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    color: var(--color-primary);
    animation: fadeIn 0.5s ease;
}

.newsletter__success h3 {
    color: var(--text-primary);
    font-size: var(--font-size-xl);
}

.newsletter__success p {
    color: var(--text-secondary);
}

/* Fade out animation for form */
.newsletter__form--hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    position: absolute;
    width: 100%;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    padding: var(--space-2xl) 0 var(--space-lg);
    border-top: 1px solid var(--border-color);
    background: rgba(5, 5, 10, 0.5);
}

.footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.footer__tagline {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-top: var(--space-md);
    max-width: 300px;
}

.footer__heading {
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.footer__links ul {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer__links a {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast);
}

.footer__links a:hover {
    color: var(--color-primary);
}

.footer__bottom {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer__bottom p {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: toastIn 0.3s ease;
    pointer-events: auto;
    max-width: 360px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.toast--error {
    border-color: rgba(255, 59, 48, 0.3);
}

.toast--success {
    border-color: rgba(52, 199, 89, 0.3);
}

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

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

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   RESPONSIVE - MOBILE FIRST
   ============================================ */
@media (max-width: 480px) {
    :root {
        --space-lg: 16px;
        --space-xl: 24px;
        --space-2xl: 40px;
        --space-3xl: 64px;
    }
    
    .newsletter__input-group {
        flex-direction: column;
    }
    
    .newsletter__btn {
        width: 100%;
        justify-content: center;
    }
    
    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
        bottom: var(--space-md);
    }
    
    .toast {
        max-width: 100%;
    }
}

@media (min-width: 768px) {
    .tools__grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .steps {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .tools__grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .footer__grid {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
}

@media (min-width: 2560px) {
    html {
        font-size: 20px;
    }
    
    .container {
        max-width: 1600px;
    }
}

@media (max-width: 600px) {
    .nav__list {
        gap: var(--space-md);
    }
    
    .nav__link {
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}