:root {
    /* Main theme colors */
    --primary-blue: #182C4C; /* Deep Navy: Used for your Navigation bar and Footer */
    --medical-blue: #38547A; /* Medium Blue: Used for buttons, lines, and hovers */
    
    /* Background colors */
    --light-bg: #ECDCBC; /* Soft Beige: Used for the main background of the page */
    --white: #ffffff; /* We are keeping the cards white so the text is easy to read! */
    --text-dark: #333; /* Dark grey for standard text */

    /* Extra colors from your new palette saved for later! */
    --accent-grey: #758498; 
    --accent-light: #AEBCCF;
    --accent-blue: #4A6FA5; /* Additional blue for sub-sections */
}

/* --- GLOBAL LAYOUT FIX (Prevents Horizontal Wobble) --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden; /* Strict lock on horizontal scrolling */
    max-width: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--light-bg);
    color: var(--text-dark);
}

/* Navigation */
nav {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--medical-blue) 100%);
    color: var(--white);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}

.logo-link {
    text-decoration: none;
}

nav .logo {
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 1px;
    background: linear-gradient(45deg, var(--white), #e8f4fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--white);
    margin-left: auto;
    margin-right: 1rem;
}

nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin-left: 25px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 20px;
    position: relative;
}

nav ul li a:hover {
    color: var(--accent-light);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

nav ul li a.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--accent-light);
}

/* Tabs */
.tabs-container {
    display: flex;
    justify-content: center;
    background: var(--white);
    border-bottom: 1px solid var(--accent-light);
    margin-bottom: 20px;
}

.tab-button {
    background: none;
    border: none;
    padding: 15px 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    border-bottom: 3px solid transparent;
    transition: 0.3s;
}

.tab-button:hover {
    color: var(--medical-blue);
}

.tab-button.active {
    color: var(--primary-blue);
    border-bottom-color: var(--medical-blue);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Hero Section */
.hero {
    background: linear-gradient(rgba(44, 62, 80, 0.8), rgba(44, 62, 80, 0.8)), 
                url('https://images.unsplash.com/photo-1758574437877-68a1ec5fafc3?q=80&w=1034&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
    background-size: cover;
    background-position: center;
    height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 0 20px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* Main Content */
.container {
    max-width: 1200px;
    width: 95%;
    margin: 3rem auto;
    padding: 0 20px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 40px;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--medical-blue), var(--accent-blue), var(--medical-blue));
    border-radius: 20px 20px 0 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s;
    border-top: 5px solid var(--medical-blue);
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    margin-top: 0;
    color: var(--primary-blue);
}

.btn {
    display: inline-block;
    background: var(--medical-blue);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 0.9rem;
}

.btn2 {
    display: inline-block;
    background: var(--medical-blue);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 0.9rem;
}

/* Reminder Box */
.alara-box {
    background: #e8f4fd;
    border-left: 10px solid var(--medical-blue);
    padding: 20px;
    margin: 40px 0;
}

/* Footer */
footer {
    background: var(--primary-blue);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 40px;
}

/* --- Desktop Toggle Visibility (Hidden) --- */
.nav-toggle {
    display: none; /* Hides the actual checkbox */
}

.nav-toggle-label {
    display: none; /* Hides the hamburger icon on desktop */
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--white);
    margin-left: auto; /* Pushes it to the right */
}

/* --- Mobile Navigation Rules --- */
@media (max-width: 768px) {
    nav {
        flex-direction: row;
        justify-content: space-between;
        padding: 1rem 20px;
    }
    
    /* Show the hamburger icon */
    .nav-toggle-label {
        display: block; 
    }
    
    /* Hide the menu by default on mobile and style it as a dropdown */
    nav ul.nav-menu {
        display: none; 
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--primary-blue);
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
        padding: 10px 0;
        margin: 0;
    }
    
    nav ul.nav-menu li {
        margin: 0;
        text-align: center;
    }
    
    nav ul.nav-menu li a {
        display: block;
        padding: 15px 20px;
        border-radius: 0; /* Remove pill shape for dropdown items */
    }

    /* THE MAGIC: When the checkbox is checked, display the menu */
    #nav-toggle:checked ~ ul.nav-menu {
        display: flex;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
}

/* --- POSITIONING TEMPLATE SPECIFIC STYLES --- */
        
        .pos-header-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid var(--accent-light);
        }

        .back-link {
            color: var(--medical-blue);
            text-decoration: none;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: transform 0.2s ease;
        }

        .back-link:hover {
            transform: translateX(-5px);
            color: var(--primary-blue);
        }

        /* Trauma Toggle Switch */
        .toggle-container {
            display: flex;
            align-items: center;
            gap: 15px;
            background: #fdfdfd;
            padding: 12px 25px;
            border-radius: 30px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.08);
            border: 1px solid var(--accent-light);
            transition: all 0.3s ease;
        }

        .toggle-container:hover {
            box-shadow: 0 6px 20px rgba(0,0,0,0.12);
            transform: translateY(-1px);
        }

        .toggle-label {
            font-weight: 600;
            color: var(--text-dark);
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 26px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0; left: 0; right: 0; bottom: 0;
            background-color: var(--medical-blue);
            transition: .4s;
            border-radius: 34px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .slider {
            background-color: #d9534f; /* Red for Trauma */
        }

        input:checked + .slider:before {
            transform: translateX(24px);
        }

        /* Two-Column Layout */
        .pos-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 40px;
            align-items: start;
        }

        /* Left Column: Workflow Steps */
        .workflow-step {
            background: var(--white);
            border-left: 5px solid var(--medical-blue);
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.03);
            margin-bottom: 20px;
            transition: all 0.3s ease;
        }

        .workflow-step:hover {
            box-shadow: 0 6px 15px rgba(56, 84, 122, 0.1);
            transform: translateY(-2px);
        }

        .workflow-step h3 {
            color: var(--primary-blue);
            margin-top: 0;
            display: flex;
            align-items: center;
            gap: 12px;
            border-bottom: 1px dashed var(--accent-light);
            padding-bottom: 12px;
            font-size: 1.25rem;
        }

        .step-icon {
            width: 32px;
            height: 32px;
            background: var(--medical-blue);
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 0.9rem;
            flex-shrink: 0;
        }

        .workflow-step p, .workflow-step ul {
            margin-bottom: 0;
            color: var(--text-dark);
            font-size: 0.95rem;
        }

        .workflow-step ul, .workflow-step ol {
            padding-left: 20px;
            margin-top: 8px;
        }

        .workflow-step li {
            margin-bottom: 5px;
        }

        /* Trauma Specific Content (Hidden by default) */
        .trauma-content {
            display: none;
            color: #d9534f;
            font-weight: 500;
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px dashed #fadcdb;
        }

        /* Right Column: Tabbed Visuals */
        .visuals-panel {
            position: sticky;
            top: 100px; /* Keeps images on screen while scrolling text */
        }

        .image-tabs {
            display: flex;
            background: #f8fafc;
            border-radius: 12px 12px 0 0;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0,0,0,0.06);
            border: 1px solid #e2e8f0;
            border-bottom: none;
        }

        .img-tab {
            flex: 1;
            padding: 14px 16px;
            text-align: center;
            background: none;
            border: none;
            font-weight: 600;
            color: var(--accent-grey);
            cursor: pointer;
            transition: all 0.3s ease;
            border-bottom: 3px solid transparent;
            position: relative;
            font-size: 0.95rem;
        }

        .img-tab:hover {
            background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
            color: var(--medical-blue);
            transform: translateY(-1px);
        }

        .img-tab.active {
            color: var(--primary-blue);
            border-bottom-color: var(--medical-blue);
            background: var(--white);
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        .img-tab.active::after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 50%;
            transform: translateX(-50%);
            width: 80%;
            height: 3px;
            background: linear-gradient(90deg, var(--medical-blue), var(--accent-blue));
            border-radius: 2px 2px 0 0;
        }

        .img-content {
            display: none;
            background: var(--white);
            padding: 24px;
            border-radius: 0 0 12px 12px;
            box-shadow: 0 8px 25px rgba(0,0,0,0.08);
            border: 1px solid #e2e8f0;
            border-top: none;
            animation: slideIn 0.4s ease-out;
        }

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

        .img-content.active {
            display: block;
        }

        .img-content img {
            max-width: 100%; /* Never wider than the container */
            max-height: 450px; /* The "ceiling" - it will never get taller than this */
            width: auto; 
            height: auto;
            object-fit: contain; /* Guarantees the image never squishes or stretches */
            display: block; 
            margin: 0 auto; /* Perfectly centers the image if it is narrower than the box */
            border-radius: 8px;
            background: var(--light-bg);
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            transition: transform 0.3s ease;
        }

        .img-caption {
            text-align: center;
            font-size: 0.9rem;
            color: var(--accent-grey);
            margin-top: 16px;
            font-style: italic;
            padding: 12px;
            background: #f8fafc;
            border-radius: 6px;
            border-left: 3px solid var(--medical-blue);
        }

        .evaluation-box {
            background: linear-gradient(135deg, #e8f4fd 0%, #f0f7ff 100%);
            border-radius: 16px;
            padding: 30px;
            margin-top: 50px;
            border-left: 6px solid var(--accent-blue);
            box-shadow: 0 8px 25px rgba(56, 84, 122, 0.08);
            position: relative;
            overflow: hidden;
        }

        .evaluation-box::before {
            content: '✓';
            position: absolute;
            top: 20px;
            right: 20px;
            font-size: 2rem;
            color: var(--medical-blue);
            opacity: 0.3;
        }

        .evaluation-box h2 {
            color: var(--primary-blue);
            margin-top: 0;
            font-size: 1.4rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .evaluation-box ul {
            padding-left: 0;
            list-style: none;
        }

        .evaluation-box li {
            margin-bottom: 12px;
            padding: 12px 16px;
            background: rgba(255, 255, 255, 0.7);
            border-radius: 8px;
            border-left: 4px solid var(--medical-blue);
            transition: all 0.3s ease;
        }

        .evaluation-box li:hover {
            background: rgba(255, 255, 255, 0.9);
            transform: translateX(5px);
        }

        .evaluation-box strong {
            color: var(--primary-blue);
        }

        /* Mobile Layout */
        @media (max-width: 992px) {
            .pos-grid {
                grid-template-columns: 1fr;
            }
            .visuals-panel {
                position: static;
                margin-bottom: 30px;
            }
            .pos-header-actions {
                flex-direction: column;
                align-items: flex-start;
                gap: 15px;
            }
        }

        /* Back to Top Button */
        .back-to-top {
            position: fixed;
            bottom: 30px;
            right: 30px;
            background: var(--medical-blue);
            color: white;
            border: none;
            border-radius: 50px;
            padding: 12px 20px;
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            transition: all 0.3s ease;
            z-index: 1000;
        }

        .back-to-top:hover {
            background: var(--primary-blue);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0,0,0,0.2);
        }

        /* Clean Page Title Section */
        .page-title {
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid var(--medical-blue);
        }

        .page-title h1 {
            margin: 0;
            color: var(--primary-blue);
            font-size: 2rem;
            font-weight: 600;
        }

        .page-title p {
            margin: 8px 0 0 0;
            color: var(--accent-grey);
            font-size: 0.95rem;
        }

/* --- POSITIONING HUB LAYOUT --- */
/* Ensure the layout stacks top-to-bottom universally */
        .positioning-layout {
            display: flex;
            flex-direction: column; 
            align-items: center; 
            gap: 30px;
            position: relative; 
        }

        /* Completely disable sticky, max-height, and internal scrolling */
        .sticky-map {
            position: static !important; /* Stops it from following you down the page */
            max-height: none !important; /* Allows the SVG to be its full height */
            overflow-y: visible !important; /* Removes the scrollbar inside the box */
            width: 100%;
            max-width: 400px; /* Keeps the SVG at a reasonable size */
            margin: 0 auto 30px auto; 
            flex: none; /* Removes old flex constraints */
            z-index: 10;
        }

        .content {
            flex: 1;
            width: 100%; 
            min-width: 0; 
        }

.page-header {
    margin-bottom: 30px;
}

.eyebrow {
    color: var(--medical-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.82rem;
    margin-bottom: 8px;
    display: inline-block;
}

.page-header h1 {
    margin: 0;
    font-size: 2.5rem;
    letter-spacing: -0.03em;
}

.intro-text {
    color: var(--accent-grey);
    max-width: 720px;
    line-height: 1.8;
    margin-top: 14px;
}

.regions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-top: 2rem;
}

.region-card-link {
    text-decoration: none;
    color: inherit;
}

.region-card {
    background: var(--white);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.region-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 36px rgba(0,0,0,0.12);
}

.card-image {
    height: 250px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.0) 0%, rgba(24,44,76,0.35) 100%);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 10px;
    min-height: 50px;
}

.card-content h3 {
    margin: 0;
    color: var(--primary-blue);
    font-size: 1.4rem;
}

.card-content p {
    margin: 0;
    color: var(--accent-grey);
    font-size: 0.96rem;
    line-height: 1.6;
}

@media (max-width: 1024px) {
    .positioning-layout {
        flex-direction: column;
        padding: 0 16px;
    }

    .sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .regions-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .region-card {
        min-height: auto;
    }

    .card-image {
        height: 180px;
    }

    .content {
        padding: 24px;
    }
}

/* Sidebar Styling */
.sidebar {
    width: 240px;
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    height: fit-content;
}

.sidebar h3 {
    color: var(--primary-blue);
    border-bottom: 2px solid var(--medical-blue);
    padding-bottom: 12px;
    margin-top: 0;
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar ul li {
    margin-bottom: 10px;
}

.sidebar ul li a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    display: block;
    padding: 8px;
    border-radius: 4px;
    transition: 0.3s;
}

.sidebar ul li a:hover {
    background: var(--light-bg);
    color: var(--primary-blue);
}

/* Region expandable buttons */
.region-btn {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: 8px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: 0.3s;
    font-size: 0.95rem;
}

.region-btn:hover {
    background: var(--light-bg);
    color: var(--primary-blue);
}

.region-btn.active {
    color: var(--primary-blue);
    font-weight: 600;
}

.expand-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 0.8rem;
    transition: 0.3s;
}

/* Expandable region details */
.region-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.region-details.active {
    max-height: 500px;
}

.region-details ul {
    list-style: none;
    padding-left: 20px;
    margin: 0;
}

.region-details li {
    margin-bottom: 6px;
}

.region-details a {
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.9rem;
    display: block;
    padding: 4px 8px;
    border-radius: 3px;
    transition: 0.2s;
}
.region-details a:hover {
    background: rgba(56, 84, 122, 0.1);
    color: var(--medical-blue);
}

/* Main content styling */
.content {
    flex: 1;
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.content h1 {
    color: var(--primary-blue);
    border-bottom: 2px solid var(--medical-blue);
    padding-bottom: 15px;
    margin-bottom: 30px;
    font-size: 2.5rem;
}

.region-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--accent-light);
}

.region-section:last-child {
    border-bottom: none;
}

.region-section h2 {
    color: var(--primary-blue);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.region-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
}

.region-text {
    line-height: 1.6;
}

.region-text h3 {
    color: var(--medical-blue);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.region-text ul {
    margin: 10px 0;
    padding-left: 20px;
}

.region-text li {
    margin-bottom: 8px;
}

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

.region-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Responsive design */
@media (max-width: 768px) {
    .positioning-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        margin-bottom: 20px;
    }

    .region-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .content {
        padding: 20px;
    }

    .content h1 {
        font-size: 2rem;
    }
}

.special-section {
    margin-top: 20px;
    border-top: 1px solid var(--accent-light);
    padding-top: 10px;
}

/* Interactive Body Map */
.map-container {
    flex: 1;
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
}

.body-svg {
    max-height: 500px;
    width: 100%;
}

.body-part {
    fill: var(--accent-light);
    stroke: var(--primary-blue);
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 0px rgba(0, 0, 0, 0));
    
    /* ADD THESE TWO LINES SO THE LIMBS SCALE PROPERLY */
    transform-origin: center; 
    transform-box: fill-box;
}

.body-part:hover {
    fill: var(--medical-blue);
    transform: scale(1.02); /* Reduced from 1.05 for a much gentler bump */
    stroke-width: 2.5; /* Slightly thinner border on hover */
    filter: drop-shadow(0 0 4px rgba(56, 84, 122, 0.4)); /* Softer, tighter glow */
}

/* Tooltip Styling */
#regionTooltip {
    display: none;
    position: fixed;
    background: var(--primary-blue);
    color: var(--white);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    line-height: 1.5;
    max-width: 200px;
    word-wrap: break-word;
    animation: tooltipFadeIn 0.2s ease-in-out;
}

#regionTooltip strong {
    display: block;
    color: var(--accent-light);
    margin-bottom: 4px;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- POSITIONING GUIDE TEMPLATE --- */
.guide-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--medical-blue) 100%);
    color: var(--white);
    padding: 3rem 5%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* --- UNIQUE PAGE HEADER BACKGROUNDS --- */

/* Pathology: Microscopic/cellular vibe */
.guide-header.pathology-bg {
    background: linear-gradient(rgba(24, 44, 76, 0.85), rgba(56, 84, 122, 0.85)), 
                url('https://t4.ftcdn.net/jpg/16/01/48/07/360_F_1601480743_ZsKHd7nsb4fYuuVkEy51i3zluQfofvzK.jpg');
    background-size: cover;
    background-position: center;
}

/* Physics: High-tech machinery/equipment vibe */
.guide-header.physics-bg {
    background: linear-gradient(rgba(24, 44, 76, 0.85), rgba(56, 84, 122, 0.85)), 
                url('https://cdn.flabs.in/webassets/2bdf67f69974fb1bc2d5.jpg');
    background-size: cover;
    background-position: center;
}

/* Image Evaluation: Looking at screens/data vibe */
.guide-header.evaluation-bg {
    background: linear-gradient(rgba(24, 44, 76, 0.85), rgba(56, 84, 122, 0.85)), 
                url('https://images.unsplash.com/photo-1551076805-e1869033e561?q=80&w=1200&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
}

/* Positioning: Hospital room/clinical vibe */
.guide-header.positioning-bg {
    background: linear-gradient(rgba(24, 44, 76, 0.85), rgba(56, 84, 122, 0.85)), 
                url('https://centersurgentcare.net/wp-content/uploads/2025/06/radiographic-positioning-techniques.jpg');
    background-size: cover;
    background-position: center 30%;
}

/* Radiographic Protocols: Hospital room/clinical vibe */
.guide-header.protocol-bg {
    background: linear-gradient(rgba(24, 44, 76, 0.85), rgba(56, 84, 122, 0.85)), 
                url('https://static.vecteezy.com/system/resources/thumbnails/070/167/223/small/a-person-in-blue-gloves-holding-up-an-x-ray-image-photo.jpg');
    background-size: cover;
    background-position: center 30%;
}

.guide-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="10" cy="50" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="90" cy="30" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.guide-header h1 {
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.guide-header p {
    font-size: 1.2rem;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto 1.5rem auto;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.progress-indicator {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    display: inline-block;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.progress-indicator #currentCase {
    color: var(--accent-light);
    font-size: 1.1rem;
}

.image-row {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.image-placeholder {
    flex: 1;
    background: var(--accent-light);
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--primary-blue);
    font-weight: bold;
    border: 2px dashed var(--primary-blue);
}

.info-section {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 5px solid var(--medical-blue);
}

.trauma-paed {
    border-left: 5px solid var(--accent-grey);
    background: #fdfdfd;
}

/* --- PATHOLOGY FLASHCARD STYLES --- */

/* The space the card lives in (gives the 3D perspective) */
.flashcard-scene {
    perspective: 800px;
    width: 100%;
    max-width: 550px;
    height: 450px;
    margin: 0 auto 30px auto;
}

/* Update the transition on your existing .flashcard class */
.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    /* UPDATED: Faster transform and added opacity for smooth fading */
    transition: transform 0.5s ease-in-out, opacity 0.4s ease-in-out; 
    transform-style: preserve-3d; 
    cursor: pointer;
    border-radius: 15px;
    animation: cardEntrance 0.6s ease-out;
}

/* --- ADD THESE NEW SWIPE CLASSES BELOW IT --- */
.swipe-out-left {
    /* Moves card left, fades out, and forces it to face forward */
    transform: translateX(-100%) rotateY(0deg) !important;
    opacity: 0 !important;
}

.swipe-out-right {
    /* Moves card right, fades out, and forces it to face forward */
    transform: translateX(100%) rotateY(0deg) !important;
    opacity: 0 !important;
}

.no-transition {
    /* Used to snap the card invisibly to the other side before sliding back in */
    transition: none !important;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: scale(0.8) rotateY(-20deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

/* This class gets added by JavaScript when clicked! */
.flashcard.is-flipped {
    transform: rotateY(180deg);
}

/* The faces of the card - SIMPLIFIED */
.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08); /* Softer, elegant shadow */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: var(--white); /* Clean white background */
    border: 1px solid rgba(0,0,0,0.05); /* Barely visible border instead of thick blue */
    transition: all 0.3s ease;
}

.card-front, .card-back {
    color: var(--primary-blue);
    text-align: center;
}

.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none; /* Removed the dashed borders */
    padding: 10px;
}

/* Radiopaedia Credit Notice */
.credit-notice {
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent-grey);
    margin-top: 15px;
    margin-bottom: 30px;
    font-style: italic;
}

/* Dual Button Layout */
.nav-buttons-container {
    display: none; /* Hidden until card flips */
    display: flex;
    justify-content: center;
    gap: 50px;
    margin-top: 25px;
}

.btn-outline {
    display: inline-block;
    background: transparent;
    color: var(--medical-blue);
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--medical-blue);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: var(--light-bg);
    transform: translateY(-2px);
}

.image-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.7;
}

.front-hint {
    font-weight: normal !important;
    font-size: 0.9rem !important;
    color: var(--accent-grey) !important;
    margin-top: 15px !important;
    font-style: italic;
}

.card-front:hover {
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
    transform: translateY(-5px);
}

.card-front:hover {
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
    transform: translateY(-5px);
}

/* Back of the card (The Labeled Image) */
.card-back {
    background: linear-gradient(135deg, var(--white) 0%, #f8f9fa 100%);
    color: var(--primary-blue);
    transform: rotateY(180deg);
    text-align: center;
}

/* We remove the h2 and p styles here since they moved to the bottom box */

/* The hidden details box below the card */
.pathology-details {
    display: none; /* Hidden by default! */
    background: linear-gradient(135deg, var(--white) 0%, #f8f9fa 100%);
    padding: 25px;
    border-radius: 12px;
    border-left: 6px solid var(--medical-blue);
    margin-top: 60px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease-in-out;
}

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

/* --- Hero Upgrades --- */
.hero-content {
    animation: fadeIn 0.8s ease-out;
}

.hero-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: inline-block;
    margin-bottom: 20px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.hero-btn-primary {
    background: var(--medical-blue);
    font-weight: 600;
    padding: 12px 25px;
    border: 2px solid var(--medical-blue);
    border-radius: 30px;
    transition: all 0.3s ease;
}

.hero-btn-primary:hover {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    transform: translateY(-3px);
}

.hero-btn-secondary {
    background: transparent;
    border: 2px solid white;
    font-weight: 600;
    padding: 12px 25px;
    border-radius: 30px;
    transition: all 0.3s ease;
}

.hero-btn-secondary:hover {
    background: white;
    color: var(--primary-blue);
    transform: translateY(-3px);
}

.pathology-details h3 {
    color: var(--primary-blue);
    margin-top: 0;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.pathology-details p {
    line-height: 1.7;
    margin-bottom: 15px;
}

.pathology-details ul {
    margin: 15px 0;
    padding-left: 20px;
}

.pathology-details li {
    margin-bottom: 8px;
    color: var(--text-dark);
}

/* Next button container */
.next-btn-container {
    display: none;
    text-align: center;
    margin-top: 30px;
}

.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--medical-blue) 0%, var(--accent-blue) 100%);
    color: white;
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 25px;
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(56, 84, 122, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 84, 122, 0.4);
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--medical-blue) 100%);
}
/* Responsive design for pathology page */
@media (max-width: 768px) {
    .flashcard-scene {
        max-width: 100%;
        height: 380px; /* Adjusted to a better height for phone screens */
        perspective: 600px;
    }
    
    .card-face {
        padding: 5px;
    }

    .image-placeholder {
        padding: 5px; /* Gives the image maximum room to breathe */
    }
    
    .card-front {
        font-size: 1rem;
    }
    
    .guide-header {
        padding: 2rem 5%;
    }
    
    .guide-header h1 {
        font-size: 2rem;
    }
    
    .guide-header p {
        font-size: 1rem;
    }
    
    .container {
        margin: 1.5rem auto;
        padding: 15px;
    }
    
    .pathology-details {
        padding: 20px;
        margin-top: 30px; 
    }

    /* Fix the Prev/Next buttons so they sit perfectly side-by-side */
    .nav-buttons-container {
        gap: 10px;
        margin-top: 20px;
        width: 100%;
    }

    .nav-buttons-container .btn {
        padding: 12px 10px;
        font-size: 0.9rem;
        flex: 1; /* Makes both buttons take up exactly equal space */
        text-align: center;
        white-space: nowrap;
    }
}


/* --- FEEDBACK / CONTACT FORM --- */
.feedback-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f4fd 100%);
    padding: 40px;
    border-radius: 15px;
    margin-top: 60px;
    border-left: 6px solid var(--medical-blue);
    box-shadow: 0 8px 25px rgba(0,0,0,0.05);
    align-items: center;
}

.feedback-content h2 {
    color: var(--primary-blue);
    margin-top: 0;
    font-size: 2rem;
    margin-bottom: 15px;
}

.feedback-content p {
    color: var(--accent-grey);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0;
}

/* Force vertical stacking */
.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 18px; /* slightly more breathing room */
    width: 100%; 
}

/* Premium Text Box Styling */
.feedback-form input,
.feedback-form textarea {
    display: block; /* Guarantees it drops to a new line */
    width: 100%;
    padding: 16px 20px; /* Larger, more comfortable clickable area */
    border: 2px solid #e1e8ed; /* Softer, thicker premium border */
    border-radius: 10px; /* Rounder modern corners */
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-dark);
    background: #fdfdfd;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* How the boxes look when you click inside them */
.feedback-form input:focus,
.feedback-form textarea:focus {
    outline: none;
    border-color: var(--medical-blue);
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(56, 84, 122, 0.08); /* Gentle blue shadow instead of a harsh black line */
    transform: translateY(-1px); /* Tiny lift effect */
}

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

/* Button Styling Fix */
.submit-btn {
    display: block; /* Forces button completely below the text box */
    width: 100%;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 16px;
    border-radius: 10px;
    margin-top: 5px; /* Push down slightly from the textarea */
    transition: background 0.3s ease, transform 0.2s ease;
}

.submit-btn:hover {
    background-color: var(--medical-blue);
    transform: translateY(-2px); /* Button lifts slightly on hover */
}

/* Make the button look unclickable */
.card.disabled .btn {
    background: var(--accent-grey);
    pointer-events: none; /* Physically stops the button from being clicked */
}

/* Adds a neat little "Coming Soon" badge to the top right */
.card.disabled::after {
    content: "Coming Soon";
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent-grey);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* =========================================
   MASTER MOBILE RESPONSIVENESS (PHONES)
   ========================================= */
@media (max-width: 768px) {

    /* --- REFERRAL PRACTICE MOBILE FIXES --- */
    .dynamic-text {
        padding: 1px 3px; /* Shrink the background padding a bit */
    }

    /* Shrink the font sizes so they fit the smaller, scaled-down image lines */
    #ptName { font-size: 0.8rem; }
    #ptDOB { font-size: 0.8rem; }
    #ptRegion { font-size: 0.85rem; }
    #clinicalHistory { 
        font-size: 0.85rem; 
        line-height: 1.3; /* Tighter line spacing for mobile */
        width: 85%; /* Give it a tiny bit more room to breathe horizontally */
    }

    /* --- 1. FEEDBACK FORM FIXES --- */
    .feedback-section {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 30px 20px;
    }
    .success-container {
        grid-column: 1 / -1;
    }

    /* --- 2. PATHOLOGY FLASHCARD FIXES --- */
    .flashcard-scene {
        width: 100% !important;
        height: 350px !important;
        max-height: none !important;
        perspective: 1000px !important;
        margin-bottom: 20px !important;
        z-index: 10 !important;
    }
    .card-face { padding: 10px !important; }
    .image-placeholder { padding: 0 !important; overflow: hidden !important; }
    .image-placeholder img { max-width: 100% !important; max-height: 100% !important; object-fit: contain !important; }
    .pathology-details { width: 100% !important; margin-top: 15px !important; padding: 15px !important; }
    .nav-buttons-container { gap: 10px !important; margin-top: 15px !important; width: 100% !important; display: flex !important; }
    .nav-buttons-container .btn { padding: 12px 5px !important; flex: 1 !important; text-align: center; }
    .card.disabled { opacity: 0.65; filter: grayscale(80%); pointer-events: none; border-top: 5px solid var(--accent-grey); transform: none !important; }

    /* --- 3. POSITIONING PAGES POLISH --- */
    
    /* Header & Action Bar */
    .page-title h1 { font-size: 1.8rem; }
    .pos-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        border-bottom: none;
        padding-bottom: 0;
    }
    
    /* "Back to Protocols" Button Upgrade */
    .back-link {
        background: #e8f4fd;
        padding: 14px 20px;
        border-radius: 12px;
        justify-content: center;
        border: 2px solid var(--accent-light);
        font-size: 1.05rem;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
        color: var(--primary-blue);
    }
    
    /* The Routine/Trauma Slider Box */
    .toggle-container {
        justify-content: space-between;
        width: 100%;
        padding: 15px 20px;
        border-radius: 12px;
    }
    
    /* Workflow Layout */
    .pos-grid { grid-template-columns: 1fr; gap: 20px; }
    .workflow-step { padding: 18px; border-left-width: 5px; }
    
    /* Setup & Radiograph Tabs (iOS segmented style) */
    .image-tabs {
        background: #e2e8f0;
        border-radius: 12px;
        padding: 6px;
        gap: 6px;
        border: none;
    }
    .img-tab {
        border-radius: 8px;
        padding: 12px;
        border: none;
        background: transparent;
        font-size: 0.95rem;
    }
    .img-tab.active {
        background: var(--white);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        color: var(--primary-blue);
    }
    .img-tab.active::after { display: none; }
    
    /* Picture Size Restriction */
    .img-content {
        padding: 15px;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
        margin-top: 15px;
    }
    .img-content img {
        max-height: 280px !important; /* Perfect height for phone screens */
        width: 100%;
        object-fit: contain;
    }
    
    /* Image Criteria Box */
    .evaluation-box { padding: 20px; border-radius: 12px; margin-top: 30px; }
    .evaluation-box::before { font-size: 4rem; top: -5px; right: 5px; }
    .evaluation-box h2 { font-size: 1.3rem; }
    
    /* "Top" Button FAB (Floating Action Button) */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        padding: 0;
        border-radius: 50%;
        text-align: center;
        line-height: 50px;
        font-size: 0; /* Hides the ugly "Top" text */
        box-shadow: 0 6px 15px rgba(0,0,0,0.3);
    }
    .back-to-top::after {
        content: "↑";
        font-size: 1.5rem;
        color: white;
    }
}