:root {
    --primary-color: #0f766e;
    /* Teal 700 */
    --primary-light: #ccfbf1;
    /* Teal 100 */
    --primary-dark: #134e4a;
    /* Teal 800 */
    --accent-color: #2dd4bf;
    /* Teal 400 */
    --text-dark: #1e293b;
    /* Slate 800 */
    --text-light: #64748b;
    /* Slate 500 */
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 12px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding-top: 0;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Background Shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 20s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.shape-1 {
    top: -150px;
    right: -150px;
    width: 600px;
    height: 600px;
    background: #99f6e4;
    /* Teal 200 */
}

.shape-2 {
    bottom: -150px;
    left: -150px;
    width: 500px;
    height: 500px;
    background: #bae6fd;
    /* Sky 200 */
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(50px, 70px) rotate(10deg);
    }
}

/* Main Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0.8rem 2rem;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-logo i {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-search {
    flex: 1;
    max-width: 650px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.header-search .input-wrapper {
    position: relative;
    width: 100%;
}

.header-search input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.8rem;
    border: 1px solid rgba(203, 213, 225, 0.6);
    border-radius: 50px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.8);
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--primary-color);
    background: var(--white);
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.header-search .search-icon-left {
    left: 1rem;
    font-size: 1rem;
}

.header-search .search-results {
    top: calc(100% + 5px);
    border-radius: var(--radius-md);
    max-height: 500px;
}

.btn-calc-header {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 2.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(15, 118, 110, 0.2);
}

.btn-calc-header:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(15, 118, 110, 0.3);
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-top: 80px;
    /* Offset for fixed header */
    min-height: calc(100vh - 160px);
    /* Ensure full height minus header/footer */
    justify-content: center;
    /* Center content vertically */
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    animation: fadeIn 0.8s ease-out;
}

.empty-content {
    max-width: 600px;
    margin: 0 auto;
}

.empty-icon-wrapper {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    border: 4px solid var(--primary-light);
}

.empty-icon-wrapper i {
    font-size: 4rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.empty-state h1 {
    font-size: 2.5rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-weight: 800;
}

.empty-state p {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* Quote Carousel */
.quote-container {
    margin-top: 3rem;
    padding: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.5s ease-in-out;
}

.quote-text {
    font-size: 1.25rem !important;
    /* Override empty-state p */
    font-family: 'Georgia', serif;
    font-style: italic;
    color: var(--text-dark) !important;
    max-width: 500px;
    margin: 0 auto;
}

.quote-author {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

.fade-out {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease;
}

.fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s ease;
}

/* Responsive adjust for header */
@media (max-width: 768px) {
    .main-header {
        padding: 0.8rem 1rem;
        gap: 0.8rem;
    }

    .calc-text {
        display: none;
    }

    .btn-calc-header {
        padding: 0.6rem;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        justify-content: center;
    }

    .header-logo span {
        display: none;
        /* Hide text on very small screens if needed, or keep it */
    }

    .header-logo i {
        font-size: 1.5rem;
    }
}

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

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1.2rem;
    border: 1px solid rgba(203, 213, 225, 0.6);
    /* Slate 300 with opacity */
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-dark);
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.6);
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    background: var(--white);
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-light);
    transform: translateY(-1px);
}

.form-group-row {
    display: flex;
    gap: 1.5rem;
}

.form-group.half {
    flex: 1;
}

/* Search Input Specific */
.search-wrapper {
    position: relative;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon-left {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.2rem;
    pointer-events: none;
    transition: var(--transition);
}

input#diagnosisInput {
    padding-left: 3.5rem;
}

input#diagnosisInput:focus+.search-icon-left {
    color: var(--primary-color);
}

/* Search Results */
.search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    pointer-events: none;
    transition: var(--transition);
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.search-results.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.result-item {
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-item:hover {
    background-color: var(--primary-light);
    padding-left: 2rem;
}

.result-item:last-child {
    border-bottom: none;
}

.result-code {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-dark);
    background: rgba(255, 255, 255, 0.5);
    padding: 4px 8px;
    border-radius: 6px;
    margin-left: 1rem;
    border: 1px solid rgba(15, 118, 110, 0.1);
}

/* Buttons */
.btn-analyze {
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 4px 6px rgba(15, 118, 110, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-analyze::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;
}

.btn-analyze:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px rgba(15, 118, 110, 0.3);
}

.btn-analyze:hover::before {
    left: 100%;
}

.btn-analyze:active {
    transform: translateY(-1px);
}

/* Prescription Card */
.prescription-section {
    width: 100%;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.prescription-card {
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: #fff;
    /* Fallback */
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 2rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.card-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.card-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    z-index: 1;
}

.badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1;
}

.card-body {
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.8);
}

.medication-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--white);
    border-radius: var(--radius-md);
    margin-bottom: 1.2rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.medication-item:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.med-details h4 {
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
    color: var(--primary-dark);
    font-weight: 700;
}

.med-dose-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    margin-left: 0.5rem;
    font-weight: 600;
    vertical-align: middle;
}

.med-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.6rem 0;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.med-instruction {
    font-size: 0.95rem;
    color: var(--text-light);
    font-style: italic;
    background: #f8fafc;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    display: inline-block;
}

.notes-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.notes-section h3 {
    font-size: 1.2rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.notes-section p {
    color: var(--text-dark);
    line-height: 1.7;
    font-size: 1rem;
}

.card-footer {
    padding: 1.5rem 2.5rem;
    background: #f8fafc;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-copy,
.btn-reset {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-copy {
    background: var(--white);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-copy:hover {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.2);
}

.btn-reset {
    background: transparent;
    color: var(--text-light);
    border: 1px solid transparent;
}

.btn-reset:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

/* Legal Footer */
/* Main Footer */
.main-footer {
    width: 100%;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: auto;
    /* Push to bottom if flex column body */
    border-top: 1px solid var(--glass-border);
}

.footer-left,
.footer-right {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-right {
    justify-content: flex-end;
}

.footer-center {
    text-align: center;
    opacity: 0.8;
}

.social-link,
.footer-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.social-link:hover,
.footer-link:hover {
    color: var(--primary-color);
}

.social-link i {
    font-size: 1.1rem;
}

/* Responsive Footer */
@media (max-width: 768px) {
    .main-footer {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
        text-align: center;
    }

    .footer-left,
    .footer-right {
        justify-content: center;
        width: 100%;
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Animations - Improved */
@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);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 2rem 1rem;
    }

    .logo h1 {

        /* Hamburger Menu & Mobile Menu */
        .hamburger-btn {
            display: none;
            /* Hidden on desktop */
            background: transparent;
            border: none;
            font-size: 1.5rem;
            color: var(--primary-color);
            cursor: pointer;
            padding: 0.5rem;
            align-items: center;
            justify-content: center;
        }

        .mobile-menu-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.4);
            backdrop-filter: blur(4px);
            z-index: 2000;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
            display: flex;
            /* Flex to align menu */
            justify-content: flex-end;
            /* Align to right */
        }

        .mobile-menu-overlay:not(.hidden) {
            opacity: 1;
            pointer-events: auto;
        }

        .mobile-menu {
            width: 80%;
            max-width: 320px;
            height: 100%;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border-left: 1px solid rgba(255, 255, 255, 0.8);
            display: flex;
            flex-direction: column;
            padding: 2rem;
            transform: translateX(100%);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
        }

        .mobile-menu-overlay:not(.hidden) .mobile-menu {
            transform: translateX(0);
        }

        .mobile-menu-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
        }

        .mobile-menu-header h3 {
            font-size: 1.5rem;
            color: var(--primary-dark);
        }

        .close-mobile-menu {
            background: none;
            border: none;
            font-size: 1.5rem;
            color: var(--text-light);
            cursor: pointer;
            transition: color 0.3s;
        }

        .close-mobile-menu:hover {
            color: var(--primary-color);
        }

        .mobile-nav {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .mobile-nav-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 1rem;
            background: #f8fafc;
            border-radius: var(--radius-md);
            text-decoration: none;
            color: var(--text-dark);
            font-weight: 500;
            font-size: 1rem;
            border: 1px solid transparent;
            transition: all 0.2s;
            text-align: left;
            width: 100%;
            cursor: pointer;
        }

        .mobile-nav-item:hover {
            background: var(--white);
            color: var(--primary-color);
            border-color: var(--primary-light);
            box-shadow: var(--shadow-sm);
            transform: translateX(5px);
        }

        .mobile-nav-divider {
            border: none;
            height: 1px;
            background: rgba(0, 0, 0, 0.05);
            margin: 1rem 0;
        }

        /* Responsive Triggering */
        @media (max-width: 768px) {

            /* Hide desktop buttons */
            .header-actions,
            #btnOpenICD {
                display: none;
            }

            /* Show hamburger */
            .hamburger-btn {
                display: flex;
            }

            .mobile-menu-overlay.hidden {
                display: none;
                /* Actually hide it from layout when hidden */
            }

            .mobile-menu-overlay {
                display: flex;
                /* Ensure it's flex when active */
            }
        }

    }

    .search-box-container {
        padding: 1.5rem;
    }

    .form-group-row {
        flex-direction: column;
        gap: 0;
    }

    .medication-item {
        flex-direction: column;
        gap: 1rem;
    }

    .card-footer {
        flex-direction: column-reverse;
    }

    .btn-copy,
    .btn-reset {
        width: 100%;
        justify-content: center;
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    background: rgba(30, 41, 59, 0.95);
    color: var(--white);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    font-weight: 500;
}

/* Calculator Modal & Grid */
.calc-btn-container {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.btn-calc {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--primary-light);
    color: var(--primary-dark);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-calc:hover {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.15);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: var(--transition);
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #f8fafc;
    /* Light gray/white background like reference */
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    animation: fadeInUp 0.4s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    font-weight: 600;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #ef4444;
    /* Red X */
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.close-modal:hover {
    transform: scale(1.1);
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
}

.calc-icon-card {
    background: #1e293b;
    /* Dark Slate - "Black Card" look */
    border: 1px solid #334155;
    border-radius: var(--radius-md);
    padding: 1.2rem 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #f8fafc;
    /* White text */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.calc-icon-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    background: #0f172a;
    /* Darker on hover */
    border-color: var(--primary-color);
}

.calc-icon {
    font-size: 2rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
    /* Teal/Emerald accent */
}

.calc-name {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
    opacity: 0.9;
}

/* Specific Calculator Form */
.calc-form-container {
    animation: fadeInDown 0.3s ease-out;
}

.back-to-grid {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.back-to-grid:hover {
    color: var(--primary-color);
}

#calcTitle {
    font-size: 1.3rem;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
    padding-bottom: 0.5rem;
}

.calc-input-group {
    margin-bottom: 1.5rem;
}

.calc-input-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.calc-input-group input[type="number"],
.calc-input-group select {
    width: 100%;
    padding: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
}

.calc-input-group input[type="number"]:focus,
.calc-input-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
    outline: none;
}

.calc-input-group .checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: var(--transition);
}

.calc-input-group .checkbox-wrapper:hover {
    background: #f8fafc;
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.calc-input-group input[type="checkbox"] {
    width: 1.3rem;
    height: 1.3rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.calc-actions {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.btn-analyze.small {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    justify-content: center;
}

.calc-result {
    margin-top: 0;
    padding: 1.5rem;
    background: #f0fdfa;
    /* Very light teal bg */
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-light);
    border-left: 6px solid var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    animation: fadeInUp 0.4s ease-out;
}

.score-display {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 0.8rem;
    line-height: 1;
}

#calcRiskDisplay {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

#calcNoteDisplay {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-light);
    font-style: italic;
    font-size: 0.9rem;
}

/* Calculator Specialized Layout */
.calc-modal-body {
    display: flex;
    flex-direction: column;
    /* Height handled by modal-content max-height */
}

/* Internal Search Bar */
.calc-search-container {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.8rem 1rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.calc-search-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.calc-search-icon {
    color: var(--text-light);
    margin-right: 0.8rem;
}

#calcSearchInput {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem;
    color: var(--text-dark);
}

/* Split Layout */
.calc-layout {
    display: flex;
    gap: 2rem;
    height: 60vh;
    min-height: 400px;
}

/* Sidebar */
.calc-sidebar {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
    padding-right: 1rem;
    overflow-y: auto;
}

.calc-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-dark);
    font-weight: 500;
    margin-bottom: 0.5rem;
    transition: var(--transition);
    font-size: 0.95rem;
}

.calc-category-item:hover {
    background: #f1f5f9;
    color: var(--primary-dark);
}

.calc-category-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(15, 118, 110, 0.2);
}

.cat-count {
    font-size: 0.8rem;
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
}

.calc-category-item.active .cat-count {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

/* Main Area */
.calc-main {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    position: relative;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .calc-layout {
        flex-direction: column;
        height: auto;
        min-height: auto;
    }

    .calc-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 1rem;
        padding-right: 0;
        margin-bottom: 1rem;
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        gap: 0.5rem;
        scrollbar-width: none;
        /* Hide scrollbar for cleaner look */
    }

    .calc-sidebar::-webkit-scrollbar {
        display: none;
    }

    .calc-category-item {
        margin-bottom: 0;
        flex-shrink: 0;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .modal-content {
        padding: 1.5rem;
        width: 95%;
        max-height: 95vh;
    }

    /* Ensure form is scrollable on mobile if tall */
    .calc-main {
        max-height: 50vh;
    }

    .calc-form-container {
        padding-bottom: 2rem;
    }
}

/* Resources Modal Styles */
.resources-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.resource-link {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-dark);
    transition: var(--transition);
}

.resource-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-light);
}

.resource-link i {
    font-size: 2rem;
    color: var(--primary-color);
}

.resource-link div {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.resource-link strong {
    font-size: 1.1rem;
    color: var(--primary-dark);
}

.resource-link span {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* About Modal Styles */
.about-content {
    max-width: 450px;
    padding: 2.5rem;
    text-align: center;
    position: relative;
    overflow: visible;
}

.close-modal-absolute {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.close-modal-absolute:hover {
    color: var(--text-dark);
}

.about-header {
    margin-bottom: 2rem;
}

.about-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-light), white);
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.about-logo i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.about-header h2 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.2rem;
}

.about-header p {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
}

.developer-profile {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-info .role {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.profile-info h3 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 0.8rem;
}

.instagram-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(220, 39, 67, 0.2);
}

.instagram-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(220, 39, 67, 0.3);
}

.about-text p {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.about-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-light);
}


/* Treatment Sections for Enriched ICD-10 Data */
.treatment-section {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 5px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.treatment-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.treatment-section h4 {
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.treatment-section p {
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 1rem;
}

/* Specific Section Styles */
.treatment-section.context {
    border-left-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.03);
}

.treatment-section.primary-rx {
    border-left-color: var(--primary-color);
    background: rgba(14, 165, 233, 0.03);
}

.treatment-section.alt-rx {
    border-left-color: var(--secondary-color);
    background: rgba(16, 185, 129, 0.03);
}

/* Legal Modal Styles */
.legal-content {
    max-width: 700px;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.legal-body {
    overflow-y: auto;
    padding: 1.5rem 0;
}

.legal-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.legal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.legal-section h4 {
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.legal-section p {
    font-size: 0.95rem;
    color: var(--text-dark);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.legal-list {
    list-style-type: none;
    padding-left: 1rem;
}

.legal-list li {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 0.8rem;
    position: relative;
    padding-left: 1.2rem;
}

.legal-list li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.legal-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: right;
    width: 100%;
}

/* Responsive Adjustments */

/* Tablet & Mobile (max-width: 768px) */
@media (max-width: 768px) {

    /* Header */
    .main-header {
        padding: 0.8rem 1rem;
        gap: 0.5rem;
    }

    .header-logo i {
        font-size: 1.6rem;
    }

    .header-logo span {
        font-size: 1.2rem;
    }

    .header-search {
        max-width: none;
        flex: 1;
        margin: 0 0.5rem;
    }

    .header-search input {
        padding: 0.6rem 1rem 0.6rem 2.4rem;
        font-size: 0.9rem;
    }

    .header-search .search-icon-left {
        left: 0.8rem;
    }

    .calc-text {
        display: none;
    }

    .btn-calc-header {
        padding: 0;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        justify-content: center;
    }

    /* Layout */
    .container {
        padding: 1.5rem 1rem;
        margin-top: 70px;
    }

    /* Cards */
    .card-header,
    .card-body,
    .card-footer {
        padding: 1.5rem;
    }

    .card-header h2 {
        font-size: 1.4rem;
    }

    .form-group-row {
        flex-direction: column;
        gap: 1rem;
    }

    .medication-item {
        flex-direction: column;
        gap: 1rem;
        padding: 1.2rem;
    }

    .card-footer {
        flex-direction: column-reverse;
    }

    .btn-copy,
    .btn-reset {
        width: 100%;
        justify-content: center;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        padding: 1.5rem;
    }

    /* Calculator Layout */
    .calc-layout {
        flex-direction: column;
        height: auto;
        gap: 1rem;
    }

    .calc-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding-right: 0;
        padding-bottom: 1rem;
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .calc-sidebar::-webkit-scrollbar {
        height: 4px;
    }

    .calc-sidebar::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }

    .calc-category-item {
        margin-bottom: 0;
        padding: 0.5rem 1rem;
        border: 1px solid #e2e8f0;
        flex-shrink: 0;
    }

    .calc-category-item.active {
        border-color: var(--primary-color);
    }

    .calc-main {
        max-height: 60vh;
        padding-right: 0;
    }

    .calc-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

    .calc-item {
        padding: 1rem;
    }

    .calc-item i {
        font-size: 1.5rem;
    }

    .calc-item h4 {
        font-size: 0.9rem;
    }

    /* Footer */
    .main-footer {
        flex-direction: column;
        gap: 1.5rem;
        padding: 2rem 1rem;
        text-align: center;
    }

    .footer-left,
    .footer-right {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .footer-center {
        order: -1;
        /* Warning first on mobile */
    }
}

/* Mobile Small (max-width: 480px) */
@media (max-width: 480px) {
    .header-logo span {
        display: none;
        /* Icon only for logo on very small screens */
    }

    .main-header {
        padding: 0.6rem 0.8rem;
    }

    .modal-content {
        padding: 1rem;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .close-modal-absolute {
        top: 0.5rem;
        right: 0.5rem;
    }

    .about-content {
        padding: 2rem 1rem;
    }
}

/* Resources Modal Styles */
.resources-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.resource-link {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-dark);
    transition: var(--transition);
}

.resource-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-light);
}

.resource-link i {
    font-size: 2rem;
    color: var(--primary-color);
}

.resource-link div {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.resource-link strong {
    font-size: 1.1rem;
    color: var(--primary-dark);
}


/* About Modal Styles */
.about-content {
    max-width: 450px;
    padding: 2.5rem;
    text-align: center;
    position: relative;
    overflow: visible;
}

.close-modal-absolute {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.close-modal-absolute:hover {
    color: var(--text-dark);
}

.about-header {
    margin-bottom: 2rem;
}

.about-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-light), white);
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.about-logo i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.about-header h2 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.2rem;
}

.about-header p {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
}

.developer-profile {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-info .role {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.profile-info h3 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 0.8rem;
}

.instagram-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(220, 39, 67, 0.2);
}

.instagram-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(220, 39, 67, 0.3);
}

.about-text p {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.about-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ICD Modal Styles */
.icd-content {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.icd-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Contains scroll within list */
    gap: 1rem;
}

.icd-search-container {
    position: relative;
}

.icd-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

#icdSearchInput {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

#icdSearchInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.icd-list-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    background: #f8fafc;
}

.icd-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.icd-item {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background 0.1s;
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.icd-item:hover {
    background: white;
}

.icd-item .code {
    font-weight: 700;
    color: var(--primary-color);
    min-width: 60px;
    font-family: monospace;
    font-size: 1rem;
}

.icd-item .desc {
    color: var(--text-dark);
    font-size: 0.9rem;
}

.icd-footer-info {
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: right;
}
/* Prescription List Styles */
.rx-list {
    list-style-type: disc;
    padding-left: 1.2rem;
    margin: 0;
}

.rx-list li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
    color: var(--text-dark);
}

.rx-list strong {
    color: var(--primary-dark);
    font-weight: 600;
}
