:root {
    /* Modern Premium Palette */
    --primary-color: #1a252f;
    /* Darker, richer slate */
    --accent-color: #2980b9;
    /* Slightly deeper, more professional blue */
    --bg-color: #f0f2f5;
    /* Softer, modern gray background */
    --text-color: #2c3e50;
    /* Dark slate for text */
    --card-bg: #ffffff;
    --border-radius: 12px;
    /* Softer corners */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* Modern shadow */
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    /* Prefer Inter if available */
    line-height: 1.7;
    /* Better readability */
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1600px;
    /* Significantly wider */
    width: 95%;
    /* Responsive width */
    margin: 0 auto;
    padding: 3rem 2rem;
    padding-bottom: 6rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 4rem 2rem;
    /* Even more padding */
    background: var(--primary-color);
    /* Dark Background */
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    color: white;
    /* White text for header info */
}

h1 {
    color: #ffffff;
    /* Explicitly white */
    margin: 0;
    font-size: 2.75rem;
    /* Slightly larger */
    /* Remove gradient as it clashes with dark bg, or make it a subtle glow */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Collapsible Sections */
details,
.static-section {
    background: var(--card-bg);
    margin-bottom: 1.5rem;
    /* More breathing room */
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Subtle border */
    transition: var(--transition);
}

details:hover,
.static-section:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
    /* Micro-interaction */
}

summary,
.static-summary {
    padding: 1.25rem 2rem;
    font-weight: 600;
    color: var(--accent-color);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    transition: background-color 0.2s, color 0.2s;
    font-size: 1.35rem;
    /* Larger */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

summary {
    cursor: pointer;
}

.static-summary {
    cursor: default;
    /* Not clickable */
    padding: 1.25rem 2rem;
    font-weight: 600;
    color: var(--accent-color);
    background-color: var(--card-bg);
    font-size: 1.35rem;
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

h1.static-summary {
    cursor: default;
    /* Not clickable */
    padding: 1.25rem 2rem;
    font-weight: 600;
    color: var(--accent-color);
    background-color: var(--card-bg);
    font-size: 2rem;
    text-align: center;
    justify-content: center;
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

summary:hover {
    background-color: #f1f3f5;
}

summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--accent-color);
    transition: transform 0.3s;
    line-height: 1;
}

details[open]>summary::after {
    transform: rotate(45deg);
}

details[open]>summary {
    border-bottom: 1px solid #eee;
}

.content {
    padding: 1.5rem;
    animation: fadeIn 0.4s ease;
}

/* Level 2 Nesting */
details details {
    box-shadow: none;
    border: 1px solid #e9ecef;
    margin: 1rem 0;
}

details details summary {
    font-size: 1.1rem;
    background-color: #fafafa;
    color: #495057;
}

/* Level 3 Nesting */
details details details {
    border-left: 4px solid var(--accent-color);
    margin-left: 1rem;
}

details details details summary {
    font-size: 1rem;
    font-weight: 500;
    background-color: #fff;
}

/* Lists */
ul {
    padding-left: 1.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Nested lists */
ul ul {
    margin-top: 0.5rem;
    box-shadow: none;
}

li {
    margin-bottom: 0.5rem;
}

/* Tables - Uniform Styling */
.styled-table {
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 0.9em;
    width: 100%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    background: white;
}

.styled-table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    color: var(--text-color);
    vertical-align: top;
}

.styled-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Medicare Coverage Grid - Modern Responsive Layout */
.medicare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 2px solid #333;
    background-color: #2c3e50;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
}

.medicare-item {
    display: flex;
    flex-direction: column;
    border: 1px solid #444;
}

.medicare-header {
    background-color: #d1d9e6;
    color: #1a252f;
    padding: 12px;
    text-align: center;
    font-weight: 700;
    border-bottom: 1px solid #333;
    font-size: 0.95rem;
}

.medicare-content {
    padding: 20px;
    color: #ffffff;
    flex-grow: 1;
}

.medicare-content ul {
    margin: 0;
    padding-left: 1.5rem;
}

.medicare-content li {
    margin-bottom: 8px;
    list-style-type: disc;
}

.medicare-content p {
    margin-top: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    font-style: italic;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .medicare-grid {
        grid-template-columns: 1fr;
    }

    .medicare-table,
    .medicare-table tbody,
    .medicare-table tr,
    .medicare-table td,
    .medicare-table th {
        display: block;
        width: 100%;
    }

    .medicare-table th {
        border-top: 2px solid #333;
    }
}

/* Links */
a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Tracking indicator */
.tracking-active {
    border-left: 3px solid var(--accent-color);
}

/* Floating Export Button */
#export-controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.pdf-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 2px solid white;
}

.pdf-btn:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print Styling */
@media print {
    body {
        font-size: 11pt;
        background-color: white;
        color: black;
    }

    #export-controls,
    footer,
    .close-btn {
        display: none !important;
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    header {
        padding: 1rem;
        margin-bottom: 1rem;
        background: none;
        box-shadow: none;
        color: black;
        border-bottom: 2px solid #000;
    }

    h1 {
        font-size: 1.5rem;
        color: black;
        text-shadow: none;
    }

    details,
    .static-section {
        box-shadow: none;
        border: 1px solid #eee;
        margin-bottom: 1rem;
        break-inside: auto;
        /* Allow sections to break across pages */
    }

    summary,
    .static-summary {
        break-after: avoid;
        /* Try to keep summary with its content */
        color: black !important;
        background-color: #f8f9fa !important;
        font-weight: bold;
        padding: 0.75rem;
        font-size: 12pt;
        border-bottom: 1px solid #ccc;
    }

    /* Hide the + sign icons in print */
    summary::after {
        display: none !important;
    }

    details[open]>summary {
        border-bottom: 1px solid #ccc;
    }

    /* Ensure all text is black for clarity */
    .content,
    p,
    li,
    td {
        color: black !important;
    }

    .content {
        padding: 0.5rem 1rem;
    }

    /* Medicare Grid - Fix for Black & White Print */
    .medicare-grid {
        display: block !important;
        /* Stack columns for narrow paper */
        background-color: white !important;
        border: 1px solid #333 !important;
        color: black !important;
    }

    .medicare-item {
        border: 1px solid #eee !important;
        margin-bottom: 0;
    }

    .medicare-header {
        background-color: #f0f2f5 !important;
        color: black !important;
        border-bottom: 1px solid #333 !important;
        text-align: left;
    }

    .medicare-content {
        color: black !important;
        padding: 10px 15px;
    }

    .medicare-content p {
        color: #333 !important;
    }

    /* Ensure links show URLs in print or just look like text */
    a {
        text-decoration: underline;
        color: #2980b9;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    header {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    h1 {
        font-size: 1.75rem;
        /* Smaller header on mobile */
    }

    /* Reduce padding for nested items on mobile to maximize width */
    details details {
        margin-left: 0.5rem;
        /* Less indentation */
        margin-right: 0;
    }

    details details details {
        margin-left: 0.5rem;
        border-left-width: 3px;
    }

    summary,
    .static-summary {
        padding: 1rem;
        /* Slightly less padding */
        font-size: 1.1rem;
    }

    .content {
        padding: 1rem;
        /* Compact content padding */
    }

    ul {
        padding-left: 1.25rem;
        /* Tighter lists */
    }

    /* Adjust table for mobile if needed, or allow Scroll */
    .styled-table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }
}

/* Footer Styling */
footer {
    text-align: center;
    padding: 4rem 1rem;
    margin-top: 4rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    /* Soft white */
    background: var(--primary-color);
    border-top: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    /* Rounded top corners */
}

footer a {
    color: #fff;
    /* White links */
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.5);
    padding-bottom: 2px;
}

footer a:hover {
    color: white;
    border-bottom: 1px solid white;
    text-decoration: none;
}

/* Modal Styling */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Stay in place */
    z-index: 2000;
    /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgb(0, 0, 0);
    /* Fallback color */
    background-color: rgba(0, 0, 0, 0.5);
    /* Black w/ opacity */
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    /* 5% from the top and centered */
    padding: 2.5rem;
    border: 1px solid #888;
    width: 80%;
    /* Could be more or less, depending on screen size */
    max-width: 700px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-content h2 {
    margin-top: 0;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
    color: var(--primary-color);
}

.modal-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
    font-size: 1.1rem;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

@media (max-width: 600px) {
    .modal-content {
        width: 90%;
        margin: 10% auto;
        padding: 1.5rem;
    }
}

/* Paywall Specific Styling */
.paywall-modal {
    display: none;
    /* Controlled by JS */
    background-color: rgba(0, 0, 0, 0.85);
    /* Darker overlay */
    backdrop-filter: blur(15px);
    /* Stronger blur */
}

.paywall-content {
    background: #ffffff;
    max-width: 500px;
    padding: 3rem;
    text-align: center;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: none;
}

.paywall-content h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 2rem;
    border-bottom: none;
}

.paywall-content p {
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.paywall-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 2rem;
    text-align: left;
}

.paywall-option {
    position: relative;
    cursor: pointer;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.paywall-option:hover {
    border-color: var(--accent-color);
    background-color: #f8fafc;
}

.paywall-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    /* Square for checkbox */
    margin: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paywall-option input[type="checkbox"]::after {
    content: '';
    width: 10px;
    height: 10px;
    background-color: var(--accent-color);
    border-radius: 2px;
    /* Slight round for inner box */
    transform: scale(0);
    transition: transform 0.2s ease;
}

.paywall-option input[type="checkbox"]:checked {
    border-color: var(--accent-color);
}

.paywall-option input[type="checkbox"]:checked::after {
    transform: scale(1);
}

.paywall-option input[type="checkbox"]:checked+.option-text {
    color: var(--primary-color);
    font-weight: 600;
}

/* Highlight the whole box when checked */
.paywall-option:has(input:checked) {
    border-color: var(--accent-color);
    background-color: #f0f9ff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.submit-btn:hover:not(:disabled) {
    background-color: #1a5276;
    /* Darker Blue */
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.submit-btn:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.7;
}

@media (max-width: 600px) {
    .paywall-content {
        padding: 1.25rem;
        width: 85%;
        max-width: 380px;
        /* Limit max width on mobile */
        margin: 10% auto;
    }

    .paywall-content h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .paywall-content p {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }

    .paywall-options {
        gap: 8px;
        margin-bottom: 1.5rem;
    }

    .paywall-option {
        padding: 10px 15px;
    }

    .paywall-option input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
}