:root {
    --white: #ffffff;
    --dark-text: #343a40;
    --primary-color: #008080; /* Teal for a medical feel */
    --primary-hover-color: #009999; /* A lighter teal for hover effects */
    --light-grey-bg: #f8f9fa;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--dark-text);
}

.bg-light {
    background-color: var(--light-grey-bg) !important;
}

.navbar.navbar-light.bg-light {
    background-color: var(--white) !important;
    border-bottom: 1px solid #dee2e6;
}

.navbar-brand {
    color: var(--primary-color) !important;
    font-weight: 600;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover-color);
    border-color: var(--primary-hover-color);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.jumbotron {
}

.card-title {
    color: var(--primary-color);
}

.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-responsive video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Desktop-specific styles */
@media (min-width: 577px) {
    h1.display-4 {
        font-size: 3rem; /* Slightly smaller for desktop */
    }
}

/* Mobile-first improvements */
@media (max-width: 576px) {
    .jumbotron {
        padding: 0.5rem; /* Make it more compact */
    }

    .hero-section h1 {
        font-size: 1.2rem; /* Smaller font size for h1 on mobile */
    }

    .hero-section p {
        font-size: 0.8rem; /* Smaller font size for p on mobile */
    }
    
    .jumbotron .display-4 {
        font-size: 1,5rem;
    }

    .display-4 {
        font-size: 1.8rem; /* Adjusted for mobile */
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .navbar .container-fluid {
        flex-wrap: nowrap;
    }

    #vision-impaired-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Make "Записаться на прием" button smaller on mobile */
    .hero-section .btn-lg {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }

    /* Make "Подробнее" button smaller on mobile inside service carousel */
    .service-slide-caption .btn-lg {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

.hero-section {
    position: relative;
    background-image: url('../images/hero-background.jpg');
    background-color: #2c3e50; /* Fallback color */
    background-size: cover;
    background-position: center;
    color: white;
    padding: 3rem 1.5rem;
    border-radius: 0.3rem;
    overflow: hidden; /* To contain the pseudo-element */
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5); /* Black overlay with 50% opacity */
    z-index: 1;
}

.hero-section > * {
    position: relative;
    z-index: 2; /* To ensure content is above the overlay */
}

/* Make h1 and p in hero more readable */
.hero-section h1, .hero-section p {
    color: white;
    font-weight: normal; /* Ensure text is not bold */
}

.service-section-wrapper {
    position: relative;
}

/* New Service Section Styles */
#service-tabs {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 10;
    /* Remove justify-content-center since it's aligned left now */
    justify-content: flex-start !important;
    /* Remove mb-4 as spacing is handled differently */
    margin-bottom: 0 !important;
}

#service-tabs .nav-link {
    margin: 0.25rem;
    color: var(--white);
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

#service-tabs .nav-link.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

#service-content-carousel {
    border-radius: 0.3rem;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.service-slide-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 450px;
    background-size: cover;
    background-position: center;
    color: var(--white);
}

/* Dark overlay for text readability */
.service-slide-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0.2));
}

.service-slide-caption {
    position: relative; /* To appear above the overlay */
    z-index: 1;
    max-width: 80%;
    padding: 2rem;
}

[id^="service-caption-"] h3 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--white) !important; /* Explicitly white */
}

[id^="service-caption-"] p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--white) !important; /* Explicitly white */
}

/* Responsive adjustments */
@media (max-width: 992px) {
    #service-tabs {
        /* On smaller screens, move tabs back to the top */
        position: static;
        justify-content: center !important;
        margin-bottom: 1.5rem !important;
    }

    #service-tabs .nav-link {
        color: var(--white) !important; /* Changed to white */
        background-color: rgba(0, 0, 0, 0.4) !important; /* Semi-transparent black */
        border: 1px solid rgba(255, 255, 255, 0.5) !important; /* Semi-transparent white border */
    }

    #service-tabs .nav-link.active {
        background-color: var(--primary-color);
        color: var(--white);
        border-color: var(--primary-color);
    }
}


@media (max-width: 768px) {
    .service-slide-wrapper {
        height: 400px;
    }
    [id^="service-caption-"] h3 {
        font-size: 2rem;
        color: var(--white) !important; /* Explicitly white */
    }
    [id^="service-caption-"] p {
        font-size: 1.1rem;
        color: var(--white) !important; /* Explicitly white */
    }
}

@media (max-width: 576px) {
    .service-slide-wrapper {
        height: 350px;
        align-items: flex-end; /* Align caption to the bottom on mobile */
        text-align: left;
    }
    .service-slide-caption {
        padding: 1.5rem;
        max-width: 100%;
    }
    [id^="service-caption-"] h3 {
        font-size: 1.5rem;
        color: var(--white) !important; /* Explicitly white */
    }
    [id^="service-caption-"] p {
        font-size: 1.0rem;
        margin-bottom: 1rem;
        color: var(--white) !important; /* Explicitly white */
    }
    #service-tabs {
        display: none; /* Hide service tabs on mobile */
    }

    /* Contact Info adjustments for mobile */
    .card-body p {
        font-size: 0.9rem; /* Smaller font for contact info on mobile */
        margin-bottom: 0.3rem; /* Reduce space between paragraphs */
    }

    .card-body {
        padding: 1rem; /* Reduce padding for contact card body on mobile */
    }
}

.media-container {
    margin: 10px; /* Consistent margin around media */
}

.image-responsive {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.image-responsive img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* This will crop the image to fit the container */
}

/* Improve visibility of carousel controls */
#newsCarousel .carousel-control-prev-icon,
#newsCarousel .carousel-control-next-icon,
#specialistsCarousel .carousel-control-prev-icon,
#specialistsCarousel .carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 10px;
}

.card-img-top {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

@media (max-width: 576px) {
    .card-img-top {
        width: 100%;
        height: 300px;
        object-fit: cover;
    }
}