@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;600;700&display=swap');

:root {
    --maroon: #8b2e2e;
    --maroon-dark: #6e2020;
    --green: #7cb342;
    --green-dark: #588a26;
    --bg: #faf8f5;
    --text: #2b2320;
    --border: #e2d9d0;
    --white: #ffffff;
    --pwa-banner-h: 0px;
}
html.pwa-banner-on {
    --pwa-banner-h: 76px;
}

html, body { overflow-x: hidden; max-width: 100%; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Noto Sans Bengali', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--pwa-banner-h);
}

a { color: var(--maroon); }

/* ===== Public site header ===== */
.site-header {
    background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
    color: #fff;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 16px;
}
.site-header img { width: 64px; height: 64px; border-radius: 50%; background: #fff; padding: 3px; }
.site-header h1 { margin: 0; font-size: 1.3rem; }
.site-header .anniversary { margin: 4px 0 0; font-size: 0.9rem; color: #f3d9d9; }

.site-nav {
    display: flex;
    background: var(--green);
    flex-wrap: wrap;
}
.site-nav a {
    color: #fff;
    text-decoration: none;
    padding: 12px 16px;
    flex: 1;
    text-align: center;
    font-weight: 600;
}
.site-nav a:hover,
.site-nav a.active { background: var(--green-dark); }

.site-main { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; width: 100%; flex: 1; }

/* ===== Credit block (footer + modal share the same design) ===== */
.site-footer {
    margin-top: auto;
    padding: 0;
}

.credit-block {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
    background:
        radial-gradient(ellipse 70% 90% at 92% 108%, rgba(232, 192, 122, 0.28) 0%, transparent 58%),
        radial-gradient(ellipse 55% 70% at 8% 0%, rgba(139, 46, 46, 0.55) 0%, transparent 52%),
        linear-gradient(160deg, #4a1f1c 0%, #6e2c28 22%, #3d221c 52%, #1c100e 100%);
    box-shadow: inset 0 1px 0 rgba(243, 217, 160, 0.28);
}

.credit-block::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 4%, #c9a05a 30%, #f3d9a0 50%, #c9a05a 70%, transparent 96%);
    z-index: 1;
    pointer-events: none;
}

.credit-block::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 55%;
    height: 100%;
    background: radial-gradient(ellipse at 70% 80%, rgba(255, 220, 160, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.credit-text {
    color: #efe7dc;
    padding: 20px 18px;
    position: relative;
    z-index: 2;
}
.credit-line { margin: 2px 0; font-size: 0.85rem; color: #d4c4ae; }
.credit-name {
    margin: 4px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0,0,0,0.35);
}
.credit-contact { margin-top: 10px; font-size: 0.85rem; color: #d4c4ae; }
.credit-contact a {
    color: #f3d9a0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    margin-right: 16px;
    font-weight: 600;
    position: relative;
    z-index: 2;
}
.credit-contact a:hover { color: #fff; }
.credit-photo {
    height: 220px;
    width: auto;
    display: block;
    align-self: flex-end;
    margin: 0;
    flex-shrink: 0;
    pointer-events: none;
    position: relative;
    z-index: 1;
    filter: drop-shadow(-8px 4px 18px rgba(0,0,0,0.35));
}

@media (max-width: 640px) {
    .credit-block { flex-direction: column; align-items: center; }
    .credit-text { text-align: center; padding: 18px 16px 0; }
    .credit-contact a { margin: 6px 8px 0; }
    .credit-photo { height: 180px; align-self: center; margin-top: 8px; }
}

/* ===== Load-in credit modal (bottom sheet) ===== */
.credit-modal {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    box-shadow: 0 -10px 28px rgba(28, 16, 14, 0.45);
    animation: creditStripRise 1s cubic-bezier(.22,1,.36,1) both;
}

html.credit-dismissed .credit-modal {
    display: none !important;
}

.credit-modal.is-closing {
    animation: creditStripFall 0.4s ease-in forwards !important;
}

@keyframes creditStripRise {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes creditStripFall {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

.credit-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    pointer-events: auto;
    transition: background 0.2s ease, transform 0.2s ease;
}
.credit-close:hover { background: rgba(0,0,0,0.7); transform: scale(1.08); }

/* ===== PWA install banner (always on until installed) ===== */
.pwa-install-banner {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: auto;
    z-index: 1100;
    display: none;
    align-items: center;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 22px rgba(43, 35, 32, 0.14);
}
html.pwa-banner-on .pwa-install-banner { display: flex; }
html.pwa-installed .pwa-install-banner { display: none !important; }

.pwa-install-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    background: #fff;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.pwa-install-copy { flex: 1; min-width: 0; }
.pwa-install-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
}
.pwa-install-sub {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: #7a7168;
    line-height: 1.3;
}
.pwa-install-btn {
    flex-shrink: 0;
    border: none;
    background: var(--green);
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}
.pwa-install-btn:hover { background: var(--green-dark); }
.pwa-install-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* ===== Hero / sections ===== */
.hero {
    text-align: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 18px;
    margin-bottom: 24px;
}
.hero h2 { color: var(--maroon); margin-top: 0; }
.reg-count { color: var(--green-dark); font-weight: 600; margin-top: 14px; }

.notices h2, .form-section h2 { color: var(--maroon); }
.form-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 18px;
    margin-bottom: 24px;
}
.form-section .auth-link { margin-top: 16px; }

.notice-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 5px solid var(--green);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}
.notice-item small { color: #8a8177; }
a.notice-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
a.notice-link:hover { border-left-color: var(--maroon); }
.notice-enable-wrap { margin: 0 0 14px; }
.notice-detail .notice-back { margin: 0 0 10px; }
.notice-detail .notice-date { display: block; color: #8a8177; margin-bottom: 14px; }
.notice-detail .notice-body { margin-top: 8px; }

/* ===== Buttons ===== */
.btn-primary {
    display: inline-block;
    background: var(--maroon);
    color: #fff;
    border: none;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
}
.btn-primary:hover { background: var(--maroon-dark); }
.btn-lg { padding: 15px 30px; font-size: 1.1rem; }

.btn-danger {
    display: inline-block;
    background: #b23a3a;
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    margin-top: 10px;
}
.btn-danger-sm {
    background: #b23a3a;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

/* ===== Forms ===== */
.stack-form, .auth-card form { display: flex; flex-direction: column; gap: 6px; }
.stack-form label, .auth-card form label { font-weight: 600; margin-top: 10px; }
.stack-form input[type=text],
.stack-form input[type=email],
.stack-form input[type=password],
.stack-form input[type=file],
.stack-form select,
.stack-form textarea,
.auth-card input {
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
    background: #fff;
}
.stack-form textarea { min-height: 80px; resize: vertical; }
.radio-row { display: flex; gap: 20px; margin-top: 4px; }
.radio-row label { font-weight: 400; display: flex; align-items: center; gap: 6px; margin-top: 0; }

.inline-form { display: flex; gap: 8px; margin: 14px 0; }
.inline-form input { flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }

.alert-error {
    background: #fdeaea;
    color: #a33228;
    border: 1px solid #f0bcbc;
    padding: 10px 14px;
    border-radius: 8px;
}
.alert-success {
    background: #eef7e6;
    color: var(--green-dark);
    border: 1px solid #c7e6ac;
    padding: 10px 14px;
    border-radius: 8px;
}

/* ===== Auth pages ===== */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    background: linear-gradient(135deg, var(--maroon), var(--green-dark));
}
.auth-card {
    background: #fff;
    padding: 30px 24px;
    border-radius: 14px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.auth-logo { width: 80px; height: 80px; margin-bottom: 10px; }
.auth-card h1 { font-size: 1.1rem; color: var(--maroon); margin: 0 0 4px; }
.auth-card h2 { font-size: 1rem; margin: 0 0 14px; color: #555; }
.auth-link { margin-top: 14px; font-size: 0.9rem; }

/* ===== Admin panel ===== */
.admin-topbar {
    background: var(--maroon);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}
.admin-topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.admin-topbar-brand img { width: 34px; height: 34px; border-radius: 50%; background: #fff; }
.nav-toggle { background: none; border: none; color: #fff; font-size: 1.4rem; display: none; cursor: pointer; }

.admin-layout { display: flex; min-height: calc(100vh - 58px); min-width: 0; max-width: 100%; }
.admin-sidebar {
    background: #2b2320;
    color: #fff;
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 16px 0;
}
.admin-sidebar a {
    color: #ddd3c8;
    text-decoration: none;
    padding: 12px 18px;
    font-weight: 600;
}
.admin-sidebar a:hover,
.admin-sidebar a.active { background: #3a3028; color: #fff; }
.sidebar-user { padding: 0 18px 14px; border-bottom: 1px solid #4a3f36; margin-bottom: 8px; font-size: 0.85rem; color: #cbbfae; }

.admin-main { flex: 1; padding: 22px; max-width: 900px; min-width: 0; overflow-x: hidden; }
.admin-main h1 { color: var(--maroon); margin-top: 0; }
.admin-main h2 { color: var(--maroon-dark); font-size: 1.1rem; }

.stat-cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 24px;
    text-align: center;
}
.stat-num { font-size: 2rem; font-weight: 700; color: var(--green-dark); }
.stat-label { color: #6b6259; font-size: 0.9rem; }

.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.data-table { width: 100%; min-width: 720px; border-collapse: collapse; background: #fff; }
.data-table th, .data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
    font-size: 0.92rem;
}
.data-table th { background: #f3ece4; color: var(--maroon-dark); }

.thumb { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.thumb-lg { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin-bottom: 12px; }

/* ===== Responsive ===== */
@media (max-width: 720px) {
    .nav-toggle { display: block; }
    .admin-sidebar {
        position: fixed;
        top: 58px;
        left: -240px;
        bottom: 0;
        z-index: 50;
        transition: left 0.2s ease;
        width: 220px;
    }
    .admin-sidebar.open { left: 0; }
    .admin-main { padding: 16px; }
}