/* Mevlana Moske Infoscreen Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0d7377 0%, #14a085 50%, #0d7377 100%);
    color: #333;
    overflow: hidden;
}

.container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #0d7377 0%, #14a085 100%);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
    border-bottom: 3px solid #d4af37;
}

.mosque-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.header h1 {
    font-size: 2.5em;
    color: #ffffff;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    flex: 1;
    text-align: center;
}

#currentTime {
    text-align: right;
}

#currentTime .time {
    font-size: 2.5em;
    font-weight: 700;
    color: #d4af37;
    line-height: 1;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

#currentTime .date {
    font-size: 1.2em;
    color: #ffffff;
    margin-top: 5px;
    text-transform: capitalize;
}

/* Main Grid Layout */
.main-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 481px 1fr 1fr;
    grid-template-rows: 0.67fr 1fr;
    gap: 20px;
    padding: 20px;
    height: calc(100vh - 120px);
}

/* Section Styles */
section {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid #d4af37;
}

section h2 {
    background: linear-gradient(135deg, #0d7377 0%, #14a085 100%);
    color: #ffffff;
    padding: 15px 20px;
    font-size: 1.5em;
    font-weight: 600;
    text-align: center;
    border-bottom: 2px solid #d4af37;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Hide header for sections with no-header class */
section.no-header h2 {
    display: none;
}

section iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
}

/* Google Slides - Left column (vertical, full height) */
.slides {
    grid-column: 1;
    grid-row: 1 / 3;
    background: #000000;
}

.slides iframe {
    width: 100%;
    height: 100%;
    background: #000000;
}

/* Posters - Right column (vertical, full height) */
.posters {
    grid-column: 3;
    grid-row: 1 / 3;
}

#posterCarousel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.poster-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.poster-item {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.poster-item.active {
    display: flex;
}

.poster-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.poster-item p {
    margin-top: 20px;
    font-size: 18px;
    color: #666;
}

/* Bus Schedule - Center top left */
.bus-schedule {
    grid-column: 2;
    grid-row: 1;
}

.bus-schedule iframe {
    width: 100%;
    height: 100%;
}

/* Weather Widget - Center top right */
.weather {
    grid-column: 3;
    grid-row: 1;
    background: #ffffff;
    overflow: hidden;
}

.weather iframe {
    width: 100%;
    height: 100%;
    border: none;
    overflow: hidden;
}

/* Prayer Times - Center bottom */
.prayer-times {
    grid-column: 2;
    grid-row: 2;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9f5f5 100%);
    border: 3px solid #0d7377;
}

/* YouTube Playlist - Bottom right */
.youtube {
    grid-column: 3;
    grid-row: 2;
}

/* Responsive adjustments for all screen sizes */

/* Desktop/TV Large (1920px and above) - Default layout */
@media screen and (min-width: 1920px) {
    .main-grid {
        grid-template-columns: 481px 1fr 1fr;
        grid-template-rows: 0.67fr 1fr;
    }
    
    .header h1 {
        font-size: 2.5em;
    }
    
    #currentTime .time {
        font-size: 2.5em;
    }
    
    #currentTime .date {
        font-size: 1.2em;
    }
}

/* Desktop/TV Medium (1280px - 1919px) */
@media screen and (min-width: 1280px) and (max-width: 1919px) {
    .main-grid {
        grid-template-columns: 413px 1fr 1fr;
        grid-template-rows: 0.67fr 1fr;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    #currentTime .time {
        font-size: 2em;
    }
    
    #currentTime .date {
        font-size: 1em;
    }
    
    section h2 {
        font-size: 1.3em;
        padding: 12px 15px;
    }
}

/* Tablet Landscape (768px - 1279px) */
@media screen and (min-width: 768px) and (max-width: 1279px) {
    .main-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        gap: 15px;
        padding: 15px;
    }
    
    .prayer-times {
        grid-column: 1;
        grid-row: 1 / 3;
    }
    
    .bus-schedule {
        grid-column: 2;
        grid-row: 1;
    }
    
    .weather {
        grid-column: 2;
        grid-row: 2;
    }
    
    .slides {
        grid-column: 1 / 3;
        grid-row: 3;
        min-height: 300px;
    }
    
    .youtube {
        display: none;
    }
    
    .header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .header h1 {
        font-size: 1.8em;
        text-align: center;
    }
    
    .mosque-logo {
        height: 60px;
    }
    
    #currentTime .time {
        font-size: 1.8em;
    }
    
    #currentTime .date {
        font-size: 0.9em;
    }
}

/* Tablet Portrait & Mobile Landscape (480px - 767px) */
@media screen and (min-width: 480px) and (max-width: 767px) {
    body {
        overflow-y: auto;
    }
    
    .container {
        height: auto;
        min-height: 100vh;
    }
    
    .main-grid {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        height: auto;
    }
    
    section {
        min-height: 300px;
    }
    
    .prayer-times {
        order: 1;
        min-height: 400px;
    }
    
    .bus-schedule {
        order: 2;
    }
    
    .weather {
        order: 3;
    }
    
    .slides {
        order: 4;
        min-height: 350px;
    }
    
    .youtube {
        display: none;
    }
    
    .header {
        padding: 12px 15px;
        flex-direction: column;
        gap: 8px;
        height: auto;
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .mosque-logo {
        height: 50px;
    }
    
    #currentTime {
        text-align: center;
    }
    
    #currentTime .time {
        font-size: 1.5em;
    }
    
    #currentTime .date {
        font-size: 0.8em;
    }
}

/* Mobile Portrait (below 480px) */
@media screen and (max-width: 479px) {
    body {
        overflow-y: auto;
    }
    
    .container {
        height: auto;
        min-height: 100vh;
    }
    
    .main-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        height: auto;
    }
    
    section {
        min-height: 250px;
        border-radius: 8px;
        padding: 10px;
    }
    
    .prayer-times {
        order: 1;
        min-height: 350px;
    }
    
    .bus-schedule {
        order: 2;
    }
    
    .weather {
        order: 3;
    }
    
    .slides {
        order: 4;
        min-height: 300px;
    }
    
    .youtube {
        display: none;
    }
    
    .header {
        padding: 10px;
        flex-direction: column;
        gap: 8px;
        height: auto;
    }
    
    .header h1 {
        font-size: 1.2em;
    }
    
    .mosque-logo {
        height: 40px;
    }
    
    #currentTime {
        text-align: center;
    }
    
    #currentTime .time {
        font-size: 1.2em;
    }
    
    #currentTime .date {
        font-size: 0.7em;
    }
}

/* Animation for smooth transitions */
section {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner for iframes */
section iframe {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Ensure text is readable */
body * {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
