﻿/* =========================================
   Omnia WebUI - Shell Layout
   ========================================= */

:root {
    --shell-sidebar-width: 210px;
    --shell-border-color: #ddd;
    --shell-nav-bg: #f3f3f3;
    --shell-backdrop-bg: rgba(0, 0, 0, 0.4);
}

/* Base reset */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* App shell */
.app-shell {
    height: 100vh; /* important: header + body fits viewport */
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--shell-border-color);
    background-color: #ffffff;
}

.app-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Body: sidebar + content */
.app-body {
    flex: 1;
    min-height: 0; /* important: enables inner scrolling */
    display: flex;
    width: 100%;
    overflow: hidden; /* prevent page scroll; content scrolls inside app-content */
    position: relative;
}

/* Navigation wrapper around Syncfusion sidebar */
.app-nav {
    background-color: var(--shell-nav-bg);
    flex-shrink: 0;
}

    .app-nav .e-sidebar {
        background-color: var(--shell-nav-bg);
        border-right: 1px solid #dee2e6;
    }

/* Optional legacy nav list styling (kept to avoid breaking anything) */
.app-nav-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
}

    .app-nav-list li {
        margin-bottom: 0.25rem;
    }

    .app-nav-list a {
        display: block;
        padding: 0.5rem 0.75rem;
        border-radius: 0.375rem;
        text-decoration: none;
        color: #333;
        transition: background-color 0.2s;
    }

        .app-nav-list a:hover {
            background-color: #e0e0e0;
        }

        .app-nav-list a.active {
            font-weight: 600;
            background-color: #e3f2fd;
            color: #0d47a1;
        }

/* Content area */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* standard flexbox fix */
    min-height: 0;
    overflow-y: auto; /* scroll inside content only */
    position: relative;
    padding: 1rem;
}

/* Mobile toggle button */
.nav-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    color: #333;
}

/* Simple utility card (kept to avoid breaking anything) */
.card {
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e0e0e0;
    background-color: #fff;
    margin-bottom: 1rem;
}

/* Touch targets */
button, .btn, .e-btn {
    min-height: 40px;
}

/* Backdrop (mobile overlay) */
.app-backdrop {
    position: fixed;
    inset: 0;
    background-color: var(--shell-backdrop-bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 999; /* below sidebar, above content */
}

    .app-backdrop.app-backdrop-visible {
        opacity: 1;
        pointer-events: auto;
    }

/* --- DESKTOP (Min-width: 769px) --- */
@media (min-width: 769px) {

    .app-backdrop {
        display: none !important;
    }

    .app-nav {
        height: 100%;
        position: relative;
        z-index: 1;
        width: 0;
        overflow: hidden;
        transition: width 0.3s ease;
    }

    .app-nav.app-nav-open {
        width: var(--shell-sidebar-width);
    }

        .app-nav .e-sidebar {
            position: absolute !important;
            top: 0;
            bottom: 0;
            left: 0;
            width: var(--shell-sidebar-width) !important;
            transform: none !important;
            z-index: auto !important;
            box-shadow: none !important;
        }
}

/* --- MOBILE (Max-width: 768px) --- */
@media (max-width: 768px) {

    .app-nav {
        width: 0;
        flex: 0 0 0;
    }

        .app-nav .e-sidebar {
            position: fixed !important;
            top: 0;
            bottom: 0;
            left: 0;
            width: var(--shell-sidebar-width) !important;
            z-index: 1000 !important; /* above backdrop */
            transform: translateX(-100%);
            transition: transform 0.3s ease-in-out;
            box-shadow: 4px 0 10px rgba(0,0,0,0.1);
        }

            .app-nav.app-nav-open .e-sidebar,
            .app-nav .e-sidebar.e-open {
                transform: translateX(0) !important;
            }
}


.P4 {
    --runner-font-scale: 0.8;
}

.P6 {
    --runner-font-scale: 1;
}

.P8 {
    --runner-font-scale: 1.2;
}

/* =========================================
   Legacy LiturgyHelp Theme Alignment
   ========================================= */

:root {
    --lh-navy: #18325c;
    --lh-navy-light: #1e3a68;
    --lh-sidebar-width: 220px;
    --lh-gold: #c8a415;
    --lh-gold-light: #f0d347;
    --lh-yellow-bg: #f5c518;
    --lh-red-rubric: #cc0000;
    --lh-header-height: 45px;
    --lh-sidebar-width: 220px;
    --lh-peach-bg: #fdf5ed;
    --lh-border: #d4c5a9;
}

/* --- Header: match legacy dark navy bar --- */
.app-header {
    background-color: var(--lh-navy);
    color: white;
    border-bottom: none;
    padding: 0 0.75rem;
    height: var(--lh-header-height);
    min-height: var(--lh-header-height);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.app-header a,
.app-header button {
    color: white;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-header-logo--product {
    height: 32px;
    object-fit: contain;
}

.app-header-logo--tenant {
    height: 28px;
    object-fit: contain;
}

.app-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-header-spacer {
    display: none;
}

/* Header items matching legacy: search, scope, font size */
.app-header-search {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.app-header-search input {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    width: 160px;
}

.app-header-search input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.app-header-scope {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.app-header-scope select,
.app-header-scope .scope-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
    cursor: pointer;
}

.app-font-sizer {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.app-font-sizer button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0 2px;
    font-family: serif;
    line-height: 1;
    min-height: unset;
}

.app-font-sizer button:nth-child(1) { font-size: 0.7rem; }
.app-font-sizer button:nth-child(2) { font-size: 0.85rem; }
.app-font-sizer button:nth-child(3) { font-size: 1rem; }
.app-font-sizer button:nth-child(4) { font-size: 1.15rem; }

/* When header strip image is present, add a dark scrim so controls stay readable */
.app-header-right--strip {
    background-size: cover;
    background-position: center;
    position: relative;
}

.app-header-right--strip::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(24, 50, 92, 0.65);
    pointer-events: none;
    z-index: 0;
}

.app-header-right--strip > * {
    position: relative;
    z-index: 1;
}

.app-auth-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    cursor: pointer;
    min-height: unset;
}

.nav-toggle {
    color: white;
}

/* --- Left Sidebar: match legacy style --- */
.app-nav .e-sidebar,
.app-nav {
    background-color: white;
    border-right: 1px solid var(--lh-border);
}

/* Override Syncfusion sidebar width to match legacy 210px */
.app-nav .e-sidebar {
    width: var(--lh-sidebar-width) !important;
}

/* Sidebar profile block at top */
.lh-sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.75rem;
    border-bottom: 1px solid var(--lh-border);
    font-size: 0.8rem;
    color: var(--lh-navy);
}

.lh-sidebar-profile-icon {
    font-size: 1.4rem;
}

.lh-sidebar-profile-details {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.lh-sidebar-profile-name {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.lh-sidebar-profile-role {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #666;
}

.lh-sidebar-profile-org {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #666;
}

/* Nav tree custom styling to match legacy */
.lh-nav-tree .e-list-item {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--lh-navy);
}

.lh-nav-tree .e-list-item .e-list-text {
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lh-nav-tree .e-list-item .e-icons {
    font-size: 0.75rem;
}

/* Sidebar menu item icons matching legacy */
.lh-icon-calendar::before { content: "\1F4C5"; }
.lh-icon-seasons::before { content: "\1F30D"; }
.lh-icon-sacraments::before { content: "\271D"; }
.lh-icon-masses::before { content: "\1F514"; }
.lh-icon-occasions::before { content: "\1F451"; }
.lh-icon-topical::before { content: "\1F4CA"; }
.lh-icon-library::before { content: "\1F4D6"; }
.lh-icon-resources::before { content: "\1F4C1"; }
.lh-icon-scripture::before { content: "\1F4D6"; }
.lh-icon-planning::before { content: "\270F"; }
.lh-icon-admin::before { content: "\2699"; }

[class^="lh-icon-"]::before,
[class*=" lh-icon-"]::before {
    display: inline-block;
    margin-right: 6px;
    font-style: normal;
    font-size: 0.9rem;
}

/* Expand/collapse toggle icons matching legacy ⊞/⊟ */
.lh-nav-tree .e-list-item .e-icon-expandable::before { content: "\229E"; }
.lh-nav-tree .e-list-item .e-icon-collapsible::before { content: "\229F"; }

/* Back button at bottom of sidebar */
.lh-sidebar-back {
    padding: 0.75rem;
    text-align: center;
    border-top: 1px solid var(--lh-border);
}

.lh-sidebar-back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--lh-navy);
    background: var(--lh-navy);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: unset;
}

.lh-sidebar-back-btn:hover {
    background: var(--lh-navy-light);
}

/* Nav container fills sidebar and allows back button at bottom */
.omnia-nav-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.omnia-nav-container .e-treeview {
    flex: 1;
    overflow-y: auto;
}

/* --- Loading Spinner --- */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-dots {
    display: flex;
    gap: 6px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--lh-navy);
    animation: loading-bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }
.loading-dots span:nth-child(4) { animation-delay: 0.16s; }

@keyframes loading-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

.loading-message {
    margin-top: 0.75rem;
    color: #666;
    font-size: 0.9rem;
}

/* --- Top Right Nav --- */
.top-right-nav {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.top-right-nav-btn {
    background-color: var(--lh-navy);
    color: white;
    border: 1px solid #333;
    border-radius: 0;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    min-height: unset;
}

.top-right-nav-btn:hover {
    background-color: var(--lh-navy-light);
}

.top-right-nav-label-short { display: none; }

@media (max-width: 992px) {
    .top-right-nav-label-full { display: none; }
    .top-right-nav-label-short { display: inline; }
}

/* --- Top Left Tabs --- */
.top-left-tabs {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}

.top-left-tab {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background-color: #e8e8e8;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid #ccc;
    border-bottom: none;
    cursor: pointer;
}

.top-left-tab:hover {
    background-color: #d0d0d0;
}

.top-left-tab.active {
    background-color: white;
    font-weight: 600;
    border-bottom: 2px solid white;
}

/* --- Image Carousel --- */
.image-carousel {
    margin-bottom: 0.75rem;
}

.image-carousel-img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 4px;
    border-radius: 2px;
}

/* --- Menu Internal (legacy yellow tabs) --- */
.menu-internal {
    font-size: 0.85rem;
}

.menu-internal-header {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.5rem;
    margin-bottom: 1px;
    border: none;
    border-radius: 0;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: normal;
    background-color: var(--lh-yellow-bg);
    color: #333;
    font-weight: 500;
    min-height: unset;
}

.menu-internal-header:hover {
    background-color: var(--lh-gold-light);
}

.menu-internal-header.bg-highlight {
    background-color: var(--lh-yellow-bg);
}

.menu-internal-header.font-highlight {
    color: white;
    background-color: var(--lh-navy);
}

.menu-internal-children {
    background-color: white;
}

.menu-internal-item {
    display: block;
    color: black;
    text-decoration: none;
    font-size: 0.8rem;
    padding: 3px 5px 3px 15px;
    margin-left: 1px;
    text-indent: -10px;
    cursor: pointer;
}

.menu-internal-item:hover {
    background-color: #f0f0f0;
    color: black;
}

.menu-internal-item.active {
    background-color: #e3f2fd;
    font-weight: 600;
}

.menu-internal-expandable {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-indent: 0;
}

.menu-internal-toggle {
    margin-left: 0.5rem;
    color: #666;
    flex-shrink: 0;
}

/* --- Liturgical Season Colors --- */
.season-advent { --season-color: #6a0dad; }
.season-christmas { --season-color: #c8a415; }
.season-lent { --season-color: #6a0dad; }
.season-easter { --season-color: #c8a415; }
.season-ordinary { --season-color: #2e7d32; }

/* --- Content Layout: match legacy three-column for Calendar --- */
.fullpage-layout {
    display: flex;
    gap: 0;
    min-height: 0;
}

.fullpage-summary {
    flex: 0 0 250px;
    border-right: 1px solid var(--lh-border);
    padding: 0.5rem;
    background-color: var(--lh-peach-bg);
    overflow-y: auto;
}

.fullpage-menu {
    flex: 0 0 140px;
    border-right: 1px solid var(--lh-border);
    overflow-y: auto;
}

.fullpage-content {
    flex: 1;
    padding: 0.75rem 1rem;
    overflow-y: auto;
}

/* --- Page content background matching legacy peach --- */
.app-content {
    background-color: var(--lh-peach-bg);
}

/* --- Shell frame body: no extra padding when page handles its own layout --- */
.shell-frame-body {
    flex: 1;
    min-height: 0;
}

/* --- Shell Top Bar: matching legacy dark blue breadcrumb/context bar --- */
.shell-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--lh-navy);
    color: white;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    gap: 0.5rem;
}

.shell-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.shell-topbar-tab {
    color: white;
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.shell-topbar-tab:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.shell-topbar-tab.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* --- Shell Breadcrumbs: matching legacy breadcrumb style --- */
.shell-breadcrumbs {
    padding: 0.3rem 0;
    font-size: 0.8rem;
}

.shell-breadcrumbs-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.shell-breadcrumbs-item {
    display: flex;
    align-items: center;
}

.shell-breadcrumbs-item::after {
    content: ">";
    margin-left: 0.25rem;
    color: #999;
    font-size: 0.7rem;
}

.shell-breadcrumbs-item:last-child::after {
    display: none;
}

.shell-breadcrumbs-item a {
    color: var(--lh-navy);
    text-decoration: none;
    font-size: 0.8rem;
}

.shell-breadcrumbs-item a:hover {
    text-decoration: underline;
}

.shell-breadcrumbs-item span[aria-current] {
    font-weight: 600;
    color: #333;
}

/* --- Shell Page Header --- */
.shell-page-header {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--lh-border);
    margin-bottom: 0.5rem;
}

.shell-page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.shell-page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--lh-navy);
    margin: 0.25rem 0;
}

.shell-page-actions {
    display: flex;
    gap: 0.5rem;
}

/* --- Shell Section Tabs: matching legacy bottom/section tab strip --- */
.shell-section-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--lh-navy);
    margin-bottom: 0.5rem;
}

.shell-section-tab {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    background-color: #e0e0e0;
    color: #333;
    text-decoration: none;
    font-size: 0.8rem;
    border: 1px solid #ccc;
    border-bottom: none;
    cursor: pointer;
}

.shell-section-tab:hover {
    background-color: #d0d0d0;
}

.shell-section-tab.active {
    background-color: var(--lh-navy);
    color: white;
    font-weight: 600;
}

/* --- Shell Frame --- */
.shell-frame {
    display: flex;
    flex-direction: column;
    height: 100%;
}