/* General Styles */
:root {
    --primary-color: #ffffff; /* White background */
    --secondary-color: #f8f9fa; /* Light grey for header/footer */
    --accent-color: #007bff; /* Main blue for buttons and links */
    --text-color: #0e0c0c; /* Dark text for readability */
    --text-color-light: #6c757d; /* Lighter grey text (was black) */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--primary-color); /* Fallback color */
    background-image: linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), url('../images/background.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Main Content */
main {
    animation: fadeIn 1s ease-in-out;
}

.hero {
    padding: 6rem 0;
    text-align: center;
    /* Parallax background */
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('../images/header.png');

}

.hero .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    background-color: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 1rem 2rem;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.btn:hover {
    background-color: var(--accent-color);
    color: #fff;
}

/* Specific styles for the hero button */
.hero .btn {
    color: #fff;
    border-color: #fff;
}

.hero .btn:hover {
    background-color: #fff;
    color: var(--accent-color);
}

/* Footer */
footer {
    background-color: #212529;
    color: #f8f9fa;
    padding: 1rem 0;
    margin-top: 1rem;
    text-align: left;
    font-size: 1rem;
}

footer h4 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-wrap: wrap;
}

footer .text {
    text-align: center;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
    margin-bottom: 1rem;
}

.footer-col p {
    margin-bottom: 0.5rem;
}

.footer-logo-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.footer-logo-link:hover {
    color: var(--accent-color);
}

.footer-logo-link img {
    height: 40px;
}

#footer-map iframe {
    border-radius: 8px;
    border: 0;
}

.footer-bottom {
    width: 100%;
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #495057;
}

.social-links a {
    color: inherit;
    text-decoration: none;
    margin-left: 15px;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--accent-color);
}

/* Main Calculator Section */
#main-calculator {
    padding: 3rem;
    background-color: rgba(248, 249, 250, 0.95);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-top: 4rem;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    text-align: center;
}

#main-calculator .calculator-subtitle {
    color: var(--text-color-light);
    margin-top: -2.5rem;
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

/* Catalog Preview Section */
#catalog-preview, #other-products-preview {
    padding: 4rem 20px 6rem 20px;
    text-align: center;
}

.section-title {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 3rem;
    position: relative;
    display: block;
    text-align: center;
}

.section-title::after {
    content: '';
    position: absolute;
    width: 60%;
    height: 4px;
    background-color: var(--accent-color);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    text-align: left;
}

.product-card {
    background-color: var(--primary-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.product-card h3 {
    font-size: 1.4rem;
    color: var(--text-color);
    margin: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.product-card p {
    font-size: 1rem;
    color: var(--text-color-light);
    padding: 0 1.5rem;
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.btn-details {
    display: inline-block;
    margin: 0 1.5rem 1.5rem 1.5rem;
    padding: 0.7rem 1.5rem;
    background-color: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    text-align: center;
    text-decoration: none;
    font-weight: 700;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
    align-self: flex-start;
}

.btn-details:hover {
    background-color: var(--accent-color);
    color: #fff;
}

/* Location Map Section */
#location {
    padding: 4rem 0 0 0;
    text-align: center;
}

.map-container {
    margin-top: 2rem;
    line-height: 0; /* Fix for extra space under iframe */
}

.map-container iframe {
    border: 0;
    vertical-align: bottom; /* Another fix for extra space */
}

/* Certificates Section */
#certificates {
    padding: 4rem 20px 6rem 20px;
    text-align: center;
}

.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.certificate-item {
    text-align: center;
}

.certificate-item img {
    width: 100%;
    height: auto; /* Добавлено для сохранения пропорций */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.certificate-item a:hover img {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.certificate-caption {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    min-height: 3.2em; /* 2 lines * 1.6 line-height */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 404 Error Page */
.error-page {
    padding: 6rem 0;
    text-align: center;
}

.error-page h1 {
    font-size: 8rem;
    color: var(--accent-color);
    line-height: 1;
    margin-bottom: 1rem;
}

/* Product Page Styles */
.product-page {
    padding: 4rem 0;
    animation: fadeIn 1s ease-in-out;
}

.product-page .container {
    text-align: left;   
}

.back-link {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    margin-bottom: 2rem;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--text-color);
}

.product-details {
    display: grid;
    /* This creates a responsive grid. It will show two columns if there's enough space 
       (at least 320px for each), and automatically switch to a single column on smaller screens. */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 3rem;
    align-items: flex-start;
}

.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-image {
    position: relative;
    width: 100%;
    /* Устанавливаем соотношение сторон 4:3 */
    padding-top: 75%; 
    background-color: #f8f9fa; /* Фон для letterboxing */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.main-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Заполняет контейнер, может обрезать изображение */
    border-radius: 8px;
    transition: opacity 0.2s ease-in-out;
}

.thumbnail-images {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.thumbnail {
    width: 100px;
    height: 75px;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.3s ease, opacity 0.3s ease;
    opacity: 0.7;
}

.thumbnail:hover, .thumbnail.active {
    opacity: 1;
}
.thumbnail.active {
    border-color: var(--accent-color);
}

.product-info {
    /* Заставляет длинные слова переноситься, а не выходить за пределы блока */
    overflow-wrap: break-word;
    word-wrap: break-word; /* Для поддержки старых браузеров */
}

.product-info h1 {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    /* Позволяет длинным названиям продуктов переноситься, не ломая верстку на мобильных */
    overflow-wrap: break-word;
}

.product-info h2 {
    font-size: 1.8rem;
    color: var(--accent-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.product-info p, .product-info ul {
    color: var(--text-color-light);
    margin-bottom: 1.5rem;
}

.product-info ul {
    list-style-position: inside;
    padding-left: 10px;
}

.product-info ul li {
    margin-bottom: 0.5rem;
}

.product-info .btn {
    margin-top: 1rem;
}

/* Product Specs Table Styles */
.product-specs {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

/* Wrapper for responsive tables to allow horizontal scrolling */
.table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0; /* Replaces the margin from .product-specs */
}

.product-specs th,
.product-specs td {
    border: 1px solid #000000;
    padding: 0.3rem;
    text-align: center;
    font-size: 0.7rem;
    vertical-align: middle;
}

.calculator-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    text-align: left;
    margin-top: 2rem;
    align-items: center;
}

.param-control {
    margin-bottom: 0.5rem;
}

.param-control label {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.param-control input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.param-control select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background-color: #fff;
}

.param-control select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.result-display {
    background-color: #e9ecef;
    padding: 2rem;
    border-radius: 8px;
    border-left: 5px solid var(--accent-color);
}

.result-display h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.result-display p {
    font-size: 1.1rem;
    color: var(--text-color-light);
    margin-bottom: 0.5rem;
}

.result-display #volume-output {
    font-size: 1.5rem;
}

.result-display strong {
    color: var(--accent-color);
    font-size: 1.3rem;
}

.result-display #cost-output {
    font-size: 1.5rem;
}

.result-display small {
    display: block;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.result-display .btn {
    margin-top: 1.5rem;
    width: 100%;
}

/* Calculator Options */
.param-control-options {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.param-control-options > label {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-color);
}

.checkbox-label input, .radio-label input {
    margin-right: 0.75rem;
    width: 16px;
    height: 16px;
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 200; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 2rem 3rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-color-light);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

#calculator-request-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Certificate Image Modal */
#certificate-modal {
    /* Reuses .modal styles for background and positioning */
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#certificate-modal .modal-content-image {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh; /* Оставляем место для подписи */
    animation: zoomIn 0.3s ease-out;
}

#certificate-modal #caption {
    margin-top: 5px;
    color: #ccc;
    font-size: 1.1rem;
    text-align: center;
    animation: fadeIn 0.3s 0.1s both; /* Появляется чуть позже картинки */
}

/* Кнопка закрытия для модального окна сертификатов */
#certificate-modal .close-button {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 210; /* Поверх изображения */
}

#certificate-modal .close-button:hover,
#certificate-modal .close-button:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Success message inside modal or form containers */
#success-message, #contact-success-message, #service-modal-success-message {
    text-align: center;
    padding: 2rem 0;
    animation: fadeIn 0.5s;
}

.service-content-grid #main-calculator {
    margin: 0;
    position: sticky;
    top: 120px;
}

/* Diagnostics page calculator */
/* Contact Page */
.contact-page {
    padding: 4rem 0;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 3rem;
    text-align: left;
    margin-top: 2rem;
}

.contact-details p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-color-light);
}

.contact-details h3, .contact-form-container h3 {
    font-size: 1.8rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
}

/* New layout for contact page */
.contact-page .contact-details {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem auto;
}

.contact-page .contact-form-container {
    max-width: 800px;
    margin: 4rem auto 0 auto;
    text-align: left;
}

/* New styles for the maps section on contact page */
#location-maps {
    margin-top: 4rem;
}

#location-maps .section-title {
    font-size: 2.2rem; /* Slightly smaller than main page title */
    margin-bottom: 2.5rem;
}

.maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.map-item h4 {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.contact-details a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-details a:hover {
    color: var(--text-color);
}

.map-item .map-container iframe {
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

/* Scroll Reveal Animation */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0px);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.4);
    }
    to {
        transform: scale(1);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}


/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }

    .product-info h1 {
        font-size: 2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    footer .container {
        flex-direction: column;
        justify-content: center;
        gap: 1rem;
        
    }

    footer {
        text-align: center;
    }


    .calculator-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    #main-calculator {
        padding: 3rem 20px;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .service-content-grid {
        grid-template-columns: 1fr;
    }

    .service-form-container { position: static; }
}

/* General Header Styles */
header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;

}

header .logo a {
    font-weight: 700;
    color: #01284c;
    text-decoration: none;
    font-size: 1rem;
}

.logo {
    /* Позволяет логотипу сжиматься и не выталкивать другие элементы. */
    /* Важно для мобильных устройств, где название компании может быть длинным. */
    flex: 0 1 auto;
    min-width: 0; /* Позволяет тексту внутри корректно переноситься */
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.main-nav a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s;
    padding: 0.5rem 0;
    white-space: nowrap; /* Предотвращает перенос текста в ссылках */
}

.main-nav a:hover {
    color: #a04552;
}

/* Mobile Navigation Styles */
.mobile-nav-toggle {
    display: none; /* Hidden by default on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger-icon {
    display: block;
    position: relative;
    width: 24px;
    height: 3px;
    background-color: #01284c;
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #01284c;
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}

.hamburger-icon::before {
    top: -8px;
}

.hamburger-icon::after {
    bottom: -8px;
}

/* Styles for when the menu is open */
.mobile-nav-toggle[aria-expanded="true"] .hamburger-icon {
    background-color: transparent;
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-icon::before {
    transform: translateY(8px) rotate(45deg);
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-icon::after {
    transform: translateY(-8px) rotate(-45deg);
}

/* Responsive styles for screens smaller than 981px */
@media (max-width: 980px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #fff;
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem 0;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #eee;
    }

    .main-nav.active {
        display: flex;
    }

    .main-nav a {
        padding: 0.75rem 1.5rem;
        text-align: left;
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .main-nav a:last-child {
        border-bottom: none;
    }

    .mobile-nav-toggle {
        display: block;
    }
}
