/*
Theme Name: Glafira Theme
Theme URI: https://otvet-dz.online
Author: Otvet-DZ Team
Version: 3.0
*/

/* ============================================
   ПЕРЕМЕННЫЕ - СВЕТЛАЯ ТЕМА
   ============================================ */
:root {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #A5B4FC;
    --primary-gradient: linear-gradient(135deg, #6366F1, #8B5CF6);
    
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-tertiary: #F1F5F9;
    
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    
    --border: #E2E8F0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    
    --radius: 16px;
    --radius-sm: 12px;
}

/* ============================================
   ТЕМНАЯ ТЕМА
   ============================================ */
.dark-mode {
    --primary: #818CF8;
    --primary-dark: #6366F1;
    --primary-light: #C7D2FE;
    
    --bg-primary: #1E293B;
    --bg-secondary: #0F172A;
    --bg-tertiary: #334155;
    
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
}

/* ============================================
   БАЗОВЫЕ СТИЛИ + FIXES ДЛЯ iOS
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    transform: translateZ(0);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo__icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.logo__text {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

.logo__text span {
    color: var(--primary);
}

.nav__menu {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav__menu a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.nav__menu a:hover,
.nav__menu a.active {
    color: var(--primary);
}

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

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-primary);
    transition: transform 0.2s;
}

.theme-toggle:hover {
    transform: scale(1.05);
}

.btn {
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn--primary {
    background: var(--primary-gradient);
    color: white;
}

.btn--primary:hover {
    transform: translateY(-2px);
}

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

.btn--outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn--block {
    width: 100%;
    justify-content: center;
}

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
}

/* ============================================
   MOBILE NAV
   ============================================ */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-primary);
    z-index: 1001;
    transition: right 0.3s;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.mobile-nav__close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-primary);
}

.mobile-nav__menu {
    list-style: none;
}

.mobile-nav__menu li {
    margin-bottom: 20px;
}

.mobile-nav__menu a {
    text-decoration: none;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 500;
}

.mobile-nav__actions {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   HERO
   ============================================ */
.hero {
    margin-top: 80px;
    min-height: -webkit-fill-available;
    position: relative;
}

.hero__slider {
    min-height: -webkit-fill-available;
    position: relative;
}

.hero__slide {
    min-height: 80vh;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
}

.hero__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.7), rgba(0,0,0,0.5));
}

.hero__content {
    position: relative;
    z-index: 2;
    color: white;
    max-width: 600px;
}

.hero__content h1 {
    font-size: 56px;
    font-weight: 800;
    margin-bottom: 20px;
}

.hero__content h1 span {
    color: #FCD34D;
}

.hero__content p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* Компактная поисковая строка */
.hero-search {
    display: flex;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 50px;
    padding: 4px;
    gap: 4px;
}

.hero-search input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    font-size: 16px;
    outline: none;
    background: transparent;
    color: #333;
    min-width: 0;
}

.hero-search button {
    padding: 12px 24px;
    background: #ffd700;
    border: none;
    border-radius: 50px;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    font-size: 15px;
    margin: 2px;
}

/* ============================================
   SUBJECTS & MATERIALS
   ============================================ */
.subjects, .materials {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
}

.section-header h2 span {
    color: var(--primary);
}

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

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.subject-card,
.material-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.2s;
    border: 1px solid var(--border);
    transform: translateZ(0);
    will-change: transform;
}

.subject-card:hover,
.material-card:hover {
    transform: translateY(-5px);
}

.subject-card__image {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subject-card__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    opacity: 0.85;
}

.subject-card__icon {
    position: relative;
    z-index: 2;
    font-size: 48px;
}

.subject-card__content {
    padding: 20px;
    text-align: center;
}

.subject-card__content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subject-card__content p {
    color: var(--text-muted);
    font-size: 14px;
}

.material-card__image {
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.material-type {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: white;
}

.material-card__content {
    padding: 20px;
}

.material-card__content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.4;
}

.material-meta {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.material-meta i {
    margin-right: 4px;
}

/* ============================================
   МОДАЛЬНЫЕ ОКНА
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.modal__content {
    position: relative;
    background: var(--bg-primary);
    border-radius: 24px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    animation: modalFadeIn 0.2s ease;
    box-shadow: var(--shadow-lg);
}

.modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal__content h2 {
    font-size: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-switch a {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

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

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: 30px 0;
    text-align: center;
    color: var(--text-muted);
    margin-top: 60px;
}

/* ============================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================ */
@media (max-width: 768px) {
    .nav, .header__actions {
        display: none;
    }
    
    .mobile-toggle {
        display: flex;
    }
    
    .hero__content h1 {
        font-size: 36px;
    }
    
    .section-header h2 {
        font-size: 28px;
    }
    
    .subjects-grid,
    .materials-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .subject-card:hover,
    .material-card:hover {
        transform: none;
    }
    
    .subject-card,
    .material-card,
    .btn {
        transition: none;
    }
    
    /* Адаптация поисковой строки */
    .hero-search {
        max-width: 420px;
        padding: 3px;
    }
    
    .hero-search input {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .hero-search button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .hero__content h1 {
        font-size: 28px;
    }
    
    .modal__content {
        padding: 30px 20px;
    }
    
    /* Компактная поисковая строка для iPhone */
    .hero-search {
        max-width: 340px;
        padding: 3px;
        gap: 3px;
    }
    
    .hero-search input {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .hero-search button {
        padding: 9px 18px;
        font-size: 13px;
    }
}

@media (max-width: 375px) {
    .hero-search {
        max-width: 290px;
        padding: 2px;
        gap: 2px;
    }
    
    .hero-search input {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .hero-search button {
        padding: 7px 14px;
        font-size: 12px;
    }
}

@media (max-width: 330px) {
    .hero-search button span {
        display: none;
    }
    
    .hero-search button::before {
        content: "🔍";
        font-size: 14px;
    }
    
    .hero-search button {
        padding: 8px 12px;
    }
}

/* ============================================
   ФИКСЫ ДЛЯ ТЁМНОЙ ТЕМЫ
   ============================================ */
.dark-mode .hero-search {
    background: #2d2d2d;
}

.dark-mode .hero-search input {
    background: transparent;
    color: #e0e0e0;
}

.dark-mode .hero-search input::placeholder {
    color: #888;
}

.dark-mode .hero-search button {
    background: #ffd700;
    color: #1e1e1e;
}

.dark-mode .subject-card {
    background: #1e1e1e;
    border-color: #334155;
}

.dark-mode .subject-card__content {
    background: #1e1e1e;
}

.dark-mode .subject-card__content h3 {
    color: #e0e0e0;
}

.dark-mode .subject-card__content p {
    color: #aaa;
}

.dark-mode .material-card {
    background: #1e1e1e;
    border-color: #334155;
}

.dark-mode .material-card__content {
    background: #1e1e1e;
}

.dark-mode .material-card__content h3 {
    color: #e0e0e0;
}

.dark-mode .material-meta {
    color: #aaa;
}

.dark-mode .modal__content {
    background: #1e1e1e;
}

.dark-mode .modal__content h2 {
    color: #e0e0e0;
}

.dark-mode .form-group input,
.dark-mode .form-group select,
.dark-mode .form-group textarea {
    background: #2d2d2d;
    color: #e0e0e0;
    border-color: #444;
}

.dark-mode .form-group input::placeholder,
.dark-mode .form-group textarea::placeholder {
    color: #888;
}

.dark-mode .header {
    background: #1e293b;
    border-bottom-color: #334155;
}

.dark-mode .logo__text {
    color: #e0e0e0;
}

.dark-mode .nav__menu a {
    color: #cbd5e1;
}

.dark-mode .nav__menu a:hover,
.dark-mode .nav__menu a.active {
    color: #818CF8;
}

.dark-mode .mobile-nav {
    background: #1e293b;
}

.dark-mode .mobile-nav__menu a {
    color: #e0e0e0;
}

.dark-mode .mobile-nav__close {
    color: #e0e0e0;
}

.dark-mode .btn--outline {
    border-color: #334155;
    color: #cbd5e1;
}

.dark-mode .btn--outline:hover {
    border-color: #818CF8;
    color: #818CF8;
}

.dark-mode .footer {
    background: #1e293b;
    border-top-color: #334155;
    color: #94A3B8;
}

.dark-mode .subjects,
.dark-mode .materials {
    background: #0F172A;
}

.dark-mode .section-header p {
    color: #94A3B8;
}

.dark-mode body {
    background: #0F172A;
}


