/* CSS Reset and Base Styles */
:root {
    --primary-color: #003366;
    --primary-dark: #002244;
    --secondary-color: #ff4500;
    --secondary-light: #ff6a33;
    --text-color: #333333;
    --text-light: #666666;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --accent-color: #00a8e8;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --header-font: 'Oswald', sans-serif;
    --body-font: 'Roboto', sans-serif;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
    --transition: all 0.3s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 100%;
}

body {
    font-family: var(--body-font);
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--header-font);
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin: 2.5rem 0 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

h2:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: var(--secondary-color);
    border-radius: 2px;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin: 2rem 0 1rem;
    color: var(--primary-dark);
}

p {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

strong, b {
    color: var(--primary-color);
    font-weight: 700;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-color);
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.main-header {
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.85) 0%, rgba(0, 34, 68, 0.9) 100%), url('images/ИЗИТРОНИК/Привод%20сцепления%20Easytronic.jpg') no-repeat center center/cover;
    color: white;
    padding: 100px 20px;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.main-header:before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, var(--bg-color), transparent);
    z-index: 1;
}

.main-header .container {
    position: relative;
    z-index: 2;
}

.main-header h1 {
    color: white;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
    animation: fadeInDown 1s ease-out;
    margin-bottom: 1.5rem;
}

.main-header .subtitle {
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    max-width: 800px;
    margin: 0 auto 2rem;
    opacity: 0.95;
    font-weight: 300;
    animation: fadeInUp 1s ease-out 0.3s both;
}

.header-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 2rem;
    animation: fadeInUp 1s ease-out 0.6s both;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 15px 0;
    font-size: 0.9rem;
    color: var(--text-light);
    background: rgba(0, 51, 102, 0.05);
    border-radius: 8px;
    margin-bottom: 20px;
}

.breadcrumbs a {
    color: var(--primary-color);
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Content Cards */
.content-card {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 40px;
    transition: var(--transition);
    overflow: hidden;
}

.content-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-5px);
}

/* Table of Contents */
.toc {
    background: linear-gradient(135deg, #e8f0f6 0%, #d1e3f3 100%);
    border-left: 5px solid var(--secondary-color);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 40px;
    position: relative;
}

.toc:before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23003366" opacity="0.1"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>') no-repeat;
    background-size: contain;
    z-index: 0;
}

.toc h3 {
    margin-top: 0;
    text-align: center;
    color: var(--primary-color);
    position: relative;
    z-index: 1;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0;
    position: relative;
    z-index: 1;
}

.toc-item {
    margin-bottom: 12px;
    counter-increment: item;
}

.toc-item:last-child {
    margin-bottom: 0;
}

.toc-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    font-weight: 500;
    color: var(--primary-color);
    transition: var(--transition);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.toc-link:before {
    content: counter(item);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    margin-right: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.toc-link:hover {
    background: white;
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Step-by-step Guide */
.guide-section {
    margin-bottom: 50px;
}

.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.step-title {
    font-size: 1.8rem;
    margin: 0;
    color: var(--primary-color);
}

.step-content {
    margin-bottom: 30px;
}

/* Изображения - ОСНОВНЫЕ ИЗМЕНЕНИЯ */
.step-image-container {
    margin: 25px 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    max-width: 80%; /* Ограничение ширины на ПК */
    margin-left: auto;
    margin-right: auto;
}

.step-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.step-image-container:hover .step-image {
    transform: scale(1.03);
}

.image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
}

.step-image-container:hover .image-caption {
    opacity: 1;
    transform: translateY(0);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 25px 0;
}

.image-grid .step-image-container {
    margin: 0;
    max-width: 100%; /* Убираем ограничение для изображений в сетке */
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted var(--secondary-color);
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.9rem;
    font-weight: normal;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--primary-color) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* FAQ Section */
.faq-container {
    margin-top: 30px;
}

.faq-item {
    border-bottom: 1px solid #eaeaea;
    padding: 20px 0;
    transition: var(--transition);
}

.faq-item:first-child {
    border-top: 1px solid #eaeaea;
}

.faq-question {
    font-weight: 600;
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    padding-right: 40px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.faq-question:before {
    content: '\f055';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 0;
    color: var(--secondary-color);
    transition: var(--transition);
}

.faq-item.active .faq-question:before {
    content: '\f056';
    color: var(--primary-color);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
    padding-left: 25px;
}

.faq-item.active .faq-answer {
    max-height: 500px;
    padding-top: 15px;
}

/* Call to Action */
.cta-container {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--border-radius);
    margin: 50px 0;
}

.cta-title {
    color: white;
    margin-bottom: 20px;
}

.cta-button {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 16px 40px;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    font-family: var(--header-font);
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(255, 69, 0, 0.4);
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.cta-button: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: 0.5s;
}

.cta-button:hover {
    background-color: var(--secondary-light);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 69, 0, 0.5);
}

.cta-button:hover:before {
    left: 100%;
}

/* Footer */
.main-footer {
    background-color: var(--primary-dark);
    color: white;
    padding: 50px 0 20px;
    margin-top: 80px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-column h4 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.3rem;
    position: relative;
    padding-bottom: 10px;
}

.footer-column h4:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--secondary-color);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--secondary-color);
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(255, 69, 0, 0.4);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--secondary-light);
    transform: translateY(-5px);
}

/* Progress Bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 1000;
}

.progress-bar {
    height: 4px;
    background: var(--secondary-color);
    width: 0%;
    transition: width 0.2s ease;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Responsive Design - ОСНОВНЫЕ ИЗМЕНЕНИЯ ДЛЯ МОБИЛЬНЫХ */
@media (max-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 720px;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    /* Изображения на всю ширину на мобильных */
    .step-image-container {
        max-width: 100vw;
        margin-left: -15px;
        margin-right: -15px;
        width: 100vw;
        border-radius: 0;
    }
    
    .image-grid .step-image-container {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
    
    .main-header {
        padding: 80px 15px;
    }

    .content-card {
        padding: 20px;
    }

    .step-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .step-number {
        margin-bottom: 15px;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .header-meta {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .toc {
        padding: 20px;
    }

    .cta-container {
        padding: 30px 20px;
    }
}

@media (max-width: 576px) {
    h2 {
        font-size: 1.6rem;
    }

    h3 {
        font-size: 1.4rem;
    }

    .main-header {
        padding: 60px 15px;
    }

    .content-card {
        padding: 15px;
        border-radius: 12px;
    }

    .toc {
        padding: 15px;
    }

    .toc-link {
        padding: 10px 15px;
    }

    .step-title {
        font-size: 1.5rem;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    /* Дополнительные корректировки для очень маленьких экранов */
    .step-image-container {
        margin-left: -15px;
        margin-right: -15px;
    }
}

/* Print Styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    .main-header, .toc, .cta-container, .main-footer, .back-to-top {
        display: none;
    }

    .content-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    a {
        text-decoration: underline;
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    h2, h3 {
        page-break-after: avoid;
    }

    p, h2, h3 {
        orphans: 3;
        widows: 3;
    }
    
    .step-image-container {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}