/* Define Dark Mode Variables for easy adjustment */
:root {
    /* --- MIDNIGHT BLACK & CYAN THEME --- */
    --bg-primary: #000000;      /* Pure Black (Body BG) */
    --bg-secondary: #0A0A1F;    /* Very Dark Navy/Almost Black (Container/Card BG) */
    --text-color: #E0FFFF;      /* Light Cyan/Azure (Main Text) */
    --highlight-color: #00FFFF; /* Pure Cyan (Primary Highlight/Buttons/Borders) */
    --calendar-bg: #101030;     /* Dark Navy (Calendar Box BG) */
    --grid-text-color: #99FFFF; /* Muted Cyan (Day numbers) */
    --dark-border-color: #1A1A50; /* Dark Blue Border for separation */
    --selection-border: #FFD700;/* Gold border for selected day */
    
    /* Counter Colors (Brown/Gold palette - KEPT FOR FUNCTIONALITY) */
    --brown-base: #FFD700;   
    --brown-mid1: #CC9900;
    --brown-mid2: #996600;
    --brown-dark: #654321;
}

/* -----------------------
| GENERAL STYLES & LAYOUT |
------------------------- */
body {
    font-family: Arial, sans-serif;
    text-align: center;
    padding: 10px;
    background-color: var(--bg-primary);
    color: var(--text-color);
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 10px;
    background-color: var(--bg-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 1.0);
    border-radius: 8px;
    border: 1px solid var(--dark-border-color);
}

h1 {
    color: var(--text-color);
    margin-bottom: 25px;
}

/* -----------------------
| BUTTON STYLES |
------------------------- */
.buttons-group button {
    background-color: var(--highlight-color);
    color: var(--bg-primary); 
    padding: 10px 20px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.1s;
}

.buttons-group button:hover {
    background-color: #00E0E0; 
    transform: translateY(-1px);
}

/* -----------------------
| INTERACTIVE CALENDAR STYLES |
------------------------- */
.calendar-container {
    margin: 20px auto;
    border: 1px solid var(--dark-border-color);
    border-radius: 4px;
    background-color: var(--calendar-bg);
    padding: 15px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 1.2em;
}

.calendar-header button {
    background-color: transparent !important;
    color: var(--highlight-color);
    padding: 5px 10px;
}
.calendar-header button:hover {
    color: var(--text-color);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}

.day-name {
    font-weight: bold;
    color: var(--grid-text-color);
    padding: 5px 0;
    border-bottom: 1px solid var(--dark-border-color);
}

.date-number {
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    color: var(--grid-text-color);
    position: relative;
    background-color: #151540; 
}

.date-number:hover {
    background-color: #202050; 
}

.selected-date {
    outline: 2px solid var(--highlight-color); 
    outline-offset: -2px;
}

.current-date {
    color: var(--text-color);
    font-weight: bold;
    border: 1px solid var(--highlight-color); 
}

/* --- COUNTER COLOR INTENSITY LOGIC (BROWN/GOLD - KEPT) --- */

.date-number.has-counter {
    background-color: var(--brown-base); 
    color: var(--bg-primary);
    font-weight: bold;
}

.date-number.counter-2 {
    background-color: var(--brown-mid1);
}

.date-number.counter-3 {
    background-color: var(--brown-mid2);
    color: white; 
}

.date-number.counter-4 {
    background-color: var(--brown-dark);
    color: white;
}

.inactive {
    color: #333333; 
    cursor: default;
    background-color: transparent !important;
    outline: none !important;
}

.inactive:hover {
    background-color: transparent;
}

/* ---------------------------------
| NEW: COSMETIC PROGRESS BAR STYLES |
--------------------------------- */

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 8px; 
    
    background: rgba(0, 0, 0, 0.98); 
    font-size: 1.5em; 
    color: var(--highlight-color); 
    font-weight: bold;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px; 
}

.loader-graphic {
    position: relative;
    width: 100vw;  /* Viewport Width */
    max-width: 500px;
    height: 100vh;
    
    background-image: url('images/loader.PNG'); 
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
}

/* The Progress Bar Container (#progressBarFill) */
.progress-fill#progressBarFill {
    position: absolute;
    bottom: 39%; 
    left: 70px; 
    width: calc(100% - 140px); /* Full width of the visible track */
    height: 50px; 
    background-color: transparent; /* Rely on the track in the image */
    border-radius: 25px;
    overflow: hidden; /* CRITICAL: Clips the filling bar */
}

/* The actual filling bar element (created using pseudo-element) */
.progress-fill#progressBarFill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; /* The width of the full bar element */
    height: 100%;
    background-color: #4e2601; /* Color that matches the flow/brown bar */
    border-radius: 25px;
    
    /* Apply the continuous, cosmetic animation */
    animation: cosmetic-fill 2s linear infinite; 
}

@keyframes cosmetic-fill {
    0% { transform: translateX(-100%); } /* Bar is completely outside left */
    50% { transform: translateX(0%); } /* Bar fills completely */
    100% { transform: translateX(100%); } /* Bar moves completely off the right, restarting loop */
}

/* -----------------------------------
| PERIOD TRACKING MODE STYLES (KEPT) |
----------------------------------- */

.date-number.current_period {
    background-color: #A05273 !important; 
    color: white !important;
    font-weight: bold;
    border: 1px solid #C71585;
}

.date-number.period_start {
    background-color: #C71585 !important; 
    color: white !important;
    border: 2px solid #FF69B4;
    transform: scale(1.05); 
}

.date-number.predicted_period {
    background-color: #614660; 
    color: #FFC0CB; 
    border: 1px dashed #C71585; 
}

.date-number.predicted_ovulation {
    background-color: #FFD700; 
    color: var(--bg-primary); 
    font-weight: bold;
    border: 2px solid #FFA500;
}

.date-number.fertile_window {
    background-color: #4CAF50; 
    color: white;
    border: 1px solid #388E3C;
}

.date-number.period-mode:hover {
    cursor: pointer;
    background-color: #202050 !important;
}

.date-number.selected-date {
    box-shadow: 0 0 0 3px var(--highlight-color) inset !important; 
    border-color: var(--highlight-color) !important;
}

.date-number.period_end {
    background-color: #C71585 !important; 
    color: white !important;
    border: 2px solid #FF69B4;
    font-weight: bold;
}

.date-number.period_flow {
    background-color: #8C4769 !important; 
    color: white !important;
    border: 1px solid #C71585;
}

/* Modal Styling */
#periodSetupModal > div {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--dark-border-color);
}
#periodSetupModal h3 {
    color: var(--highlight-color) !important;
}
#periodSetupModal input {
    background: #151540 !important;
    color: var(--text-color) !important;
    border: 1px solid var(--dark-border-color) !important;
}
#savePeriodSettingsBtn {
    background-color: #28a745 !important;
}