/* ===== CSS RESET & VARIABLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Брендовые цвета (не меняются от темы) */
    --primary: #FF6B00;
    --primary-dark: #E55A00;
    --primary-light: #FF8A3D;
    --secondary: #0055A5;
    --secondary-dark: #004488;
    --secondary-light: #3377CC;
    --accent: #00A8FF;

    --gradient-primary: linear-gradient(135deg, #FF6B00 0%, #FF8A3D 100%);
    --gradient-secondary: linear-gradient(135deg, #0055A5 0%, #3377CC 100%);
    --gradient-hero: linear-gradient(135deg, #FF6B00 0%, #0055A5 100%);

    /* Общие тени и радиусы (не зависят от темы) */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /*
     * FIX: Replaced "all" with explicit properties.
     * "transition: all" animates every CSS property on every change,
     * including expensive layout properties. Explicit properties are
     * cheaper for the browser compositor.
     */
    --transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                  opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                       box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                       border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Светлая тема (по умолчанию) */
body {
    --text-primary: #1A1F36;
    --text-secondary: #4A5568;
    --text-light: #718096;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7FAFC;
    --bg-tertiary: #EDF2F7;
    --bg-card: #FFFFFF;
    --bg-header: rgba(255, 255, 255, 0.88);   /* FIX: semi-transparent for backdrop-filter */
    --border-light: #E2E8F0;
    --border-medium: #CBD5E0;
    --border-dark: #252A3A;
    --footer-bg: linear-gradient(135deg, #F7FAFC 0%, #E2E8F0 100%);
    --mobile-menu-bg: #FFFFFF;
    --mobile-menu-text: #1A1F36;
    --mobile-menu-border: #E2E8F0;
}

/* Тёмная тема */
body.theme-dark {
    --text-primary: #FFFFFF;
    --text-secondary: #B0B8D1;
    --text-light: #8A93B0;
    --bg-primary: #1A1F2E;
    --bg-secondary: #151925;
    --bg-tertiary: #0F131F;
    --bg-card: #222738;
    --bg-header: rgba(26, 31, 46, 0.88);      /* FIX: semi-transparent for backdrop-filter */
    --border-light: #2D3447;
    --border-medium: #3A4158;
    --border-dark: #252A3A;
    --footer-bg: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    --mobile-menu-bg: #222738;
    --mobile-menu-text: #FFFFFF;
    --mobile-menu-border: #2D3447;
}

/* ===== BASE STYLES ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    font-size: 16px;
    overflow-x: hidden;
    min-height: 100vh;
}

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

/* ===== HEADER ===== */
.header {
    /*
     * FIX: Removed dead rgba(var(--bg-primary-rgb), 0.95) line — that variable
     * was never defined. Now using --bg-header which is semi-transparent,
     * making backdrop-filter: blur() actually visible.
     */
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-dark);
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem 0;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.375rem;
    color: var(--text-primary);
    transition: var(--transition);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo:hover {
    transform: translateY(-1px);
}

.logo-img {
    width: 70px;
    height: 60px;
    margin-right: 12px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    padding: 4px;
    filter: drop-shadow(0 4px 8px rgba(255, 107, 0, 0.3));
}

.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 2.5rem;
    margin: 0;
    flex-wrap: wrap;
}

/* ===== DROPDOWN MENU (DESKTOP) ===== */
.nav-menu .has-dropdown {
    position: relative;
}

/* Родительский пункт (span или ссылка) */
.nav-menu .has-dropdown > a,
.nav-menu .has-dropdown > span {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.75rem 0;
    position: relative;
    font-size: 1rem;
    display: inline-block;
    cursor: default;
    transition: var(--transition);
}

/* Выпадающий список */
.nav-menu .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    list-style: none;
    padding: 0.5rem 0;
    z-index: 1000;
}

/* Показываем dropdown при наведении на родительский li */
.nav-menu .has-dropdown:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Элементы dropdown */
.nav-menu .dropdown li {
    margin: 0;
}

.nav-menu .dropdown a {
    display: block;
    padding: 0.6rem 1.2rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    white-space: nowrap;
}

.nav-menu .dropdown a:hover {
    background: var(--bg-secondary);
    color: var(--primary);
    padding-left: 1.5rem;
}

/* Небольшой треугольник (опционально) */
.nav-menu .has-dropdown > span::after,
.nav-menu .has-dropdown > a::after {
    /* content: '▼'; */
    font-size: 0.75em;
    margin-left: 6px;
    opacity: 0.7;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.nav-menu .has-dropdown:hover > span::after,
.nav-menu .has-dropdown:hover > a::after {
    transform: rotate(180deg);
}

/* ===== USER MENU DROPDOWN (DESKTOP) ===== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-menu-item {
    position: relative;
}

.user-menu-parent {
    cursor: default;
    display: inline-block;
    padding: 0.5rem 1rem;  /* соответствие .nav-link */
}

.user-menu .has-dropdown > a,
.user-menu .has-dropdown > span {
    cursor: default;
}

.user-menu .dropdown {
    position: absolute;
    top: 100%;
    right: 0;                /* выравнивание по правому краю */
    min-width: 180px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    list-style: none;
    padding: 0.5rem 0;
    z-index: 1001;
}

.user-menu .has-dropdown:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu .dropdown li {
    margin: 0;
}

.user-menu .dropdown-link,
.user-menu .dropdown-link-btn {
    display: block;
    width: 100%;
    padding: 0.6rem 1.2rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    white-space: nowrap;
    background: none;
    border: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.user-menu .dropdown-link:hover,
.user-menu .dropdown-link-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary);
    padding-left: 1.5rem;
}

/* Стрелка для родительского пункта (опционально) */
.user-menu .has-dropdown > span::after,
.user-menu .has-dropdown > a::after {
    /* content: '▼'; */
    font-size: 0.75em;
    margin-left: 6px;
    opacity: 0.7;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.user-menu .has-dropdown:hover > span::after,
.user-menu .has-dropdown:hover > a::after {
    transform: rotate(180deg);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.75rem 0;
    position: relative;
    transition: var(--transition);
    font-size: 1rem;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 700;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.telegram-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.telegram-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===== HERO ===== */
.hero-section {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 3rem;
    position: relative;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.2) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /*
     * FIX: Removed text-shadow. When -webkit-text-fill-color is transparent,
     * text-shadow has nothing to attach to and renders nothing.
     */
}

.hero-subtitle {
    font-size: 1.375rem;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===== MODERN CARD ===== */
.modern-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    transition: var(--transition-slow);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.modern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.modern-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.modern-card.secondary::before {
    background: var(--gradient-secondary);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.card-content {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 1.05rem;
}

.card-content p {
    margin-bottom: 1rem;
}

.card-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== GRID ===== */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.btn::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: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gradient-secondary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ===== ABOUT PAGE ===== */
.about-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-primary) 100%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.about-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.about-header .subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.about-section {
    margin-bottom: 3rem;
    padding: 2.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    /*
     * FIX: border shorthand must come BEFORE border-left, otherwise
     * the shorthand resets border-left and the orange accent disappears.
     */
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
}

.about-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.skill-category {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.skill-category:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.skill-category h4 {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.skill-category ul {
    list-style: none;
    padding: 0;
}

.skill-category li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-dark);
    position: relative;
}

.skill-category li:before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.skill-category li:last-child {
    border-bottom: none;
}

/* ===== COMPETENCE ===== */
.competence-grid {
    display: grid;
    gap: 2rem;
}

.competence-item {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    /*
     * FIX: Same border-left override bug. border shorthand first,
     * then border-left so the blue accent is actually rendered.
     */
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--secondary);
}

.competence-item:hover {
    transform: translateX(8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.competence-scan-wrapper {
    flex-shrink: 0;
}

.competence-scan-container {
    width: 220px;
    cursor: pointer;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--border-light);
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow-md);
}

.competence-scan-container:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.competence-scan {
    width: 100%;
    height: auto;
    display: block;
    transition: var(--transition);
}

.scan-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 1rem;
    text-align: center;
    opacity: 0;
    transition: var(--transition);
    transform: translateY(10px);
}

.competence-scan-container:hover .scan-hint {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RECALL ===== */
.recall-grid {
    display: grid;
    gap: 2rem;
}

.recall-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
}

.recall-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.recall-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.recall-date {
    background: var(--gradient-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.recall-client {
    background: var(--gradient-secondary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.recall-item {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.recall-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.recall-scan-wrapper {
    flex-shrink: 0;
}

.recall-scan-container {
    width: 280px;
    cursor: pointer;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--border-light);
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow-md);
}

.recall-scan-container:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.recall-scan {
    width: 100%;
    height: auto;
    display: block;
    transition: var(--transition);
}

.recall-text {
    flex: 1;
    min-width: 0;
    line-height: 1.7;
    font-size: 1.05rem;
}

/* ===== PAGE HEADERS ===== */
.page-header {
    margin-bottom: 3rem;
    padding: 3rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-primary) 100%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.page-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* FIX: Removed text-shadow — has no effect when fill is transparent */
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 500;
    max-width: 600px;
    margin: 0 auto;
}

.product-configs {
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 500;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--footer-bg);
    color: var(--text-primary);
    padding: 1rem 0 0;
    margin-top: 3rem;
    position: relative;
    border-top: 1px solid var(--border-dark);
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-info h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
}

.footer-info p {
    opacity: 0.9;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.footer-contacts p {
    margin-bottom: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.footer-copyright {
    grid-column: 1 / -1;
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    opacity: 0.7;
    font-size: 0.95rem;
    color: var(--text-light);
}

/* ===== ANIMATIONS ===== */
/*
 * FIX: Renamed keyframes to be unambiguous:
 *   fadeInUp  → kf-fade-in-up  (used by .fade-in utility)
 *   fadeIn    → kf-modal-fade  (used by .modal)
 *   slideIn   → kf-modal-slide (used by .modal-content)
 * Previously "fadeIn" and "fadeInUp" were easily confused.
 */
@keyframes kf-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes kf-modal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes kf-modal-slide {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.fade-in {
    animation: kf-fade-in-up 0.8s ease-out;
}

.float {
    animation: float 3s ease-in-out infinite;
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.hidden { display: none; }

/* ===== CUSTOM COMPONENTS ===== */
.content-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    margin-bottom: 2rem;
    position: relative;
    overflow: visible;
}

/*
 * FIX: Replaced !important overrides with a more specific selector.
 * This targets CKEditor-generated img tags without the need for !important,
 * resolving the underlying specificity conflict cleanly.
 */
.content-card img,
.content-card .ck-content img {
    max-width: 100%;
    height: auto;
}

.content-card figure.image {
    max-width: 100%;
    margin: 1rem auto;
    text-align: center;
}

.content-card figure.image img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

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

.improved-list {
    list-style: none;
    padding: 0;
}

.improved-list li {
    margin-bottom: 1rem;
}

/* ===== FORM STYLES ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-light);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.2);
    transform: translateY(-2px);
    background: var(--bg-card);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    /*
     * FIX: z-index raised to 1100 to sit above the mobile menu (1000).
     * Previously both were 1000, causing stacking conflicts when
     * a modal opened while the mobile menu was open.
     */
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 19, 31, 0.95);
    backdrop-filter: blur(10px);
    animation: kf-modal-fade 0.3s ease;
}
.modal-content {
    background: var(--bg-card);
    margin: 2% auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    animation: kf-modal-slide 0.3s ease;
    position: relative;
    max-width: 100%;
    max-height: 90vh;
    overflow: auto;
    border: 1px solid var(--border-light);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 2px solid var(--border-light);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-body {
    padding: 2rem;
}

.modal-close {
    color: var(--text-light);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    background: none;
    border: none;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.modal-close:hover {
    color: var(--primary);
    background: var(--bg-primary);
    transform: rotate(90deg);
}

.modal-image {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    transition: var(--transition);
}

.modal-content.image-modal {
    max-width: 95vw;
    max-height: 95vh;
    background: transparent;
    border: none;
    box-shadow: none;
}

.modal-body.image-modal-body {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

/* ===== SOLUTION PAGE STYLES ===== */
.solution-accordion {
    margin: 2rem 0;
}

.accordion-item {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    border: 2px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition);
}

.accordion-item:hover {
    border-color: var(--primary-light);
    transform: translateX(4px);
}

.accordion-header {
    padding: 1.5rem;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    font-size: 1.125rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.accordion-header:hover {
    background: var(--primary-dark);
}

.accordion-content {
    padding: 1.5rem;
    background: var(--bg-card);
    line-height: 1.7;
    color: var(--text-secondary);
}

.accordion-content p {
    margin-bottom: 1rem;
}

.accordion-content p:last-child {
    margin-bottom: 0;
}

/* ===== MAIN CONTENT AREA ===== */
.main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

.content {
    min-height: 600px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-link:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    color: var(--text-light);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

.page-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

/* ===== THEME SWITCHER ===== */
.theme-switcher {
    display: flex;
    align-items: center;
}

.theme-toggle-checkbox {
    display: none;
}

.theme-toggle-label {
    position: relative;
    display: flex;
    align-items: center;
    width: 60px;
    height: 30px;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: 25px;
    cursor: pointer;
    /* FIX: replaced hardcoded "all 0.3s ease" with design token */
    transition: var(--transition);
    padding: 2px;
    box-shadow: var(--shadow-sm);
}

.theme-toggle-label:hover {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.3);
}

.theme-toggle-slider {
    position: absolute;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    /* FIX: replaced hardcoded "all 0.3s ease" with design token */
    transition: var(--transition);
    left: 2px;
    z-index: 2;
}

.theme-toggle-checkbox:checked + .theme-toggle-label .theme-toggle-slider {
    transform: translateX(30px);
    background: var(--secondary);
}

.theme-icon {
    position: absolute;
    font-size: 12px;
    /* FIX: replaced hardcoded "all 0.3s ease" with design token */
    transition: var(--transition);
    z-index: 1;
}

.theme-icon.sun {
    left: 8px;
    opacity: 1;
    color: var(--text-primary);
}

.theme-icon.moon {
    right: 8px;
    opacity: 0;
    color: var(--text-primary);
}

.theme-toggle-checkbox:checked + .theme-toggle-label .theme-icon.sun {
    opacity: 0;
}

.theme-toggle-checkbox:checked + .theme-toggle-label .theme-icon.moon {
    opacity: 1;
}

/* ===== MOBILE MENU ===== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    /* FIX: replaced hardcoded "all 0.3s ease" with design token */
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: var(--border-light);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100%;
    background: var(--mobile-menu-bg);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    /* FIX: replaced hardcoded "right 0.3s ease" — keep explicit here since
       we're only transitioning the right property, which is intentional */
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* FIX: z-index kept at 1000, below modal (1100) */
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem 1.5rem;
}

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

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--mobile-menu-border);
}

.mobile-menu-header h3 {
    color: var(--mobile-menu-text);
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--mobile-menu-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    /* FIX: replaced hardcoded "all 0.3s ease" with design token */
    transition: var(--transition);
}

.mobile-menu-close:hover {
    background: var(--border-light);
}

.mobile-nav-menu {
    list-style: none;
    margin-bottom: 2rem;
}

.mobile-nav-item {
    margin-bottom: 0.5rem;
}

/* ===== MOBILE SUBMENU ===== */
.mobile-nav-item.has-submenu {
    position: relative;
}

/* Родительский пункт в мобильном меню (может быть span или ссылка) */
.mobile-nav-parent {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Стрелочка для родительского пункта */
.mobile-nav-parent::after {
    content: '▼';
    font-size: 0.8rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.has-submenu.submenu-open .mobile-nav-parent::after {
    transform: rotate(180deg);
}

/* Вложенный список */
.mobile-submenu {
    list-style: none;
    margin-left: 1rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--primary);
    display: none;
}

.has-submenu.submenu-open .mobile-submenu {
    display: block;
}

.mobile-submenu .mobile-nav-item {
    margin-bottom: 0;
}

.mobile-submenu .mobile-nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.mobile-nav-link {
    display: block;
    padding: 1rem;
    color: var(--mobile-menu-text);
    text-decoration: none;
    border-radius: 8px;
    /* FIX: replaced hardcoded "all 0.3s ease" with design token */
    transition: var(--transition);
    font-weight: 500;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: var(--primary);
    color: white;
}

.mobile-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--mobile-menu-border);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 1.5rem;
    }

    .nav-actions {
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none !important;
    }

    .nav-actions .theme-switcher {
        display: none;
    }

    .mobile-menu-btn {
        display: block !important;
    }

    .nav-actions .telegram-btn span:not(.telegram-icon),
    .nav-actions .telegram-btn .telegram-icon {
        display: none;
    }

    .nav-actions .telegram-btn {
        padding: 0.75rem;
        width: 45px;
        height: 45px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-actions .telegram-btn::after {
        content: "📱";
        font-size: 1.2rem;
    }

    .user-menu {
        display: none;
    }

    .nav {
        gap: 1rem;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
        padding: 0 1rem;
    }

    .page-title {
        font-size: 2.25rem;
    }

    .page-subtitle {
        font-size: 1.125rem;
        padding: 0 1rem;
    }

    .product-configs {
        font-size: 1.125rem;
        padding: 0 1rem;
    }

    .grid-2 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .modern-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .card-title {
        font-size: 1.375rem;
    }

    .content-card {
        padding: 1.5rem;
    }

    .about-section {
        padding: 1.5rem;
    }

    .skills-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .competence-item {
        flex-direction: column;
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .competence-scan-container {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }

    .recall-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .recall-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-contacts p {
        justify-content: center;
    }

    .card-actions {
        flex-direction: column;
    }

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

    .modal-content {
        margin: 5% auto;
        max-width: 95%;
    }

    .modal-header {
        padding: 1.5rem 1.5rem 1rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .page-content {
        padding: 1.5rem;
    }

    .breadcrumbs {
        font-size: 0.8rem;
    }

    .recall-content {
        flex-direction: column;
        gap: 1.5rem;
    }

    .recall-scan-container {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .recall-scan-wrapper {
        order: -1;
    }

    .modal-image {
        max-width: 95vw;
        max-height: 70vh;
    }

    .modal-content.image-modal {
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .nav {
        padding: 0.75rem 0;
    }

    .logo-img {
        width: 32px;
        height: 32px;
    }

    .logo-text {
        font-size: 1rem;
    }

    .mobile-menu {
        width: 280px;
    }

    .nav-actions {
        gap: 0.5rem;
    }

    .nav-actions .telegram-btn {
        width: 40px;
        height: 40px;
        padding: 0.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .page-title {
        font-size: 1.875rem;
    }

    .modern-card {
        padding: 1.25rem;
    }

    .content-card {
        padding: 1.25rem;
    }

    .about-section {
        padding: 1.25rem;
    }

    .card-title {
        font-size: 1.25rem;
    }

    .competence-scan-container {
        max-width: 100%;
    }

    .recall-scan-container {
        max-width: 100%;
    }

    .modal-content.image-modal {
        margin: 5% auto;
        max-width: 98vw;
    }

    .modal-body.image-modal-body {
        padding: 0.5rem;
    }

    .cookie-bottom {
        max-width: 90%;
        bottom: 10px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn,
    .mobile-menu-overlay,
    .mobile-menu {
        display: none !important;
    }
}

/* ===== COOKIE CONSENT ===== */
.cookie-bottom {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: auto;
    max-width: 450px;
    min-width: 300px;
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    animation: slideUpFade 0.3s ease;
}

.cookie-bottom-content {
    padding: 1.5rem;
    text-align: center;
}

.cookie-bottom-content h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.cookie-bottom-content p {
    margin: 0 0 1.5rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.cookie-bottom-content a {
    color: var(--primary);
    text-decoration: underline;
}

.cookie-bottom-content .btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 8px;
}

.floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    animation: fadeInUp 0.5s ease;
}

.floating-btn .btn {
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 1.1rem;
    background: #ff7300;
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.floating-btn .btn:hover {
    transform: scale(1.05);
    background: #0056b3;
}

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

/* Пульсация для кнопки */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 15px rgba(255, 107, 0, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 0, 0);
    }
}

.floating-btn .btn.pulse {
    animation: pulse 1.5s infinite;
    will-change: transform;
}

/* Стили для <details> / <summary> */
details {
    margin: 1rem 0;
}

summary {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: var(--transition);
    user-select: none;
}

summary:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

details[open] summary {
    background: var(--primary);
    color: white;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

details[open] {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--bg-primary);
}