:root {
    --primary-color: #E5111B;
    --primary-dark: #E5111B;
    --dark-bg: #1A2435;
    --dark-gray: #243147;
    --light-bg: #F8FAFC;
    --text-main: #334155;
    --text-light: #94A3B8;
    --white: #FFFFFF;
    --radius: 12px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--white);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--dark-bg);
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* Typography Utility */
.text-primary {
    color: var(--primary-color);
}

.text-center {
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(229, 17, 27, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 17, 27, 0.45);
}

/* Header & Nav */
header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: var(--transition);
}

header.scrolled {
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.12;
    background-image: radial-gradient(rgba(255, 255, 255, 0.8) 1px, transparent 1px);
    background-size: 14px 14px;
    z-index: -1;
    pointer-events: none;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo img {
    height: 65px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links li a {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--white);
    transition: var(--transition);
    position: relative;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links li a:hover {
    color: var(--primary-color);
}

.nav-links li a:hover::after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--white);
    padding: 0.4rem;
    transition: var(--transition);
}

/* Hero Section */
.hero {
    height: 100vh;
    min-height: 600px;
    background: linear-gradient(rgba(245, 245, 245, 0.75), rgba(220, 220, 220, 0.65)), url('Media/phsio-knee.jpg') center/cover;
    display: flex;
    align-items: center;
    color: var(--dark-bg);
    padding-top: 80px;
}

.hero .hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    width: 100%;
}

.hero-logo-wrapper {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.hero-logo-wrapper img {
    max-width: 100%;
    width: 450px;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

.hero-content {
    flex: 1;
    max-width: 600px;
    animation: fadeInUp 1s ease;
    padding-top: 4rem;
}

.hero-content h1 {
    font-size: 4rem;
    color: var(--dark-bg);
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.badge {
    display: inline-block;
    background: var(--dark-bg);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
}

/* Sections General */
section {
    padding: 6rem 0;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

.section-title.left-align::after {
    left: 0;
    transform: none;
}

/* Services Grid */
.services {
    background-color: var(--dark-bg);
    position: relative;
    z-index: 1;
}

.services .section-title {
    color: var(--white);
}

.services::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.12;
    background-image: radial-gradient(rgba(255, 255, 255, 0.6) 1px, transparent 1px);
    background-size: 18px 18px;
    z-index: -1;
    pointer-events: none;
}

.services-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
}

.service-card {
    flex: 1 1 320px;
    max-width: 380px;
    background: var(--dark-gray);
    padding: 2.5rem 2rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border-color: rgba(229, 17, 27, 0.3);
}

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

.service-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    display: inline-block;
    background: rgba(229, 17, 27, 0.3);
    border: 1px solid rgba(229, 17, 27, 0.5);
    width: 70px;
    height: 70px;
    line-height: 70px;
    text-align: center;
    border-radius: 50%;
}

.service-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--white);
}

.service-card p {
    color: #94a3b8;
    font-size: 0.95rem;
}

/* Features/Why Choose Us */
.features-container {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.features-image {
    flex: 1;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.features-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.features-list {
    flex: 1;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.feature-item i {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-top: 0.2rem;
}

.feature-item h4 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.feature-item p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Contact Section */
.contact {
    background-color: var(--dark-bg);
    color: var(--white);
}

.contact .section-title {
    color: var(--white);
}

.contact-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-info {
    margin-bottom: 2rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.info-icon {
    width: 60px;
    height: 60px;
    background: var(--dark-gray);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.info-text h4 {
    color: var(--white);
    margin-bottom: 0.2rem;
    font-size: 1rem;
}

.info-text p,
.info-text a {
    color: #cbd5e1;
    font-size: 0.95rem;
    transition: var(--transition);
    word-break: break-word;
    overflow-wrap: break-word;
}

.info-text a:hover {
    color: var(--primary-color);
}

/* Form Styles */
.contact-form {
    background: var(--dark-gray);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #e2e8f0;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--white);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2e8f0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

select.form-control option {
    background: var(--dark-bg);
    color: var(--white);
}

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

.btn-submit {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border-radius: 8px;
}

/* Footer */
footer {
    background: #0B1120;
    color: var(--text-light);
    text-align: center;
    padding: 2rem 0;
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-section {
    opacity: 0;
    transform: translateY(40px);
    visibility: hidden;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, visibility;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: none;
    visibility: visible;
}

/* Hero Text Animation */
.animated-heading .line {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
}

.animated-heading .word {
    display: inline-block;
    transform: translateY(100%);
    opacity: 0;
    animation: slideUpFade 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animated-heading .line:nth-child(1) .word {
    animation-delay: 0.2s;
}

.animated-heading .line:nth-child(3) .word {
    animation-delay: 0.4s;
}

.animated-heading .line:nth-child(5) .word {
    animation-delay: 0.6s;
}

@keyframes slideUpFade {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Media Queries */
@media (max-width: 992px) {
    .hero {
        padding-top: 150px;
        padding-bottom: 2rem;
        height: auto;
        min-height: auto;
    }

    .hero .hero-container {
        flex-direction: column;
        gap: 1.5rem;
    }

    .hero-content {
        margin-bottom: 0.5rem;
        padding-top: 0;
    }

    .hero-content h1 {
        font-size: 3rem;
    }

    .hero-logo-wrapper {
        justify-content: center;
        margin-top: 0;
        margin-bottom: 1rem;
    }

    .hero-logo-wrapper img {
        width: 220px;
    }

    /* Why Choose Habilis Physio: Text first, image underneath on mobile */
    .features-container {
        flex-direction: column;
        gap: 1.5rem;
        /* Reduced flex gap between text and photo */
    }

    .features-list {
        order: 1;
    }

    .features-image {
        order: 2;
        width: 100%;
        margin-top: 0.5rem;
        /* Reduced extra top margin */
    }

    .contact-container {
        grid-template-columns: 1fr;
        flex-direction: column;
        gap: 2.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }

    .nav-links {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: rgba(255, 255, 255, 0.98);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        /* Changed from center so they don't sit too low */
        padding-top: 5rem;
        /* Set distance from the top navbar */
        transition: 0.3s ease;
    }

    /* Explicitly override link color to dark/black so they are visible on the white mobile menu background */
    .nav-links li a {
        color: var(--dark-bg);
        font-size: 1.25rem;
    }

    .nav-links li a:hover {
        color: var(--primary-color);
    }

    .nav-links.active {
        left: 0;
    }

    .mobile-menu-btn {
        display: block;
        font-size: 2rem;
        margin-right: 0.25rem;
    }

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

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

    .contact-form {
        padding: 2rem 1.5rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin: 0 auto;
    }

    .service-card {
        max-width: 100%;
        flex: 1 1 100%;
    }
}

/* Extra small screens like iPhone SE (375px width) */
@media (max-width: 480px) {
    .container {
        padding: 0 1.25rem;
    }

    .hero-content h1 {
        font-size: 2.2rem;
    }

    .contact-form {
        padding: 1.5rem 1rem;
        width: 100%;
    }

    .info-item {
        gap: 1rem;
    }

    .info-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}