/* Existing Styles remain... adding Modal styles */

/* ... (Keep existing CSS) ... */

:root {
    /* Soft Pastel Palette - Cute & Baby-Themed */
    --primary-color: #9D84B7;
    /* Soft Lavender */
    --primary-hover: #8A6FA8;
    --accent-pink: #FFC4D6;
    /* Pastel Pink */
    --accent-teal: #9DE2D5;
    /* Mint/Teal */
    --accent-yellow: #FFF5B8;
    /* Buttermilk */
    --current-week-bg: #F3E5F5;
    /* Highlight for current week */

    --bg-cloud: #E6F7FF;
    --bg-gradient-start: #EBF4F5;
    --bg-gradient-end: #FDF2F8;
    /* Subtle pinkish fade */

    --text-color: #4A4A68;
    --text-muted: #8888A0;

    --card-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(255, 255, 255, 0.8);
    --shadow-soft: 0 15px 35px -5px rgba(157, 132, 183, 0.15);
    --shadow-hover: 0 20px 40px -5px rgba(157, 132, 183, 0.25);
    --shadow-highlight: 0 0 20px rgba(157, 132, 183, 0.4);

    --radius-lg: 32px;
    /* Rounder corners */
    --radius-md: 20px;
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-cloud);
    background-image: url('assets/bg.png');
    background-size: 400px;
    background-repeat: repeat;
    min-height: 100vh;
    color: var(--text-color);
    padding: 20px;
    margin: 0;
}

/* Main Wrapper - 3 Column Grid */
.main-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    align-items: start;
}

.container {
    width: 100%;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

header h1 {
    font-weight: 700;
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
    letter-spacing: -0.5px;
}

header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.calculator-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid white;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 10;
    /* Keep above scrolling content if overlap */
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid #D0C4E0;
    background: #FFF;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 1.1rem;
    color: var(--text-color);
    transition: all 0.2s;
    cursor: pointer;
    width: 100%;
}

input[type="date"]:hover,
input[type="date"]:focus {
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 4px rgba(255, 196, 214, 0.2);
    outline: none;
}

.cycle-input-wrapper {
    display: flex;
    align-items: center;
    background: #FFF;
    border: 2px solid #D0C4E0;
    border-radius: var(--radius-md);
    padding: 0.5rem;
    gap: 0.5rem;
}

.cycle-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-gradient-start);
    border-radius: 14px;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cycle-btn:hover {
    background: var(--accent-pink);
    color: white;
    transform: scale(1.1);
}

input[type="number"] {
    flex: 1;
    border: none;
    background: transparent;
    text-align: center;
    font-family: var(--font-main);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

input[type="number"]:focus {
    outline: none;
}

/* Hide spin buttons */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#calculate-btn {
    border: none;
    background: linear-gradient(135deg, #FFC4D6, #FF9EB8);
    color: white;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 25px -5px rgba(255, 158, 184, 0.4);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#calculate-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(255, 158, 184, 0.5);
}

/* Result Section */
#result-container {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#result-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.result-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-soft);
    border: 4px solid #FFF;
    position: relative;
    overflow: hidden;
}

.result-card h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.date-display {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem;
    line-height: 1.2;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    background: #FAFAFC;
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.detail-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Timeline Container */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 2rem;
}

/* Week Card */
.week-card {
    background: rgba(255, 255, 255, 0.75);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    cursor: pointer;
    /* Clickable */
}

.week-card:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.01);
    box-shadow: var(--shadow-hover);
}

.week-card::after {
    content: 'Click for details →';
    position: absolute;
    bottom: 0.4rem;
    right: 1.5rem;
    font-size: 0.8rem;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s;
}

.week-card:hover::after {
    opacity: 1;
}

/* Current Week Highlight */
.week-card.current-week {
    background: #FFFFFF;
    border: 3px solid var(--primary-color);
    box-shadow: var(--shadow-highlight);
    transform: scale(1.02);
    position: relative;
    z-index: 5;
}

.week-card.current-week::before {
    content: 'YOU ARE HERE';
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 10px;
    z-index: 6;
}

/* Week Visual */
.week-visual {
    flex: 0 0 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.week-visual img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.week-card.current-week .week-visual img {
    width: 100px;
    height: 100px;
}

/* Week Content */
.week-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.week-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.week-header h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.week-header .trimester-tag {
    font-size: 0.75rem;
    background: #F0F0F8;
    padding: 4px 8px;
    border-radius: 8px;
    color: var(--text-muted);
}

.week-desc {
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.5;
}

.week-extras {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 500;
}

.tag.test {
    background: #FFF4E5;
    color: #D97706;
    border: 1px solid #FDE68A;
}

.tag.symptom {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

.hidden {
    display: none !important;
}

/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 74, 104, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    /* Allow scrolling inside modal */
    overflow-y: auto;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
    padding: 2rem;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay:not(.hidden) .modal-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

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

.modal-header-visual {
    text-align: center;
    background: radial-gradient(circle at center, #E0F7FA, #FFF);
    padding: 1.5rem 0;
    margin: -2rem -2rem 1.5rem -2rem;
    /* Bleed to edges */
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

#modal-img {
    height: 180px;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
    margin-bottom: 0.5rem;
}

.modal-week-badge {
    background: white;
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    font-size: 1.2rem;
}

.size-badge {
    background: var(--bg-cloud);
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid #D0E8F2;
}

.size-icon {
    font-size: 2rem;
}

.size-text {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-color);
}

.week-date-range {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0.75rem 0;
    font-weight: 500;
    background: #F8F6FC;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
}

#modal-size-name {
    color: var(--primary-color);
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section h4,
.modal-box h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    border-bottom: 2px solid #F0EDF5;
    padding-bottom: 0.25rem;
    display: inline-block;
}

.modal-section p {
    line-height: 1.6;
    color: var(--text-color);
}

.modal-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.modal-box {
    background: #FAFAFC;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid #F0F0F8;
}

.modal-box ul {
    list-style-position: inside;
    margin-top: 0.5rem;
}

.modal-box li {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.modal-box.tips li::marker {
    color: #FBC02D;
}

.modal-box.tests li::marker {
    color: #4CAF50;
}

@media (max-width: 600px) {
    .week-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .week-visual {
        justify-content: center;
    }

    .week-header {
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }

    .week-extras {
        justify-content: center;
    }

    .modal-split {
        grid-template-columns: 1fr;
    }
}

/* Footer & Visit Counter */
footer {
    margin-top: 3rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-bottom: 2rem;
}

#visit-container {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(157, 132, 183, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: transform 0.3s;
}

#visit-container:hover {
    transform: translateY(-2px);
}

.visit-label {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
}

.visit-badge {
    background: var(--accent-pink);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.crypto-note {
    font-size: 0.75rem;
    color: var(--primary-color);
    opacity: 0.7;
}

/* Jump to Week Button */
.jump-btn {
    margin-top: 1.5rem;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
}

.jump-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(157, 132, 183, 0.3);
}

/* Sidebar Styles */
.sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    border: 2px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.3s;
}

.sidebar-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #F0EDF5;
}

.sidebar-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 700;
}

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

.sidebar-list li {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-color);
    border-bottom: 1px solid #F5F5F8;
}

.sidebar-list li:last-child {
    border-bottom: none;
}

.checklist-section {
    margin-top: 1rem;
}

.checklist-section h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .sidebar {
        position: static;
        max-height: none;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .container {
        order: -1;
    }
}

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

    .sidebar-card {
        padding: 1.25rem;
    }

    .sidebar-header h3 {
        font-size: 1rem;
    }

    .sidebar-list li {
        font-size: 0.85rem;
    }
}

/* FAQ Section */
.faq-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-soft);
    border: 2px solid rgba(255, 255, 255, 0.8);
    margin-top: 2rem;
}

.faq-section h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #F0EDF5;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    color: var(--text-color);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.faq-item p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}