:root {
    --c-bg: #e5e5e5;
    --c-card: #ffffff;
    --c-text: #000000;
    --c-accent-yellow: #f4e409;
    --c-accent-green: #00ff00;
    --c-accent-pink: #ff00ff;
    --border-thick: 3px solid black;
    --shadow-hard: 4px 4px 0px black;
    --font-main: 'Space Mono', 'Courier New', monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 1rem;
    font-family: var(--font-main);
    color: var(--c-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.bg-scanline {
    background-color: var(--c-bg);
    background-image: radial-gradient(#000 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Header */
.header-container {
    background: var(--c-card);
    border: var(--border-thick);
    box-shadow: var(--shadow-hard);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title h1 {
    margin: 0;
    font-size: 2.25rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.header-title p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.header-status {
    text-align: right;
    font-weight: bold;
}

.header-status p {
    margin: 0;
}

.social-icons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: black;
    transition: transform 0.1s;
}

.social-icons a:hover {
    transform: translateY(-2px);
    color: var(--c-accent-pink);
}

.social-icons svg {
    fill: currentColor;
}

.status-online {
    color: var(--c-accent-green);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* Ticker */
.ticker-container {
    background: var(--c-accent-yellow);
    border: var(--border-thick);
    box-shadow: var(--shadow-hard);
    margin-bottom: 2rem;
    overflow: hidden;
    white-space: nowrap;
    padding: 0.5rem 0;
    font-weight: bold;
    font-size: 1.125rem;
}

.ticker-content {
    display: inline-block;
    animation: marquee 20s linear infinite;
    padding-left: 100%;
}

@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .main-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .main-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Cards */
.card {
    background: var(--c-card);
    border: var(--border-thick);
    box-shadow: var(--shadow-hard);
    padding: 0.75rem;
    position: relative;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.city-code {
    font-size: 1.5rem;
    font-weight: bold;
}

.timezone-tag {
    background: black;
    color: white;
    padding: 0.25rem 0.5rem;
    font-weight: bold;
}

.card-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 0.5rem;
}

.time-date-group {
    text-align: right;
}

.time-display {
    font-size: 1.75rem;
    font-weight: bold;
    letter-spacing: 0.1em;
}

.date-display {
    font-size: 0.875rem;
    font-weight: bold;
    margin-top: 0.25rem;
}

/* .card-footer removed */

.weather-info {
    font-size: 0.875rem;
    font-weight: bold;
}

.sound-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.sound-btn:hover {
    color: var(--c-accent-green);
}

.you-badge {
    position: absolute;
    top: -1.5rem;
    right: -1.5rem;
    background: var(--c-accent-pink);
    color: black;
    font-weight: bold;
    padding: 0.25rem 0.75rem;
    transform: rotate(-10deg);
    border: 2px solid black;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    z-index: 10;
}

/* Dual Module Row */
.dual-module-row {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

@media (min-width: 1024px) {
    .dual-module-row {
        flex-direction: row;
        /* align-items: flex-start; Removed to allow stretch */
    }
}

/* Converter */
.thermo-bridge {
    background: var(--c-card);
    border: var(--border-thick);
    box-shadow: var(--shadow-hard);
    padding: 1.5rem;
    width: 100%;
    flex: 0.5;
}

.converter-section {
    margin-bottom: 0.5rem;
    padding-bottom: 0;
}

.converter-section:last-child {
    margin-bottom: 0;
}

.section-label {
    font-size: 0.875rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.temp-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.converter-inputs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.input-group {
    display: flex;
    align-items: center;
    border: 2px solid black;
    padding: 0.5rem;
    background: white;
}

.input-group.compact {
    padding: 0.25rem 0.5rem;
    flex: 1;
}

.input-group label {
    width: auto;
    margin-right: 0.5rem;
    font-weight: bold;
    font-size: 1rem;
}

.input-group input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-weight: bold;
    font-size: 1.125rem;
    font-family: var(--font-main);
    min-width: 0; /* Prevent overflow */
}

.header-toggle-btn {
    background: white;
    color: black;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    border: none; /* Or 1px solid black if preferred, user said "white with black text" */
    font-family: var(--font-main);
    margin-left: auto; /* Push to right if flex container allows */
}

.header-toggle-btn:hover {
    background: #f0f0f0;
}

/* Silence Killer */
.silence-killer {
    background: var(--c-card);
    border: var(--border-thick);
    box-shadow: var(--shadow-hard);
    padding: 1.5rem;
    width: 100%;
    flex: 1;
}

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

.section-title-inline {
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    margin: 0;
}

.mode-toggles button {
    background: none;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 1rem;
    margin-left: 1rem;
}

.mode-toggles button:hover {
    color: var(--c-accent-pink);
}

.mode-toggles button.active {
    text-decoration: underline;
}

.mode-toggles-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.mode-toggles-inline button {
    background: none;
    border: none;
    color: #666;
    font-family: var(--font-main);
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.mode-toggles-inline button.active {
    color: var(--c-accent-green);
    text-decoration: none;
}

.mode-badge {
    position: absolute;
    top: -0.75rem;
    left: 0;
    background: var(--c-accent-pink);
    color: white;
    font-weight: bold;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    transform: rotate(-2deg);
}

.display-area {
    background: #e5e5e5;
    border: var(--border-thick);
    padding: 2rem;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
}

.generate-btn {
    width: 100%;
    background: var(--c-accent-green);
    border: 2px solid black;
    color: black;
    font-weight: bold;
    padding: 0.75rem;
    box-shadow: 4px 4px 0px 0px black;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-main);
    transition: all 0.1s;
}

.generate-btn:hover {
    transform: translateY(2px);
    box-shadow: 2px 2px 0px 0px black;
}

/* Overlap Visualizer */
.overlap-visualizer {
    background: var(--c-card);
    border: var(--border-thick);
    box-shadow: var(--shadow-hard);
    padding: 1.5rem;
    width: 100%;
}

.gantt-container {
    overflow-x: auto;
    /* margin-bottom: 1rem; */
}

.gantt-chart {
    min-width: 800px;
}

.gantt-row {
    display: grid;
    grid-template-columns: 100px repeat(24, 1fr);
    gap: 2px;
    margin-bottom: 4px;
    align-items: center;
}

.header-row {
    font-size: 0.75rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.5rem;
}

.row-label {
    font-weight: bold;
    font-size: 0.875rem;
}

.hour-cell {
    height: 1.5rem;
    border: 1px solid #ccc;
}

.hour-cell.working {
    background-color: var(--c-accent-green);
}

.hour-cell.off {
    background-color: #ccc;
}

.hour-cell.shoulder {
    background-color: #99ff99;
}

.hour-cell.current {
    background-color: var(--c-accent-yellow);
}

.hour-cell.current-light {
    background-color: #fffcd6; /* Light Yellow */
}

.weather-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
}

.weather-icon-large {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.weather-icon-large svg {
    width: 2.5rem;
    height: 2.5rem;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.weather-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    align-items: center;
}

.weather-desc {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 0.1rem;
}

.weather-temp {
    font-size: 1rem;
    font-weight: bold;
}

.optimal-window {
    color: #dc2626; /* Red-600 */
    font-weight: bold;
    margin-top: 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* CRT Overlay */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Black Headers */
.card-header {
    background: black;
    color: white;
    padding: 0.25rem 0.75rem;
    margin: -0.75rem -0.75rem 0.25rem -0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--border-thick);
}

.module-header {
    background: black;
    color: white;
    padding: 0.5rem 1rem;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem; /* Compensate for section padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--border-thick);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 1.25rem;
}

/* Adjustments for specific headers */
.city-code {
    font-size: 1.25rem;
    font-weight: bold;
    color: white;
}

.timezone-tag {
    background: white;
    color: black;
    padding: 0.1rem 0.4rem;
    font-weight: bold;
    font-size: 0.9rem;
}

/* G. Upcoming Holidays */
.upcoming-holidays {
    border: var(--border-thick);
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: var(--c-card);
    box-shadow: var(--shadow-hard);
}

.holidays-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); /* Fit 5 in row on desktop */
    gap: 0.75rem;
    margin-top: 1rem;
}

.holiday-card {
    border: 1px solid black;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: white;
    color: black;
    box-shadow: 2px 2px 0px 0px black;
    min-height: 80px;
    justify-content: space-between;
}

.holiday-date {
    font-weight: bold;
    font-size: 0.9rem;
    border-bottom: 1px solid black;
    padding-bottom: 0.2rem;
    margin-bottom: 0.2rem;
    display: flex;
    justify-content: space-between;
}

.holiday-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.holiday-name {
    font-size: 0.8rem;
    font-weight: bold;
    line-height: 1.1;
    text-transform: uppercase;
}

.holiday-meta {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    margin-top: auto;
}

.country-badge {
    padding: 0 0.2rem;
    background: black;
    color: white;
    font-weight: bold;
    font-size: 0.7rem;
}

.holiday-local {
    font-style: italic;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Country specific borders/accents if needed, or keep monochrome */
/* Keeping it monochrome for consistency as requested, but maybe small accents */
.holiday-card:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 0px 0px black;
}

.status-message {
    padding: 1rem;
    text-align: center;
    font-style: italic;
    opacity: 0.7;
    font-weight: bold;
}

.status-message.error {
    color: #dc2626;
}

/* H. Year Timeline */
.year-timeline {
    background: var(--c-card);
    border: var(--border-thick);
    box-shadow: var(--shadow-hard);
    padding: 1.5rem;
    width: 100%;
    margin-top: 2rem;
}

.timeline-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 768px) {
    .timeline-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px; /* Thick black gaps */
    }
}

.quarter-block {
    position: relative;
    height: 50px;
    border: 2px solid black;
    padding: 0.25rem 0.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
}

.quarter-label {
    font-size: 1.25rem;
    font-weight: bold;
    z-index: 2;
}

.quarter-dates {
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 2;
}

.quarter-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.875rem;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 2;
    text-align: center;
    width: 100%;
}

/* States */
.state-past {
    background-color: #333333;
    color: #555555;
    border-color: #555555;
    background-image: repeating-linear-gradient(
        45deg,
        #333,
        #333 10px,
        #222 10px,
        #222 20px
    );
}

.state-future {
    background-color: transparent;
    border: 2px dashed #ffffff;
    color: white;
    text-shadow: 
        -1px -1px 0 #000,  
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000; /* Outline effect for visibility on scanline bg if transparent */
}

/* Ensure future text is visible against the card background */
.year-timeline .state-future {
    color: #000; /* Reset to black since it's inside a white card */
    border: 2px dashed #000;
    text-shadow: none;
    opacity: 0.5;
}

.state-active {
    background-color: #000000;
    color: #ffffff;
    border: 3px solid var(--c-accent-green);
}

.state-active .quarter-label,
.state-active .quarter-dates,
.state-active .quarter-status {
    color: #ffffff;
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 100%;
    background-color: var(--c-accent-green);
    opacity: 0.2;
    box-shadow: 0 0 10px var(--c-accent-green);
    z-index: 1;
    transition: width 1s linear;
}

/* Thin line progress bar style override if preferred, but user asked for "internal progress bar" which usually implies filling. 
   User said: "Inside the ACTIVE block, a solid #00FF00 bar fills from left to right."
   Let's make it a bottom bar or a fill? "fills from left to right" implies a fill.
   Let's stick to a fill but maybe not full height to keep text readable? 
   Or full height with low opacity? 
   User said: "It must have a "glow" effect".
   Let's try a full height bar but with low opacity (0.2) so text is readable, 
   OR a thin line at the bottom.
   "Update the width style of the internal progress bar".
   Let's go with a substantial bar at the bottom, say 10px, or full background fill.
   "solid #00FF00 bar fills".
   Let's do a full height background fill with opacity to simulate "filling the block".
*/
.state-active .progress-bar {
    opacity: 0.3;
    background: var(--c-accent-green);
    box-shadow: 0 0 20px var(--c-accent-green);
}


/* Header Quarter Box */
.header-quarter-box {
    position: relative;
    display: flex;
    align-items: center;
    background: black;
    border: 3px solid var(--c-accent-green);
    padding: 0.25rem 1rem;
    height: 40px;
    min-width: 320px;
    overflow: hidden;
    font-family: var(--font-main);
}

.hq-label {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin-right: 1.5rem;
    z-index: 2;
    line-height: 1;
}

.hq-text {
    font-size: 0.9rem;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    z-index: 2;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.hq-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--c-accent-green);
    opacity: 0.3;
    z-index: 1;
    transition: width 0.5s ease;
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-title {
        width: 100%;
    }

    .header-status {
        width: 100%;
        text-align: left;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .social-icons {
        justify-content: flex-start;
        margin-top: 0.5rem;
    }

    .header-quarter-box {
        min-width: 0;
        width: 100%;
        padding: 0.25rem 0.5rem;
    }

    .hq-label {
        font-size: 1.2rem;
        margin-right: 0.5rem;
    }

    .hq-text {
        font-size: 0.75rem;
        white-space: normal;
        line-height: 1.2;
    }
}
