/* ============================================
   Ellis Web Bell Stylesheet
   Version: 2.4
   ============================================ */

:root {
    --css-version: "2.4";
    
    /* V5.52.1: Customizable warning colors */
    --warning-color-subtle: #fbbf24;
    --warning-color-medium: #f97316;
    --warning-color-urgent: #ef4444;
}

/* ============================================
   COUNTDOWN WARNING ANIMATIONS (V5.52)
   Visual alerts as bells approach
   ============================================ */

/* Pulsing Glow Effect */
@keyframes warning-pulse-subtle {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
    50% { box-shadow: 0 0 20px 5px var(--warning-color-subtle); }
}

@keyframes warning-pulse-medium {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
    50% { box-shadow: 0 0 30px 10px var(--warning-color-medium); }
}

@keyframes warning-pulse-urgent {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 40px 15px var(--warning-color-urgent); }
}

.warning-pulse-subtle { animation: warning-pulse-subtle 2s ease-in-out infinite; }
.warning-pulse-medium { animation: warning-pulse-medium 1.5s ease-in-out infinite; }
.warning-pulse-urgent { animation: warning-pulse-urgent 0.8s ease-in-out infinite; }

/* Color Shift Effect */
.warning-color-subtle { background-color: var(--warning-color-subtle) !important; }
.warning-color-medium { background-color: var(--warning-color-medium) !important; }
.warning-color-urgent { background-color: var(--warning-color-urgent) !important; }

/* Breathing (Size Pulse) Effect */
@keyframes warning-breathe-subtle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes warning-breathe-medium {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes warning-breathe-urgent {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.warning-breathe-subtle { animation: warning-breathe-subtle 2s ease-in-out infinite; }
.warning-breathe-medium { animation: warning-breathe-medium 1.5s ease-in-out infinite; }
.warning-breathe-urgent { animation: warning-breathe-urgent 0.8s ease-in-out infinite; }

/* Gentle Shake Effect */
@keyframes warning-shake-subtle {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes warning-shake-medium {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes warning-shake-urgent {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.warning-shake-subtle { animation: warning-shake-subtle 2s ease-in-out infinite; }
.warning-shake-medium { animation: warning-shake-medium 1s ease-in-out infinite; }
.warning-shake-urgent { animation: warning-shake-urgent 0.5s ease-in-out infinite; }

/* Combined "All Effects" classes */
.warning-all-subtle {
    animation: warning-pulse-subtle 2s ease-in-out infinite, warning-breathe-subtle 2s ease-in-out infinite;
    background-color: var(--warning-color-subtle) !important;
}

.warning-all-medium {
    animation: warning-pulse-medium 1.5s ease-in-out infinite, warning-breathe-medium 1.5s ease-in-out infinite;
    background-color: var(--warning-color-medium) !important;
}

.warning-all-urgent {
    animation: warning-pulse-urgent 0.8s ease-in-out infinite, warning-breathe-urgent 0.8s ease-in-out infinite;
    background-color: var(--warning-color-urgent) !important;
}

/* Transition for smooth effect changes */
#visual-cue-container,
#pip-visual,
#warning-preview {
    transition: background-color 0.5s ease, box-shadow 0.3s ease;
}

/* Font Configuration */
/* V2.2.3: Added Urbanist as fallback before Questrial */
body {
    font-family: 'Century Gothic', 'Urbanist', 'Questrial', 'sans-serif';
}

/* ============================================
   VISUAL PREVIEW SYSTEM (Centralized)
   Change these values to update all previews
   ============================================ */

/* Full-size preview container (used in all modals) */
/* MODIFIED V5.29.0: Match actual visual-cue-container styling (bg-gray-800) */
.visual-preview-full {
    width: 10rem;      /* w-40 = 160px */
    height: 10rem;     /* h-40 = 160px */
    background-color: #1f2937;  /* bg-gray-800 - matches actual display */
    border-radius: 0.5rem;      /* rounded-lg */
    border: 1px solid #374151;  /* border-gray-700 - subtle border on dark bg */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* V5.29.0: Scale down padding in previews to maintain visual proportions */
/* The actual display is ~250-300px with p-8 (32px), preview is 160px */
/* Using p-4 (16px) maintains roughly the same content-to-container ratio */
.visual-preview-full > div {
    padding: 1rem !important;  /* Override the p-8 to p-4 for previews */
}

/* V5.29.0: Make preview clickable for background color customization */
.visual-preview-full.clickable {
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.visual-preview-full.clickable:hover {
    opacity: 0.9;
    box-shadow: 0 0 0 2px #3b82f6;  /* blue-500 ring */
}
.visual-preview-full.clickable:hover::after {
    content: 'Click to change background';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Icon preview wrapper (holds the small circle, same size as full for alignment) */
.visual-preview-icon-wrapper {
    width: 10rem;      /* w-40 */
    height: 10rem;     /* h-40 */
    background-color: #f3f4f6;  /* bg-gray-100 - light bg to show dark icon circle */
    border-radius: 0.5rem;      /* rounded-lg */
    border: 1px solid #e5e7eb;  /* border-gray-200 */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The actual small circle icon inside the wrapper */
.visual-preview-icon-circle {
    width: 2.5rem;     /* w-10 */
    height: 2.5rem;    /* h-10 */
    border-radius: 9999px;  /* rounded-full */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Two-column layout for visual mode + preview (bells) */
.visual-mode-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;         /* gap-4 */
    margin-bottom: 1rem;
    justify-items: center;  /* Center columns like period modals */
}

/* Two-column layout for full + icon preview (periods) */
.visual-dual-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;         /* gap-4 */
    margin-top: 0.5rem;
    justify-items: center;
}

/* Stacked radio buttons for visual mode */
.visual-mode-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;       /* gap-2 */
}

/* Placeholder text in empty previews */
.visual-preview-placeholder {
    font-size: 0.875rem;  /* text-sm */
    color: #9ca3af;       /* text-gray-400 */
}

/* ============================================ */

/* Admin Controls Visibility */
.admin-control,
#combined-bell-list .delete-btn {
    display: none;
}

body.admin-mode .admin-control {
    display: block; 
}

body.admin-mode #combined-bell-list .delete-btn {
    display: inline-block;
}

/* Bell List Button Visibility */
#combined-bell-list .edit-btn,
#combined-bell-list .delete-custom-btn,
#combined-bell-list .edit-custom-btn,
#combined-bell-list .sound-btn {
    display: inline-block;
}

#combined-bell-list .sound-custom-btn {
    display: none;
}

/* Modal Z-Index Configuration */
/* Standard modals (z-50) */
#edit-bell-modal,
#change-sound-modal,
#nearby-bell-modal,
#confirm-delete-bell-modal,
#confirm-delete-audio-modal,
#confirm-delete-visual-modal,
#internal-conflict-warning-modal,
#external-conflict-modal,
#create-personal-schedule-modal,
#confirm-restore-modal,
#rename-personal-schedule-modal,
#rename-shared-schedule-modal,
#rename-audio-modal,
#rename-visual-modal,
#passing-period-visual-modal {
    z-index: 50;
}

/* Higher priority delete modal */
#confirm-delete-personal-modal {
    z-index: 70;
}

/* Modals that appear on top of other modals (z-60) */
#confirm-linked-edit-modal,
#internal-conflict-confirm-modal {
    z-index: 60;
}

/* File Input Hiding */
#import-file-input,
#audio-upload-input,
#restore-file-input,
#visual-upload-input {
    display: none;
}

/* Authentication-Required Elements */
.auth-required {
    display: none;
}

body.authenticated.not-anonymous .auth-required {
    display: block;
}

/* Admin-Only Elements */
.admin-only {
    display: none;
}

body.admin-mode .admin-only {
    display: inline-flex;
}

/* ============================================
   KIOSK MODE (V5.49)
   Clean, minimal display for projection/display
   ============================================ */

/* Elements hidden in kiosk mode */
body.kiosk-mode .kiosk-hide {
    display: none !important;
}

/* Center the main card in kiosk mode */
body.kiosk-mode .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

/* Make the countdown card centered in kiosk mode */
body.kiosk-mode .bg-white.rounded-xl.shadow-md.mb-8 {
    margin-bottom: 0;
    max-width: 100%;
    width: auto;
}

/* V5.49.2: Stack layout vertically in kiosk mode */
body.kiosk-mode .grid.grid-cols-1.md\:grid-cols-5 {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1rem !important;
}

/* Center visual cue in kiosk mode */
body.kiosk-mode #visual-cue-wrapper {
    display: flex;
    justify-content: center;
}

body.kiosk-mode #visual-cue-container {
    min-height: 250px !important;
    width: 250px !important;
}

/* V5.49.2: Center ALL text in countdown column for kiosk mode */
body.kiosk-mode .md\:col-span-3 {
    text-align: center !important;
    width: 100% !important;
}

body.kiosk-mode .md\:col-span-3 * {
    text-align: center !important;
}

body.kiosk-mode #countdown-display {
    font-size: 5rem;
    text-align: center !important;
    justify-content: center !important;
}

body.kiosk-mode #next-bell-sentence {
    font-size: 1.5rem;
    text-align: center !important;
}

/* Hide clock line in kiosk mode */
body.kiosk-mode #live-clock-sentence {
    display: none !important;
}

/* Hide "next bell after" line in kiosk mode - only show immediate next */
body.kiosk-mode #next-bell-info {
    display: none !important;
}

@media (min-width: 768px) {
    body.kiosk-mode #countdown-display {
        font-size: 8rem;
    }
    
    body.kiosk-mode #next-bell-sentence {
        font-size: 2rem;
    }
    
    body.kiosk-mode #visual-cue-container {
        min-height: 300px !important;
        width: 300px !important;
    }
}

/* ===== V5.59.0: Simplified View Mode ===== */
/* Hides all editing UI in the schedule display area while keeping core functionality */

/* Hide all edit/delete/add buttons on bells */
body.simplified-mode .edit-btn,
body.simplified-mode .edit-custom-btn,
body.simplified-mode .delete-btn,
body.simplified-mode .delete-custom-btn,
body.simplified-mode .add-bell-to-period-btn {
    display: none !important;
}

/* Hide period edit visual cue button */
body.simplified-mode .edit-period-visual-btn {
    display: none !important;
}

/* Hide bulk edit toggle and checkbox column */
body.simplified-mode #bulk-edit-toggle-btn {
    display: none !important;
}

body.simplified-mode .bulk-edit-checkbox {
    display: none !important;
}

/* Hide any inline add buttons that appear in periods */
body.simplified-mode [class*="add-bell"],
body.simplified-mode [class*="add-period"] {
    display: none !important;
}

/* But keep the main period structure and bell info visible */
/* Also keep Collapse All, Expand All, Mute All, Unmute All buttons */

/* Hide period management buttons in simplified mode */
body.simplified-mode .rename-period-btn,
body.simplified-mode .delete-list-period-btn {
    display: none !important;
}

/* Hide bulk select checkboxes in simplified mode */
body.simplified-mode #bulk-select-all-master,
body.simplified-mode .bulk-select-period {
    display: none !important;
}
