/* ===== Badr Mosque brand theme (warm beige + gold + teal accents) ===== */
:root {
    --brand-teal: #1f7e8c;
    --brand-teal-dark: #155f6b;
    --brand-gold: #c2a052;
    --brand-gold-soft: #e3d2a6;
    --brand-cream: #f3e9d6;
    --brand-card: #fffdf7;
    --brand-head: #f8f1df;
    --brand-ink: #33312b;
    --brand-muted: #8a8170;
}

html, body {
    font-family: 'Segoe UI', 'Tahoma', 'Helvetica Neue', Arial, sans-serif;
    background: radial-gradient(1100px 480px at 50% -8%, #fbf6ea 0%, var(--brand-cream) 62%) fixed;
    color: var(--brand-ink);
}

/* ----- App shell ----- */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: linear-gradient(180deg, #fffdf7 0%, #f8f1df 100%);
    border-bottom: 3px solid var(--brand-teal);
    box-shadow: 0 3px 14px rgba(122, 96, 30, 0.07);
}

.brand-logo {
    width: 60px;
    height: 60px;
    object-fit: cover;
    object-position: center 38%;
    border-radius: 50%;
    border: 2px solid var(--brand-gold);
    box-shadow: 0 0 0 4px #fff, 0 2px 6px rgba(0,0,0,0.08);
    background: #fff;
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-teal-dark);
    line-height: 1.1;
}

.brand-sub {
    font-size: 0.95rem;
    color: var(--brand-muted);
}

/* Push the logout control to the far (start) edge of the header in RTL. */
.header-logout {
    margin-inline-start: auto;
    margin-bottom: 0;
}

.header-logout-btn {
    background: transparent;
    border: 1px solid var(--brand-gold-soft);
    color: var(--brand-teal-dark);
    border-radius: 8px;
    padding: 0.35rem 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.header-logout-btn:hover {
    background: var(--brand-head);
    border-color: var(--brand-gold);
}

.app-main {
    flex: 1;
    padding: 1.5rem 1rem 3rem;
}

/* ----- Login page (matches the Badr Mosque brand identity) ----- */
.login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(1100px 480px at 50% -8%, #fbf6ea 0%, var(--brand-cream) 62%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--brand-card);
    border: 1px solid var(--brand-gold-soft);
    border-top: 4px solid var(--brand-teal);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(122, 96, 30, 0.14);
    padding: 2rem 1.75rem 1.9rem;
    text-align: center;
}

.login-logo {
    width: 88px;
    height: 88px;
    object-fit: cover;
    object-position: center 38%;
    border-radius: 50%;
    border: 2px solid var(--brand-gold);
    box-shadow: 0 0 0 5px #fff, 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--brand-teal-dark);
    margin-top: 0.75rem;
    line-height: 1.1;
}

.login-sub {
    font-size: 0.95rem;
    color: var(--brand-muted);
    margin-bottom: 1.4rem;
}

.login-field {
    text-align: start;
    margin-bottom: 0.9rem;
}

.login-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand-teal-dark);
    margin-bottom: 0.3rem;
}

.login-error {
    background: #fbe9e7;
    border: 1px solid #f3c0ba;
    border-inline-start: 4px solid #b02a37;
    color: #842029;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 1.1rem;
}

.content-wrap {
    max-width: 920px;
    margin: 0 auto;
}

/* ----- Cards ----- */
.card {
    background: var(--brand-card);
    border: 1px solid var(--brand-gold-soft);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(122, 96, 30, 0.08);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(180deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
    color: #fdf8ec;
    font-weight: 700;
    border-bottom: 2px solid var(--brand-gold);
    position: relative;
}

.card-header::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--brand-gold);
}

.card-header code {
    color: #ffe7a8;
    background: rgba(255, 255, 255, 0.12);
    padding: 0 0.25rem;
    border-radius: 4px;
}

/* ----- Buttons ----- */
.btn-brand {
    background: var(--brand-teal);
    border: 1px solid var(--brand-teal);
    color: #fff;
}

.btn-brand:hover:not(:disabled) {
    background: var(--brand-teal-dark);
    border-color: var(--brand-teal-dark);
    color: #fff;
}

.btn-brand:disabled {
    opacity: 0.55;
}

.btn-gold {
    background: var(--brand-gold);
    border: 1px solid var(--brand-gold);
    color: #fff;
}

.btn-gold:hover {
    filter: brightness(0.93);
    color: #fff;
}

.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(44, 156, 171, 0.25);
}

.form-control:focus {
    border-color: var(--brand-teal);
}

/* ----- Custom file picker ----- */
.file-pick {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin: 0;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--brand-head);
    border: 1px solid var(--brand-gold-soft);
    border-radius: 10px;
    padding: 0.35rem 0.6rem;
    color: var(--brand-teal-dark);
}

.file-chip .remove-x {
    border: none;
    background: transparent;
    color: #b02a37;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.2rem;
}

/* ----- Info alerts: warm cream with a gold accent ----- */
.alert-info {
    background: var(--brand-head);
    border: 1px solid var(--brand-gold-soft);
    border-inline-start: 4px solid var(--brand-gold);
    color: var(--brand-teal-dark);
}

/* ----- Per-sheet log blocks ----- */
.sheet-block {
    background: var(--brand-card);
    border: 1px solid var(--brand-gold-soft);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(122, 96, 30, 0.06);
}

.sheet-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: linear-gradient(180deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
    color: #fdf8ec;
    font-weight: 700;
    padding: 0.5rem 0.85rem;
    border-bottom: 2px solid var(--brand-gold);
}

.sheet-counts {
    display: inline-flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    font-weight: 600;
}

/* ----- Tables / badges keep semantic colors ----- */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: #faf4e6;
}

.table > thead th {
    background: #efe2c6;
    color: var(--brand-teal-dark);
    border-bottom: 2px solid var(--brand-gold-soft);
}

/* ----- Message formatting toolbar ----- */
.fmt-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fmt-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--brand-head);
    border: 1px solid var(--brand-gold-soft);
    border-radius: 10px;
    padding: 3px;
}

.fmt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-width: 34px;
    height: 30px;
    padding: 0 0.55rem;
    border: 0;
    background: transparent;
    color: var(--brand-teal-dark);
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.fmt-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.fmt-btn:hover:not(:disabled) {
    background: #fff;
    color: var(--brand-teal);
    box-shadow: 0 1px 3px rgba(22, 28, 80, 0.14);
}

.fmt-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.fmt-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.fmt-dir.active,
.fmt-dir.active:hover {
    background: var(--brand-teal);
    color: #fff;
    box-shadow: 0 1px 3px rgba(22, 28, 80, 0.22);
}

.fmt-sep {
    width: 1px;
    align-self: stretch;
    min-height: 24px;
    background: var(--brand-gold-soft);
    margin: 0 0.1rem;
}

/* The {name} placeholder token, shown on the insert button and in the hint. */
.fmt-token {
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 700;
}

.form-text .fmt-token {
    color: var(--brand-teal-dark);
}

.msg-preview {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 1rem;
    line-height: 1.6;
    margin-top: 0.25rem;
}

.msg-preview code {
    background: var(--brand-head);
    border-radius: 4px;
    padding: 0 0.2rem;
    font-family: 'Consolas', 'Courier New', monospace;
}

h1:focus { outline: none; }

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "حدث خطأ.";
    }
