/* Style 4 - 3x3 Grid Layout: Slideshow/Ads
   Clean design with admin colors for header, accents, and active highlights */
:root {
    --bg-gradient-start: #f5f7fa;
    --bg-gradient-end: #e8ecf1;
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.06);
    --text-color: #2d3436;
    --text-muted: #636e72;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 14px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(145deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-color);
    overflow: hidden;
}

/* ─── Header ─── */
.header {
    flex-shrink: 0;
    height: 13vh;
    min-height: 70px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    padding: 0 3vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    width: clamp(40px, 6vw, 80px);
    height: auto;
    max-height: 10vh;
}

.name {
    color: #ffffff;
    font-size: calc(clamp(1rem, 3.2vmin, 2.8rem) * var(--font-multiplier-headers, 1));
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 800;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
}

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

.date-time .time {
    font-size: calc(clamp(1.1rem, 4vmin, 2.8rem) * var(--font-multiplier-headers, 1));
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.date-time .date {
    font-size: calc(clamp(0.6rem, 2vmin, 1.1rem) * var(--font-multiplier-headers, 1));
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ampm {
    font-size: calc(clamp(0.4rem, 1vw, 0.6rem) * var(--font-multiplier-headers, 1));
    margin-left: 0.3ch;
}

.container {
    flex: 1 1 auto;
    display: flex;
    overflow-y: hidden;
    width: 100%;
    padding: 1.5vh 1.5vw;
}

/* ─── Prayer Cards ─── */
.prayer-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.prayer-card:hover {
    box-shadow: var(--shadow-md);
}

.prayer-card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    color: #ffffff;
    font-size: calc(clamp(0.8rem, 1.6vw, 1.6rem) * var(--font-multiplier-headers, 1));
    font-weight: 700;
    padding: 1.5vmin 2vmin;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
    flex-shrink: 0;
}

.prayer-card.show-False {
    display: none;
}

.time-container {
    background: transparent;
    text-align: center;
    padding: 0.5vmin 0;
    flex-shrink: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.time-label {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: calc(clamp(0.5rem, 0.8vw, 0.7rem) * var(--font-multiplier-labels, 1));
    margin-bottom: 0.25vmin;
    line-height: 1.2;
}

.time-value {
    font-weight: 700;
    color: var(--text-color);
    font-size: calc(clamp(0.8rem, 2vw, 2.4rem) * var(--font-multiplier-time-values, 1));
    letter-spacing: -0.02em;
    margin-bottom: 0.5vmin;
    line-height: 1.1;
}

.current-prayer {
    box-shadow: 0 0 0 3px var(--primary-color), 0 0 20px color-mix(in srgb, var(--primary-color) 30%, transparent);
    transform: scale(1.02);
}

.current-prayer .prayer-card-header {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color)) !important;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    border-radius: 15px;
    z-index: 1000;
    font-size: clamp(1.5rem, 2.5vw, 5rem);
    justify-content: center;
    align-items: center;
    animation: pulse 2s infinite;
    display: none;
}

.modal.active {
    display: flex;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 0 0 20px rgba(255, 255, 255, 0);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* ─── 3 Columns Layout ─── */
.s4-grid {
    display: grid;
    grid-template-columns: 0.8fr 0.6fr 1.6fr;
    grid-template-rows: 1fr auto;
    gap: 2vmin;
    height: 100%;
    width: 100%;
}

.s4-left-top {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 2vmin;
    min-height: 0;
}

.s4-center-top {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5vmin;
    min-height: 0;
}

.s4-right-full {
    grid-column: 3;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Column 1 */
.s4-featured {
    flex: 1.5;
    display: flex;
}

.featured-card {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    border: none;
}

.featured-card .prayer-card-header {
    font-size: calc(clamp(1.0rem, 1.6vw, 2.0rem) * var(--font-multiplier-headers, 1)) !important;
    padding: 1.2vmin;
}

.featured-card .prayer-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    gap: 1vmin;
    padding: 1vmin;
}

.featured-card .time-container .time-value {
    font-size: calc(clamp(1.5rem, 2.2vw, 3.0rem) * var(--font-multiplier-time-values, 1));
    font-weight: 800;
    letter-spacing: -0.03em;
}

.featured-card .time-container .time-label {
    font-size: calc(clamp(0.55rem, 0.8vw, 0.9rem) * var(--font-multiplier-labels, 1));
}

.s4-featured-footer {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    padding: 1vmin 1.5vmin;
    margin: 0 1.5vmin 1.5vmin;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
}

.s4-featured-footer .s4-next-label {
    font-size: calc(clamp(0.7rem, 1.0vw, 1.2rem) * var(--font-multiplier-labels, 1));
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.85;
}

.s4-featured-footer .s4-next-time {
    font-size: calc(clamp(0.9rem, 1.2vw, 1.7rem) * var(--font-multiplier-time-values, 1));
    font-weight: 700;
}

.s4-jumaa-card {
    flex: 0.8;
    display: flex;
    flex-direction: column;
}

.s4-jumaa-header {
    color: var(--primary-color);
    font-size: calc(clamp(0.7rem, 1.1vw, 1.4rem) * var(--font-multiplier-headers, 1));
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    padding: 1vmin;
}

.s4-info-content {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 1vmin;
    flex-wrap: wrap;
    flex-grow: 1;
}

.info-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5vmin;
}

.info-block-label {
    font-size: calc(clamp(0.6rem, 0.8vw, 0.9rem) * var(--font-multiplier-labels, 1));
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-weight: 600;
}

.info-block-value {
    font-size: calc(clamp(0.9rem, 1.8vw, 2.5rem) * var(--font-multiplier-time-values, 1));
    font-weight: 700;
    color: var(--text-color);
}

.s4-ticker-card {
    grid-column: 1 / span 2;
    grid-row: 2;
    height: 12vh;
    min-height: 80px;
    margin-top: 0;
    display: flex;
    flex-direction: column;
}

.ticker-content-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1vmin 2vmin;
    overflow: hidden;
    position: relative;
}

.news-ticker-slideshow {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticker-slide {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: calc(clamp(0.7rem, 1vw, 1.2rem) * var(--font-multiplier-ticker, 1));
    font-weight: 600;
    color: var(--text-color);
    padding: 1vmin;
    word-wrap: break-word;
    white-space: normal;
}

.ticker-slide.active {
    opacity: 1;
    z-index: 1;
}

/* Column 2: Compact Cards */
.compact-card {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    padding: 0; /* Background goes edge-to-edge on prayer name */
    overflow: hidden;
}

.compact-card.show-False {
    display: none;
}

.compact-prayer-name {
    color: var(--primary-color);
    font-size: calc(clamp(0.6rem, 0.8vw, 1.4rem) * var(--font-multiplier-headers, 1));
    font-weight: 800;
    text-transform: uppercase;
    flex: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1vmin;
}

.compact-times {
    display: flex;
    flex-direction: row;
    gap: 2vmin;
    flex: 1.2;
    justify-content: space-evenly;
    align-items: center;
    padding: 1vmin;
}

.compact-time-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.compact-time-label {
    font-size: calc(clamp(0.35rem, 0.5vw, 0.7rem) * var(--font-multiplier-labels, 1));
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: -0.2vmin;
}

.compact-time-value {
    font-size: calc(clamp(0.9rem, 1.2vw, 1.6rem) * var(--font-multiplier-time-values, 1));
    font-weight: 700;
    color: var(--text-color);
}

.current-prayer .compact-prayer-name {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

.current-prayer .compact-time-label,
.current-prayer .compact-time-value {
    color: var(--primary-color);
}

/* Column 3: Slideshow */
.s4-slideshow-card {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.slide-show {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slideshow-image {
    width: 100%;
    height: 100%;
    object-fit: fill;
    position: absolute;
    opacity: 0;
    transition: opacity 1s ease;
}

.slideshow-image.active {
    opacity: 1;
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }

    .header {
        height: auto;
        min-height: 10vh;
        padding: 2vh 3vw;
        flex-direction: column;
        gap: 1vh;
        text-align: center;
    }

    .name {
        position: static;
        transform: none;
        font-size: calc(clamp(0.8rem, 3.2vw, 1.2rem) * var(--font-multiplier-headers, 1));
        max-width: 90%;
    }

    .date-time {
        text-align: center;
    }

    .container {
        overflow-y: visible;
        height: auto;
        padding: 2vw 4vw;
    }

    .s4-grid {
        display: flex;
        flex-direction: column;
        gap: 4vw;
        height: auto;
        overflow-y: auto;
    }

    .s4-left-top, .s4-center-top, .s4-right-full {
        height: auto;
        gap: 2vw;
    }

    .s4-featured {
        min-height: 30vh;
    }

    .s4-jumaa-card {
        min-height: 15vh;
    }

    .s4-ticker-card {
        min-height: 15vh;
    }

    .compact-card {
        min-height: 8vh;
    }

    .s4-slideshow-card {
        min-height: 30vh;
    }
}
