/* css/pages/index.css */

body {
    overflow: hidden; /* Prevent scrolling on the display board */
    height: 100vh;
    width: 100vw;
    background: var(--colour-background);
    color: var(--colour-text);
}

:root {
    --sidebar-width: 6rem;
    --swoosh-width: 5rem;
    --slide-padding-offset: 1rem;
}

/* Display Container */
#display-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#slide-viewer {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    padding: 2% 5% 2% calc(var(--sidebar-width) + var(--swoosh-width) + var(--slide-padding-offset));
    display: grid;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.slide.active {
    opacity: 1;
    z-index: 10;
}

.slide h1 {
    font-size: var(--font-heading);
    line-height: 1.1;
    margin-bottom: 2rem;
    color: var(--colour-heading);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.slide-content {
    font-size: var(--font-body);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.slide-content ul, .slide-content ol {
    margin-left: 2em;
    margin-bottom: 1em;
}

.slide-image-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
    min-height: 0; /* allows flexbox to shrink past content size */
    gap: var(--space-md);
}

.slide-image-container img {
    width: 100%;
    flex: 1;
    min-height: 0;
    max-height: 75vh; /* Prevents extremely wide images from zooming in too much vertically */
    object-fit: cover; /* Cover mode for art direction */
    margin-block: auto; /* Vertically center the image within the container */
    border-radius: 0.5rem;
    box-shadow: 0 var(--space-lg) var(--space-xl) rgba(0,0,0,0.6);
    animation: kenBurnsPan 10s ease-in-out infinite alternate;
    position: relative;
    z-index: 1;
}

@keyframes kenBurnsPan {
    0% { object-position: 0% 50%; }
    100% { object-position: 100% 50%; }
}

.gallery-slide-bg {
    display: none;
}

/* --- Slide Component Classes --- */

.slide-placeholder {
    color: var(--color-muted);
}

.slide-description-banner {
    position: absolute;
    bottom: var(--space-xl);
    width: 100%;
    max-width: 80ch;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--raf-white);
    text-align: center;
    font-size: var(--font-lg);
    padding: 0.75rem var(--space-md);
    border-radius: 0.5rem;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    box-sizing: border-box;
    z-index: 10;
}

.editable-image-action {
    flex: 1;
    margin-top: var(--space-sm);
    min-height: 0;
}

.image-action-container {
    flex: 1;
    margin-top: var(--space-sm);
    min-height: 0;
    display: flex;
}

.slide-content-image {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.slide-content-programme {
    padding: 0 2rem;
}

.programme-loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.programme-loading-spinner {
    animation: spin 2s linear infinite;
    font-size: 3rem;
    color: var(--raf-white);
}

.dummy-slide-actions {
    display: flex;
    gap: var(--space-lg);
}

.inline-edit-wrapper {
    background: rgba(0,0,0,0.8);
    padding: var(--space-md);
    border-radius: 0.5rem;
    width: 100%;
}

.inline-edit-text {
    font-size: 2rem;
    width: 100%;
    padding: var(--space-sm);
    color: #000;
}

.inline-edit-textarea {
    font-size: var(--font-lg);
    width: 100%;
    padding: var(--space-sm);
    color: #000;
    height: 6rem;
    resize: vertical;
}

.inline-edit-div {
    background: var(--raf-white);
    color: #000;
}

/* --- Programme Slide Internal Components --- */

.prog-slide-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.prog-slide-date-title {
    margin: 0;
    font-size: 2rem;
    color: var(--colour-heading);
    text-align: left;
}

.prog-nav-left { margin-right: var(--space-sm); }
.prog-nav-right { margin-right: var(--space-lg); }
.prog-settings-btn { margin-left: var(--space-md); }

.prog-slide-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    background: var(--raf-white);
    color: #000;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.prog-info-cards {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.prog-info-card {
    background: #eee;
    padding: var(--space-md);
    border-radius: 0.5rem;
}

.prog-uniform-card {
    flex: 1;
    min-width: 300px;
    border-left: 6px solid var(--raf-accent-2);
}

.prog-notes-card {
    flex: 2;
    min-width: 300px;
    border-left: 6px solid var(--raf-light-blue);
}

.prog-info-card h3 {
    margin-top: 0;
    color: #555;
    font-size: 1.2rem;
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
}

.prog-uniform-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #000;
}

.prog-notes-list {
    margin: 0;
    padding-left: 1.5rem;
    font-size: 1.1rem;
    color: #000;
}

.prog-notes-list li {
    margin-bottom: 0.25rem;
}

.prog-notes-list li.italic {
    font-style: italic;
}

.prog-notes-divider {
    border-color: rgba(0,0,0,0.1);
    margin: var(--space-sm) 0;
}

.prog-table-wrapper {
    background: transparent;
    border-radius: 0;
    overflow: hidden;
    margin-top: var(--space-md);
}

.prog-table {
    width: 100%;
    border-collapse: collapse;
    color: #000;
}

.prog-table th {
    padding: var(--space-md);
    border: 1px solid #ccc;
    text-align: left;
    background: #eee;
    color: #000;
    font-weight: bold;
}

.prog-table td {
    padding: var(--space-md);
    border: 1px solid #ccc;
}

.prog-table tr:nth-child(even) {
    background: #fafafa;
}

.prog-table td.class-col {
    font-weight: bold;
    color: #000;
}

.prog-table td.act-col {
    font-size: 1.2rem;
}

.prog-table td.inst-col {
    color: #555;
}

.prog-act-type-tag {
    font-size: 0.8rem;
    background: var(--raf-logo-1);
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    margin-right: var(--space-sm);
    color: var(--raf-white);
    font-weight: bold;
}

.prog-error-msg {
    text-align: center;
    color: var(--color-error);
    margin-top: 2rem;
}

.prog-empty-msg {
    text-align: center;
    margin-top: 2rem;
}

/* Modal form overrides */
.prog-settings-modal {
    max-width: 400px;
    color: #000;
}

.prog-form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: bold;
}

.prog-form-input {
    width: 100%;
    padding: var(--space-sm);
    margin-bottom: var(--space-md);
    border-radius: 0.25rem;
    border: 1px solid #ccc;
}

/* Logo */
#logo-container {
    position: absolute;
    top: var(--space-lg);
    left: var(--space-sm);
    width: 8rem;
    z-index: 40;
    pointer-events: none;
}
#logo-container img {
    width: 100%;
    height: auto;
}

/* Swoosh Sidebar */
#swoosh-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background-color: var(--colour-footer);
    z-index: 20;
    pointer-events: none; /* Let clicks pass through */
}
.swoosh-mobile { display: none; }
.swoosh-desktop { display: block; }

#swoosh-sidebar .swoosh-desktop svg {
    position: absolute;
    left: 100%;
    top: 0;
    display: block;
    width: var(--swoosh-width);
    height: 100%;
}

.swoosh-inner { fill: var(--colour-footer); }
.swoosh-dividing { fill: var(--colour-divider); }
.swoosh-outer { fill: transparent; }

.swoosh-sidebar-text {
    position: absolute;
    left: var(--space-md);
    bottom: var(--space-xxl);
    margin: 0;
    writing-mode: vertical-rl;
    color: var(--colour-swoosh-text);
    font-size: 3.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Bottom Menu Bar for Active Slideshows */
#slideshow-menu {
    position: absolute;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-sm);
    background: rgba(0,0,0,0.5);
    padding: var(--space-sm);
    border-radius: 30px;
    z-index: 40;
    transition: opacity 0.3s;
}
.slideshow-tab {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.5rem var(--font-md);
    border-radius: var(--space-lg);
    background: rgba(255,255,255,0.1);
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    border: none;
}
.slideshow-tab:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}
.slideshow-tab.active {
    background: rgba(255,255,255,0.9);
    color: var(--color-text);
    font-weight: bold;
}
.slideshow-tab .material-symbols-outlined {
    font-size: 1.5rem;
}


/* Edit Mode Styles */
.edit-marker {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    background: var(--color-secondary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    position: absolute;
    top: -var(--space-sm);
    right: -var(--space-sm);
    z-index: 20;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px var(--space-xs) rgba(0,0,0,0.5);
}
.editable-container {
    position: relative;
    border: 1px dashed transparent;
    transition: border 0.2s;
}
.editable-container:hover {
    border: 1px dashed rgba(255,255,255,0.5);
}
.editable-container:hover .edit-marker {
    opacity: 1;
}

.edit-toolbar {
    position: absolute;
    top: var(--space-lg);
    right: 80px;
    background: rgba(0,0,0,0.7);
    padding: var(--space-sm);
    border-radius: var(--space-sm);
    display: flex;
    gap: var(--space-sm);
    z-index: 30;
}

.dummy-slide-btn {
    width: 220px;
    height: 280px;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--space-md);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    margin: var(--space-sm);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}
.dummy-slide-btn .material-symbols-outlined {
    font-size: 4rem;
}

.dummy-slide-btn:hover { 
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}


.accent {
    color: var(--colour-accent);
    font-weight: bold;
}

.swoosh-heading-text {
    color: var(--colour-swoosh-text);
    margin: 0;
    font-size: 2.5rem;
    font-weight: bold;
}

/* Programme Slide Navigation Buttons */
.prog-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.prog-nav-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* Duties Card */
.prog-duties-card {
    flex: 1;
    min-width: 300px;
    border-left: 6px solid var(--raf-nav-2);
}
.prog-duties-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    font-size: 1.1rem;
    color: #000;
}
.prog-duty-item {
    display: flex;
    flex-direction: column;
}
.prog-duty-label {
    font-size: 0.9rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .swoosh-desktop { display: none !important; }
    .swoosh-mobile { display: block !important; }
    
    #swoosh-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100px;
        background-color: var(--colour-footer);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 var(--space-md);
        box-sizing: border-box;
    }

    #swoosh-sidebar .swoosh-mobile svg.header-swoosh-svg {
        position: absolute;
        bottom: -8vw; /* Adjusted swoosh curve depth */
        left: 0;
        width: 100%;
        height: 8vw;
        z-index: -1;
        transform: scaleX(-1);
    }

    #swoosh-sidebar .swoosh-mobile .swoosh-inner { fill: var(--colour-footer) !important; }
    #swoosh-sidebar .swoosh-mobile .swoosh-dividing { fill: var(--colour-divider) !important; }

    #logo-container {
        position: static;
        width: clamp(80px, 18vw, 100px);
        height: auto;
        margin: 0;
        margin-right: 70px; /* Prevent overlap with user menu dropdown */
        margin-left: var(--space-sm); /* Spacing from titles */
    }

    .header-titles {
        flex: 1;
        display: flex;
        justify-content: flex-start;
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }

    .swoosh-sidebar-text {
        position: static;
        writing-mode: horizontal-tb;
        font-size: clamp(1.5rem, 7vw, 2.5rem);
        margin: 0;
        color: white; 
        text-transform: none;
        letter-spacing: normal;
        font-weight: bold;
    }

    .slide {
        padding: calc(110px + 8vw) var(--space-md) 100px var(--space-md) !important;
        box-sizing: border-box;
        overflow-y: auto; /* Allow scrolling if content is too tall */
    }

    .slide h1 {
        font-size: 2.2rem;
        margin-bottom: 1rem;
    }

    .slide-image-container img {
        max-height: 35vh;
        width: 100%;
        object-fit: cover;
    }
}
