/* ================================================================
   shared.css — Common styles for all WinCMS pages
   ================================================================ */

/* ===========================
   CSS Variables
   =========================== */
:root {
    --color-primary: #1d4261;
    --color-primary-dark: #15334a;
    --color-primary-hover: #3172a8;
    --color-border: #ccc;
    --font-ui: 'Montserrat', sans-serif;
}

body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    overflow-x: hidden;
}

/* Buttons and inputs don't inherit font-family by default in browsers */
button, input, select, textarea {
    font-family: inherit;
}

/* ===========================
   Sidebar Layout
   =========================== */
.topBar {
    width: 100%;
    height: 60px;
    background-color: #1d4261;
}

.sidebar {
    position: fixed;
    overflow: auto;
    width: 200px;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #f1f1f1;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    flex-direction: column;
}

.sidebar .logo {
    height: 60px;
    margin: 10px;
}

.sidebar a:not(.tos, .pp) {
    display: block;
    color: black;
    padding: 16px;
    text-decoration: none;
}

.sidebar a.active {
    background-color: #1d4261;
    color: white;
}

.sidebar a:hover:not(.active, .tos, .pp) {
    background-color: #3172a8;
    color: white;
}

.tos-pp {
    margin-top: auto;
    padding: 10px 0;
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

a.tos, a.pp {
    color: #888;
    text-decoration: none;
}

a.tos:hover, a.pp:hover {
    text-decoration: underline;
}

.content {
    margin-left: 200px;
}

/* ===========================
   Primary Button
   =========================== */
.primary-btn {
    display: block;
    width: 100%;
    height: 38px;
    background: #1d4261;
    color: white;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 1px;
    font-weight: 500;
    font-size: 12px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 10px;
    padding: 0 5px;
    box-sizing: border-box;
}

.primary-btn:hover {
    background: #15334a;
}

/* ===========================
   Cancel / Secondary Button
   =========================== */
.cancel-btn {
    width: 100%;
    height: 38px;
    margin-top: 10px;
    padding: 0px 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 1px;
    font-weight: 500;
    font-size: 12px;
    background: white;
    color: #888;
}

.cancel-btn:hover {
    background: #eaeaea;
}

/* ===========================
   Danger Button
   =========================== */
.danger-btn {
    display: block;
    width: 100%;
    height: 38px;
    background: #c0392b;
    color: white;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 1px;
    font-weight: 500;
    font-size: 12px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 10px;
    padding: 0 5px;
    box-sizing: border-box;
}

.danger-btn:hover {
    background: #a93226;
}

/* ===========================
   Dialog / Form styles
   =========================== */
#form_content_inner_container h3 {
    margin: 0 0 4px 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    color: #1d4261;
}

.dialog-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    color: #888;
    margin: 0 0 16px 0;
    letter-spacing: 0.3px;
}

.dialog-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.dialog-field label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 4px;
}

.dialog-field input,
.dialog-field select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Montserrat', sans-serif;
    color: #333;
    box-sizing: border-box;
    margin-bottom: 0;
}

.dialog-field input:focus,
.dialog-field select:focus {
    outline: none;
    border-color: #3172a8;
    box-shadow: 0 0 0 2px rgba(49,114,168,0.15);
}

.dialog-row {
    display: flex;
    gap: 12px;
}

.dialog-row .dialog-field {
    flex: 1;
}

.dialog-status {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    margin: 8px 0;
    min-height: 16px;
}

.status-error {
    color: #c0392b;
}

.status-success {
    color: #2d7a47;
}

/* ===========================
   Church Picker Bar (system admin only)
   =========================== */
.church-picker-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f4f7fb;
    border: 1px solid #d8e4f0;
    border-radius: 8px;
    padding: 10px 16px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    color: #555;
}

.church-picker-bar select {
    width: auto;
    min-width: 200px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Montserrat', sans-serif;
    color: #333;
    background: #fff;
    margin-bottom: 0;
}

.church-picker-bar label {
    display: inline;
    font-size: 13px;
    letter-spacing: normal;
    margin-bottom: 0;
    white-space: nowrap;
}

/* ===========================
   Loader Dialog
   =========================== */
#loaderDialog {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    overflow: visible;
    width: fit-content;
    max-width: none;
}

#loaderDialog::backdrop {
    background: rgba(15, 30, 50, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: #fff;
    border-radius: 16px;
    padding: 36px 48px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    min-width: 180px;
}

.loader-logo {
    height: 48px;
    opacity: 0.9;
}

.loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e8f0;
    border-top-color: #1d4261;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #6b8aab;
    margin: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Button-level loading spinner (used across pages) */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* ===========================
   Mobile Navigation — Hamburger Drawer
   =========================== */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    font-size: 22px;
    height: 60px;
    width: 56px;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex-shrink: 0;
}

.topbar-title {
    display: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: white;
    letter-spacing: 1px;
    padding-left: 12px;
    white-space: nowrap;
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 900;
}

.nav-overlay.overlay-open {
    display: block;
}

@media (max-width: 768px) {
    /* Fixed top bar */
    .topBar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 800;
        display: flex;
        align-items: center;
    }

    .topbar-title { display: block; }
    .nav-hamburger { display: flex; }

    /* Sidebar becomes a slide-in drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 240px;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
        overflow-y: auto;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    }

    /* Content clears the fixed top bar */
    .content {
        margin-left: 0;
        padding-top: 60px;
    }

    /* Dialogs fit the screen */
    dialog {
        width: calc(100vw - 32px);
        max-width: none;
        padding: 20px 16px;
        box-sizing: border-box;
        margin: auto;
    }

    /* Fixed-width form containers inside dialogs */
    #form_container {
        width: 100% !important;
        padding: 0 !important;
        box-sizing: border-box;
    }
}
