/* ==========================================
   Химия ПРО - Современный учебник
   Тёмная тема с оранжевыми акцентами
   ========================================== */

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: #242424;
    --bg-card-hover: #2d2d2d;

    --orange-primary: #ff6b35;
    --orange-light: #ff8c5a;
    --orange-dark: #e55a2b;
    --orange-glow: rgba(255, 107, 53, 0.3);

    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #737373;

    --border-color: #333333;
    --success: #4ade80;
    --warning: #fbbf24;
    --info: #60a5fa;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

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

/* ==========================================
   Navigation
   ========================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(13, 13, 13, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    font-size: 28px;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--orange-primary), var(--orange-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--orange-primary);
    background: var(--orange-glow);
}

/* ==========================================
   Hero Section
   ========================================== */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 100px 40px 60px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a1a 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 150%;
    background: radial-gradient(ellipse, var(--orange-glow) 0%, transparent 70%);
    opacity: 0.5;
}

.hero-content {
    max-width: 600px;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
}

.highlight {
    background: linear-gradient(135deg, var(--orange-primary), var(--orange-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--orange-primary), var(--orange-dark));
    color: white;
    padding: 16px 32px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: 0 4px 20px var(--orange-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--orange-glow);
}

/* Molecule Animation */
.hero-visual {
    position: relative;
    z-index: 1;
}

.molecule {
    display: flex;
    align-items: center;
    gap: 5px;
    animation: float 3s ease-in-out infinite;
}

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

.atom {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.4);
}

.atom-1, .atom-3 {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
}

.atom-2 {
    background: linear-gradient(135deg, var(--orange-primary), var(--orange-dark));
    width: 80px;
    height: 80px;
}

.bond {
    width: 30px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
}

/* ==========================================
   Sections
   ========================================== */

.section {
    padding: 80px 40px;
}

.section-dark {
    background: var(--bg-secondary);
}

.section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 50px;
    font-size: 1.1rem;
}

/* Info Card */
.info-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    border: 1px solid var(--border-color);
    max-width: 800px;
    margin: 30px auto;
}

.info-card p {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.info-card p:last-child {
    margin-bottom: 0;
}

.example-box {
    background: rgba(255, 107, 53, 0.1);
    border-left: 4px solid var(--orange-primary);
    padding: 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-top: 20px;
}

.example-box h4 {
    color: var(--orange-light);
    margin-bottom: 10px;
}

.example-box p {
    margin-bottom: 0;
}

/* ==========================================
   Chapters Grid
   ========================================== */

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    max-width: 1100px;
    margin: 0 auto;
}

.chapter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 30px;
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--orange-primary), var(--orange-light));
    transform: scaleX(0);
    transition: var(--transition);
}

.chapter-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
    border-color: var(--orange-primary);
}

.chapter-card:hover::before {
    transform: scaleX(1);
}

.chapter-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--border-color);
    line-height: 1;
    margin-bottom: 15px;
}

.chapter-card:hover .chapter-number {
    color: var(--orange-primary);
}

.chapter-card h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.chapter-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.chapter-tag {
    display: inline-block;
    background: var(--orange-glow);
    color: var(--orange-light);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.chapter-card-special {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 107, 53, 0.05));
    border-color: var(--orange-dark);
}

/* ==========================================
   Quick Start Grid
   ========================================== */

.quickstart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 40px auto 0;
}

.quick-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 25px;
}

.quick-card h4 {
    color: var(--orange-light);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.quick-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ==========================================
   Tips Section
   ========================================== */

.tips-list {
    max-width: 800px;
    margin: 40px auto 0;
}

.tip {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 25px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.tip:hover {
    border-color: var(--orange-primary);
}

.tip-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--orange-primary), var(--orange-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.tip h4 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.tip p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ==========================================
   Footer
   ========================================== */

footer {
    background: var(--bg-secondary);
    padding: 40px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

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

.footer-small {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* ==========================================
   Content Pages
   ========================================== */

.page-header {
    padding: 120px 40px 60px;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    text-align: center;
}

.page-header h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.breadcrumb {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--orange-primary);
    text-decoration: none;
}

.breadcrumb span {
    color: var(--text-muted);
}

.content {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 40px;
}

.content h2 {
    font-size: 1.8rem;
    margin: 40px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.content h3 {
    font-size: 1.4rem;
    margin: 30px 0 15px;
    color: var(--orange-light);
}

.content p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.content ul, .content ol {
    color: var(--text-secondary);
    margin: 15px 0 15px 25px;
}

.content li {
    margin-bottom: 10px;
}

.content strong {
    color: var(--text-primary);
}

/* Definition Box */
.definition {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(255, 107, 53, 0.05));
    border: 1px solid var(--orange-dark);
    border-radius: var(--radius);
    padding: 25px;
    margin: 25px 0;
}

.definition h4 {
    color: var(--orange-light);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* Formula Box */
.formula-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
}

.formula-box .small {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 10px;
}

/* Table */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
}

.content th {
    background: var(--orange-primary);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.content td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.content tr:hover td {
    background: var(--bg-card-hover);
}

/* Note Box */
.note {
    background: rgba(96, 165, 250, 0.1);
    border-left: 4px solid var(--info);
    padding: 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 20px 0;
}

.note h4 {
    color: var(--info);
    margin-bottom: 10px;
}

/* Warning Box */
.warning {
    background: rgba(251, 191, 36, 0.1);
    border-left: 4px solid var(--warning);
    padding: 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 20px 0;
}

.warning h4 {
    color: var(--warning);
    margin-bottom: 10px;
}

/* Success Box */
.success {
    background: rgba(74, 222, 128, 0.1);
    border-left: 4px solid var(--success);
    padding: 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 20px 0;
}

.success h4 {
    color: var(--success);
    margin-bottom: 10px;
}

/* Algorithm Steps */
.algorithm {
    counter-reset: step;
    margin: 25px 0;
}

.algorithm-step {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.algorithm-step::before {
    counter-increment: step;
    content: counter(step);
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--orange-primary), var(--orange-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.algorithm-step div h4 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.algorithm-step div p {
    margin: 0;
    color: var(--text-secondary);
}

/* Navigation between pages */
.page-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.page-nav a {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    text-decoration: none;
    transition: var(--transition);
    flex: 1;
    max-width: 300px;
}

.page-nav a:hover {
    border-color: var(--orange-primary);
    background: var(--bg-card-hover);
}

.page-nav .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.page-nav .title {
    color: var(--orange-light);
    font-weight: 600;
}

.page-nav .next {
    text-align: right;
}

/* ==========================================
   Periodic Table Styles
   ========================================== */

.periodic-table-container {
    overflow-x: auto;
    padding: 20px 0;
}

.periodic-table {
    display: grid;
    grid-template-columns: repeat(18, minmax(50px, 1fr));
    gap: 3px;
    min-width: 900px;
}

.element {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 5px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.7rem;
}

.element:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 0 20px var(--orange-glow);
}

.element .number {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.element .symbol {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.element .name {
    font-size: 0.5rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Element categories */
.element.alkali { background: linear-gradient(135deg, #ef4444, #dc2626); }
.element.alkaline { background: linear-gradient(135deg, #f97316, #ea580c); }
.element.transition { background: linear-gradient(135deg, #eab308, #ca8a04); }
.element.post-transition { background: linear-gradient(135deg, #22c55e, #16a34a); }
.element.metalloid { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.element.nonmetal { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.element.halogen { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.element.noble { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.element.lanthanide { background: linear-gradient(135deg, #ec4899, #db2777); }
.element.actinide { background: linear-gradient(135deg, #f43f5e, #e11d48); }

.element.alkali .symbol,
.element.alkaline .symbol,
.element.transition .symbol,
.element.post-transition .symbol,
.element.metalloid .symbol,
.element.nonmetal .symbol,
.element.halogen .symbol,
.element.noble .symbol,
.element.lanthanide .symbol,
.element.actinide .symbol {
    color: white;
}

.element.alkali .number,
.element.alkaline .number,
.element.transition .number,
.element.post-transition .number,
.element.metalloid .number,
.element.nonmetal .number,
.element.halogen .number,
.element.noble .number,
.element.lanthanide .number,
.element.actinide .number {
    color: rgba(255,255,255,0.7);
}

.element.alkali .name,
.element.alkaline .name,
.element.transition .name,
.element.post-transition .name,
.element.metalloid .name,
.element.nonmetal .name,
.element.halogen .name,
.element.noble .name,
.element.lanthanide .name,
.element.actinide .name {
    color: rgba(255,255,255,0.8);
}

.empty-cell {
    background: transparent;
    border: none;
}

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 768px) {
    .navbar {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        gap: 15px;
    }

    .hero {
        flex-direction: column;
        text-align: center;
        padding: 100px 20px 60px;
    }

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

    .hero-visual {
        margin-top: 40px;
    }

    .section {
        padding: 60px 20px;
    }

    .section h2 {
        font-size: 2rem;
    }

    .content {
        padding: 40px 20px;
    }

    .page-header {
        padding: 100px 20px 40px;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .page-nav {
        flex-direction: column;
    }

    .page-nav a {
        max-width: 100%;
    }
}

/* ==========================================
   Animations
   ========================================== */

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

.chapter-card {
    animation: fadeInUp 0.5s ease forwards;
}

.chapter-card:nth-child(1) { animation-delay: 0.1s; }
.chapter-card:nth-child(2) { animation-delay: 0.15s; }
.chapter-card:nth-child(3) { animation-delay: 0.2s; }
.chapter-card:nth-child(4) { animation-delay: 0.25s; }
.chapter-card:nth-child(5) { animation-delay: 0.3s; }
.chapter-card:nth-child(6) { animation-delay: 0.35s; }
.chapter-card:nth-child(7) { animation-delay: 0.4s; }
.chapter-card:nth-child(8) { animation-delay: 0.45s; }

/* Print styles */
@media print {
    .navbar, footer, .page-nav {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .content {
        max-width: 100%;
    }
}
