/* ================================================
   IQ Test Website - Modern Redesign
   Clean, professional, smooth animations
   ================================================ */

/* CSS Variables for consistent theming */
:root {
    --primary: #E8A849;
    --primary-dark: #D4942E;
    --primary-light: #F5C97A;
    --accent: #FF8C00;
    --bg-dark: #1E2328;
    --bg-card: #2A3038;
    --bg-light: #F8F9FA;
    --text-gold: #DCBE96;
    --text-light: #F5F5F5;
    --text-muted: #A0A8B0;
    --text-dark: #2D3436;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 12px 40px rgba(232, 168, 73, 0.2);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-dark);
    background: linear-gradient(135deg, #FAFBFC 0%, #F0F2F5 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================================
   FIX: Remove white line above header
   ================================================ */
header {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

header .navbar {
    margin: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border: none;
}

/* Keep only logo and title visible */
.navbar-brand,
.head {
    display: flex !important;
}

/* Hide carousel controls */
.carousel-control-prev,
.carousel-control-next,
.carousel-indicators {
    display: none !important;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-dark);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h4 { font-size: clamp(1.1rem, 2vw, 1.25rem); }

p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ================================================
   HEADER
   ================================================ */
header {
    width: 100%;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

header .navbar {
    margin: 0;
    padding: 0.75rem 0;
    border: none;
}

/* Main header container - align logo and title */
header .container-md {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo */
.navbar-brand {
    display: flex !important;
    align-items: center;
    margin: 0;
    padding: 0;
}

.logo {
    width: 80px;
    height: auto;
    transition: var(--transition-smooth);
}

.logo:hover {
    transform: scale(1.05);
}

@media (max-width: 767px) {
    .logo {
        width: 50px;
    }
}

/* Title container */
.head {
    color: var(--text-gold);
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    flex: 1;
}

.head .title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-gold);
}

@media (max-width: 767px) {
    .head .title {
        font-size: 1.2rem;
    }
}

/* Hide carousel controls */
.carousel-control-prev,
.carousel-control-next,
.carousel-indicators {
    display: none !important;
}

/* ================================================
   MAIN CONTENT
   ================================================ */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    gap: 3rem;
}

/* ================================================
   HERO QUOTE SECTION
   ================================================ */
.quote {
    width: 100%;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-card) 100%);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--text-light);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.quote::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.span_h {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--text-gold);
}

/* ================================================
   CARDS & SECTIONS
   ================================================ */
.row {
    width: 100%;
}

section {
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    transition: var(--transition-smooth);
}

section:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

section h1, section h2, section h3, section h4 {
    margin-bottom: 1.25rem;
    position: relative;
    display: inline-block;
}

section h1::after, section h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    border-radius: 2px;
}

/* Info Cards Grid */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.info-card {
    background: linear-gradient(135deg, #fff 0%, #F8F9FA 100%);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.info-card img {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: var(--transition-bounce);
}

.info-card:hover img {
    transform: scale(1.1) rotate(-5deg);
}

.info-card .fw-semibold {
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 600;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn-secondary,
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-secondary::before,
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition-smooth);
}

.btn-secondary:hover,
.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 140, 0, 0.35);
}

.btn-secondary:hover::before,
.btn-primary:hover::before {
    left: 100%;
}

.btn-secondary:active,
.btn-primary:active {
    transform: translateY(-1px);
}

.btn-lg {
    padding: 1.1rem 3rem;
    font-size: 1.1rem;
}

/* ================================================
   ACCORDION
   ================================================ */
.accordion {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.accordion-item {
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-button {
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    background: #fff;
    color: var(--text-dark);
    transition: var(--transition-fast);
}

.accordion-button:not(.collapsed) {
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary-dark) 100%);
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

.accordion-button::after {
    transition: var(--transition-smooth);
}

.accordion-body {
    padding: 1.5rem;
    background: #FAFBFC;
    color: var(--text-muted);
    line-height: 1.8;
    border-top: none;
}

/* ================================================
   CONTENT LISTS (Tips, How-to sections)
   ================================================ */
section ul, section ol {
    list-style: none;
    padding-left: 0;
}

section li {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

section li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6rem;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

section h3 {
    margin-top: 1.5rem;
    color: var(--text-dark);
}

section h3 + ul {
    margin-top: 0.75rem;
}

/* ================================================
   CHARTS SECTION
   ================================================ */
.chart-container {
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    margin: 1rem 0;
}

.chart-title {
    text-align: center;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

canvas {
    max-width: 100%;
}

/* ================================================
   TEST INTERFACE - Modern Style
   ================================================ */
.test {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    margin-bottom: 2rem;
}

.test h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    text-align: center;
}

.test h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 1.5rem;
}

.q_number {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.3rem;
}

/* Question Image - SMALLER */
.img_question {
    width: 100%;
    max-width: 280px;
    height: auto;
}

.image_div {
    min-height: 200px;
}

/* Answer Options - specific to test form */
.answers {
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

#form_test .radio_label img {
    width: 110px;
    height: 110px;
    margin: 8px;
    padding: 10px;
    background: #fff;
    border: 2px solid #E0E4E8;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

#form_test .radio_label:hover img {
    border-color: #ccc;
    cursor: pointer;
}

.radio {
    display: none;
}

/* Timer - Modern Style */
.timer {
    height: auto;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-card) 100%);
    color: var(--text-gold);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-align: center;
    letter-spacing: 0.5px;
}

/* Mobile Styles */
@media (max-width: 767px) {
    .test {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }
    
    .test h1 {
        font-size: 1.4rem;
    }
    
    .img_question {
        max-width: 100%;
    }
    
    .image_div {
        min-height: 180px;
    }
    
    #form_test .radio_label img {
        width: 80px;
        height: 80px;
        margin: 8px;
        padding: 6px;
    }
    
    .timer {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* Finish Form */
.finish_input {
    width: 15rem;
}

.finish_label {
    padding: .375rem .75rem;
}

.finish_button {
    width: 15rem;
}

/* ================================================
   FEEDBACK
   ================================================ */
.feedback_textarea {
    width: 100%;
    max-width: 500px;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid #E0E4E8;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition-fast);
}

.feedback_textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(232, 168, 73, 0.15);
}

/* ================================================
   LANGUAGE BUTTON
   ================================================ */
.lang_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.lang_button:hover {
    background: rgba(232, 168, 73, 0.1);
    border-color: var(--primary-light);
}

.lang_button img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

/* ================================================
   PRIVACY PAGE
   ================================================ */
.privacy {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.privacy h1 {
    text-align: center;
    margin: 2rem 0 3rem;
}

.privacy h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 2rem;
}

.privacy h3 {
    font-size: 1.15rem;
    font-weight: 500;
}

.privacy ol {
    counter-reset: num;
    padding-left: 2.5rem;
}

.privacy ol > li {
    margin-top: 2rem;
    position: relative;
}

.privacy ol > li::before {
    counter-increment: num;
    content: counter(num) ".";
    position: absolute;
    left: -2.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

/* ================================================
   LOADER
   ================================================ */
.loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #E0E4E8;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================================
   MOBILE REORDERING
   ================================================ */
.min-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Desktop - "О нашем тесте" first */
.num_1 {
    order: 2;
}

.num_2 {
    order: 1;
}

/* Mobile - same order */
@media (max-width: 768px) {
    .min-container {
        flex-direction: column;
    }

    .num_1 {
        order: 2;
    }

    .num_2 {
        order: 1;
    }

    main {
        padding: 1.5rem 1rem 3rem;
        gap: 2rem;
    }

    section {
        padding: 1.5rem;
    }

    .quote {
        padding: 2rem 1.5rem;
    }
}

/* ================================================
   ANIMATIONS
   ================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.6s ease-out forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* ================================================
   UTILITIES
   ================================================ */
.text-center { text-align: center; }
.text-gold { color: var(--text-gold); }
.text-accent { color: var(--accent); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-block { display: block; }
.d-flex { display: flex; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ================================================
   LANDING PAGE - Language Selection
   ================================================ */
.landing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.landing-hero {
    text-align: center;
    margin-bottom: 3rem;
}

.landing-hero .hero-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 24px rgba(255, 140, 0, 0.3);
}

.landing-hero .hero-icon svg {
    width: 36px;
    height: 36px;
    color: #fff;
}

.landing-hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.landing-hero p {
    font-size: 1.0625rem;
    color: #6B7280;
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.5;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    text-align: center;
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    width: 100%;
}

.language-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 1.25rem 0.75rem;
    text-decoration: none;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.language-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.language-card .flag {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.language-card .flag svg {
    width: 100%;
    height: 100%;
}

.language-card .lang-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-dark);
    margin-bottom: 0.125rem;
}

.language-card .lang-native {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
    .language-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 600px) {
    .landing-page {
        padding: 2rem 1rem;
    }
    
    .landing-hero h1 {
        font-size: 1.75rem;
    }
    
    .landing-hero p {
        font-size: 1rem;
    }
    
    .language-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    .language-card {
        padding: 1rem 0.5rem;
    }
    
    .language-card .flag {
        width: 40px;
        height: 30px;
    }
    
    .language-card .lang-name {
        font-size: 0.8rem;
    }
    
    .language-card .lang-native {
        font-size: 0.7rem;
    }
}

@media (max-width: 400px) {
    .language-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}