@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;1,500&display=swap');

:root {
    --bg: #faf7f1;
    --surface: #fffdf9;
    --surface-soft: #f5eee5;
    --primary: #a87949;
    --primary-dark: #855c37;
    --accent: #d8b58e;
    --text: #40382f;
    --muted: #7c7369;
    --border: #eadbca;
    --shadow: 0 18px 50px rgba(100, 73, 46, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 76px;
    background: rgba(250,247,241,.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    width: min(1180px, calc(100% - 40px));
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    color: var(--primary);
    font-size: 27px;
    font-weight: 700;
    letter-spacing: .2px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 10px 18px;
    border-radius: 999px;
    color: #665e55;
    font-size: 14px;
    font-weight: 600;
    transition: .2s ease;
}

.nav-link:hover, .nav-link.active {
    background: #ead6bd;
    color: var(--primary-dark);
}

.menu-button {
    display: none;
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font-size: 27px;
    cursor: pointer;
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 28px 0 80px;
}

.notice {
    margin: 0 auto 36px;
    width: min(940px, 100%);
    overflow: hidden;
    white-space: nowrap;
    border-radius: 13px;
    background: #c7925f;
    color: #fff;
    box-shadow: 0 8px 25px rgba(142, 95, 52, .12);
}

.notice-track {
    display: inline-block;
    padding: 12px 0;
    min-width: 100%;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .5px;
}

.hero {
    min-height: 310px;
    display: grid;
    place-items: center;
    padding: 55px 40px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #f7f0e8, #fbf7f1);
    box-shadow: var(--shadow);
    text-align: center;
}

.cross {
    color: var(--accent);
    font-size: 26px;
    margin-bottom: 20px;
}

.verse {
    max-width: 800px;
    margin: 0 auto;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.55;
    font-style: italic;
    color: #3f3933;
}

.verse-ref {
    margin-top: 20px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.section {
    margin-top: 54px;
}

.section-title {
    margin: 0 0 22px;
    text-align: center;
    color: var(--primary);
    font-size: 31px;
    letter-spacing: .2px;
}

.video-card {
    width: min(800px, 100%);
    margin: 0 auto;
}

.video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 15px;
    background: #1b1b1b;
    box-shadow: var(--shadow);
}

.video-frame iframe,
.video-frame img {
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

.video-fallback {
    display: grid;
    place-items: center;
    height: 100%;
    color: white;
    text-align: center;
    padding: 25px;
}

.play-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 14px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f20d2f;
    color: white;
    font-size: 25px;
}

.video-title {
    margin: 18px 0 14px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    padding: 0 25px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

.btn-outline {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-primary {
    border: 0;
    background: var(--primary);
    color: white;
}

.btn-primary:hover { background: var(--primary-dark); }

.center { text-align: center; }

.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 35px;
    box-shadow: var(--shadow);
}

.content-card h2 {
    color: var(--primary);
    margin-top: 0;
}

.content-card p {
    line-height: 1.8;
    color: #625a52;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.sermon-list {
    display: grid;
    gap: 26px;
}

.sermon-item {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: center;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.sermon-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-soft);
}

.sermon-thumb iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.form-grid { display: grid; gap: 18px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.field label {
    display: block;
    margin-bottom: 7px;
    color: #5d554c;
    font-weight: 700;
    font-size: 14px;
}

.field input, .field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 13px 14px;
    outline: none;
}

.field input:focus, .field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(216,181,142,.18);
}

.field textarea { min-height: 145px; resize: vertical; }

.footer {
    border-top: 1px solid var(--border);
    background: #f7f0e8;
    text-align: center;
    padding: 35px 20px 42px;
    color: var(--muted);
    font-size: 14px;
}

.footer-verse {
    margin-top: 10px;
    color: var(--primary);
    font-style: italic;
}

.loading, .empty-state {
    padding: 55px 20px;
    text-align: center;
    color: var(--muted);
}

.app-loading {
    min-height: 100vh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: var(--primary);
    font-weight: 700;
}

.cross-loader { font-size: 32px; color: var(--accent); }

/* ===== INTRO ZOOM LOADING SCREEN ===== */
#loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

#loader-text {
    font-family: 'Quicksand', 'DM Sans', sans-serif;
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 2rem;
    animation: growText 2.5s ease-out forwards;
    letter-spacing: 2px;
    text-align: center;
    margin: 0;
    padding: 0;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent !important;
}

#loader-text:focus,
#loader-text:focus-visible,
#loader-text:active,
#loader-text:hover {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

@keyframes growText {
    0% {
        font-size: 2rem;
        opacity: 1;
    }
    60% {
        font-size: min(5rem, 13vw);
        opacity: 1;
    }
    100% {
        font-size: min(5rem, 13vw);
        opacity: 0;
    }
}

@media (max-width: 600px) {
    @keyframes growText {
        0% {
            font-size: 1.5rem;
            opacity: 1;
        }
        60% {
            font-size: 2.8rem;
            opacity: 1;
        }
        100% {
            font-size: 2.8rem;
            opacity: 0;
        }
    }
}

.app-loaded {
    animation: fadeInUp 0.8s ease forwards;
}

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

@media (max-width: 760px) {
    .site-header { height: auto; min-height: 68px; }
    .header-inner { min-height: 68px; flex-wrap: wrap; }
    .menu-button { display: block; }
    .nav {
        display: none;
        width: 100%;
        padding: 0 0 12px;
        flex-direction: column;
        align-items: stretch;
    }
    .nav.open { display: flex; }
    .nav-link { text-align: center; }
    .hero { padding: 40px 20px; }
    .page-shell { width: min(100% - 24px, 1180px); padding-top: 18px; }
    .grid, .form-row { grid-template-columns: 1fr; }
    .sermon-item { grid-template-columns: 1fr; }
    .section-title { font-size: 27px; }
}


.nav-button {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.login-shell {
    width: min(460px, calc(100% - 30px));
    margin: 70px auto 100px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 38px;
    box-shadow: var(--shadow);
}

.login-cross {
    text-align: center;
    color: var(--accent);
    font-size: 30px;
    margin-bottom: 8px;
}

.login-title {
    text-align: center;
    color: var(--primary);
    margin: 0 0 8px;
    font-size: 30px;
}

.login-subtitle {
    text-align: center;
    color: var(--muted);
    margin: 0 0 28px;
}

.login-error {
    padding: 11px 14px;
    border-radius: 10px;
    background: #fff0ed;
    color: #a33c2d;
    margin-bottom: 18px;
    font-size: 14px;
}

.password-row {
    position: relative;
}

.password-row input {
    padding-right: 75px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 7px;
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    padding: 7px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
}

.admin-header h1 { margin: 0; color: var(--primary); }

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.admin-tab {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--primary);
    padding: 9px 15px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
}

.admin-tab.active, .admin-tab:hover {
    background: #ead6bd;
}

.editor-grid {
    display: grid;
    gap: 18px;
}

.editor-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.success-box {
    padding: 12px 15px;
    border-radius: 10px;
    background: #edf8ee;
    color: #3b7041;
    font-weight: 600;
}

.error-box {
    padding: 12px 15px;
    border-radius: 10px;
    background: #fff0ed;
    color: #a33c2d;
    font-weight: 600;
}

.admin-table-wrap { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th, .admin-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table th { color: var(--primary); }
.admin-table input {
    width: 100%;
    min-width: 160px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

@media (max-width: 760px) {
    .login-card { padding: 26px 20px; }
    .admin-header { align-items: flex-start; flex-direction: column; }
}


/* Authentication */
.auth-shell {
    min-height: calc(100vh - 150px);
    display: grid;
    place-items: center;
    padding: 60px 20px 80px;
}
.auth-card {
    width: min(470px, 100%);
    padding: 42px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
}
.auth-cross { text-align: center; color: var(--accent); font-size: 30px; }
.auth-card h1 { text-align: center; margin: 12px 0 7px; color: var(--primary); }
.auth-subtitle { text-align: center; color: var(--muted); margin: 0 0 28px; line-height: 1.6; }
.auth-input { min-height: 47px; }
.auth-submit { width: 100%; margin-top: 5px; }
.auth-links { text-align: center; margin-top: 8px; }
.auth-links a { color: var(--primary); font-weight: 700; }
.form-error, .form-success {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
}
.form-error { background: #fff0ef; color: #a33e37; border: 1px solid #efcfcb; }
.form-success { background: #edf8ef; color: #47734c; border: 1px solid #cfe5d1; }
.field-help { color: var(--muted); font-size: 12px; margin-top: 5px; display: block; }

/* Admin */
.nav-button { border: 0; background: transparent; cursor: pointer; }
.admin-shell { padding-top: 45px; }
.admin-heading { margin-bottom: 18px; }
.admin-title { margin-bottom: 4px; }
.admin-subtitle, .admin-help { color: var(--muted); }
.admin-tabs {
    display: flex; gap: 8px; margin-bottom: 20px;
    border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.admin-tab {
    border: 0; background: transparent; padding: 10px 16px;
    border-radius: 999px; color: var(--muted); cursor: pointer; font-weight: 700;
}
.admin-tab.selected { background: #ead6bd; color: var(--primary-dark); }
.admin-card { padding: 30px; }
.admin-alert { margin-bottom: 18px; padding: 13px 16px; border-radius: 12px; font-weight: 700; }
.admin-alert.success { background: #edf8ef; color: #47734c; }
.admin-alert.error { background: #fff0ef; color: #a33e37; }
.admin-list-heading { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-bottom:25px; }
.editor-box {
    background: var(--surface-soft); border: 1px solid var(--border);
    border-radius: 15px; padding: 22px; margin-bottom: 25px;
}
.editor-box h3 { color: var(--primary); margin-top:0; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width:100%; border-collapse: collapse; min-width:760px; }
.admin-table th, .admin-table td {
    padding: 13px 12px; border-bottom: 1px solid var(--border);
    text-align:left; vertical-align:top; font-size:14px;
}
.admin-table th { color: var(--primary-dark); background: var(--surface-soft); }
.url-cell { max-width:300px; word-break:break-all; color:var(--muted); }
.actions { white-space:nowrap; }
.btn-small { min-height:34px; padding:0 13px; font-size:12px; margin-right:5px; }
.btn-danger { border:1px solid #c76d64; color:#a33e37; background:transparent; }
.btn-danger:hover { background:#a33e37; color:#fff; }

@media (max-width: 760px) {
    .auth-card { padding: 30px 22px; }
    .admin-list-heading { align-items:flex-start; flex-direction:column; }
}


.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.admin-actions .btn-danger { cursor: pointer; }

/* ===== ADMIN FILTER & SEARCH BAR ===== */
.admin-filter-bar {
    display: grid;
    grid-template-columns: minmax(280px, 1.8fr) minmax(200px, 1.2fr) auto;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 18px;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #ebd9c8;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(100, 73, 46, 0.04);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.filter-group label {
    font-size: 12px;
    font-weight: 700;
    color: #73675c;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

svg.input-icon, .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    color: #a49688;
    pointer-events: none;
    z-index: 2;
    transition: color .2s ease;
}

.input-icon-wrap:focus-within .input-icon {
    color: var(--primary);
}

.filter-input {
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    width: 100%;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: all .2s ease;
    box-sizing: border-box;
    font-family: inherit;
    line-height: normal;
}

.filter-input.with-icon {
    padding-left: 40px;
    padding-right: 36px;
}

.filter-input.date-input {
    padding-right: 10px;
}

.filter-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(168, 121, 73, 0.15);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.65;
    transition: opacity .15s ease;
    padding: 4px;
    border-radius: 4px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: #f7ede3;
}

.input-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: 0;
    background: #eae0d5;
    color: #6a5e52;
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all .15s ease;
    z-index: 2;
}

.input-clear-btn.date-clear-btn {
    right: 36px;
}

.input-clear-btn:hover {
    background: var(--primary);
    color: #ffffff;
    transform: translateY(-50%) scale(1.08);
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    height: 42px;
}

.btn-filter {
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 0 20px;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all .2s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

.btn-filter.btn-primary {
    background: var(--primary);
    color: #ffffff;
    border: 1.5px solid var(--primary);
    box-shadow: 0 2px 6px rgba(168, 121, 73, 0.2);
}

.btn-filter.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 3px 8px rgba(168, 121, 73, 0.3);
}

.btn-filter.btn-outline {
    background: #ffffff;
    color: #63574c;
    border: 1.5px solid #d8c8b8;
}

.btn-filter.btn-outline:hover:not(:disabled) {
    background: #faf4ed;
    color: var(--primary);
    border-color: var(--primary);
}

svg.btn-icon, .btn-icon {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.btn-filter:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f7f4f0 !important;
    border-color: #e5ded6 !important;
    color: #b0a59a !important;
    box-shadow: none !important;
}

/* Active Filter Summary Badge */
.active-filter-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #faf4ed;
    border: 1px solid #e8d7c4;
    border-radius: 10px;
    padding: 8px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #5d5248;
    flex-wrap: wrap;
    box-shadow: 0 1px 4px rgba(100, 73, 46, 0.03);
}

.badge-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-label {
    font-weight: 600;
    color: #635649;
}

.badge-pill {
    background: #f0e2d1;
    color: #4b3d30;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-pill strong {
    color: var(--primary-dark);
}

.badge-count {
    color: var(--muted);
    font-size: 12.5px;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.badge-reset-btn {
    border: 0;
    background: #eed9c3;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 6px;
    transition: all .15s ease;
    white-space: nowrap;
}

.badge-reset-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

@media (max-width: 900px) {
    .admin-filter-bar {
        grid-template-columns: 1fr 1fr;
    }
    .filter-actions {
        grid-column: span 2;
        justify-content: flex-end;
    }
}

@media (max-width: 580px) {
    .admin-filter-bar {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    .filter-actions {
        grid-column: span 1;
        width: 100%;
    }
    .btn-filter {
        flex: 1;
    }
    .badge-reset-btn {
        margin-left: 0;
    }
}

/* ===== PAGINATION BAR ===== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    padding: 12px 6px;
}

.pagination-bar.center {
    justify-content: center;
    flex-direction: column;
}

.pagination-info {
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    border-radius: 9px;
    cursor: pointer;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(:disabled) {
    background: #ead6bd;
    color: var(--primary-dark);
    border-color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
