:root {
    --red-main: #C81E1E;
    --red-bright: #DC2626;
    --red-dark: #881313;
    --red-deeper: #5F0B0B;
    --green: #16A34A;
    --bg: #F6F7F9;
    --surface: #FFFFFF;
    --border: #E5DCE0;
    --text: #1E2430;
    --muted: #647084;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

/* ================= LOGIN SCREEN ================= */
.login-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--red-bright) 0%, var(--red-dark) 62%, var(--red-deeper) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--surface);
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    border-top: 6px solid var(--red-bright);
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo img {
    height: 56px;
    margin: 0 auto 10px;
    display: block;
}

.login-logo h1 {
    font-size: 20px;
    font-weight: 800;
    color: var(--red-dark);
}

.login-logo p {
    font-size: 12.5px;
    color: var(--muted);
}

/* ================= DASHBOARD SHELL ================= */
.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--red-dark) 0%, var(--red-deeper) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    background: #fff;
    padding: 16px 20px;
    border-bottom: 4px solid var(--red-bright);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand img {
    height: 40px;
    width: auto;
}

.sidebar-nav {
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-tab-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 11px;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
}

.nav-tab-btn i {
    width: 18px;
    text-align: center;
    color: #FCA5A5;
}

.nav-tab-btn:hover,
.nav-tab-btn.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-left-color: #fff;
}

.nav-tab-btn.active i {
    color: #fff;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-view-site {
    background: #fff;
    color: var(--red-dark);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 800;
    padding: 10px 12px;
    text-align: center;
    text-transform: uppercase;
}

.btn-view-site:hover {
    background: #FEE2E2;
}

.btn-logout {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    padding: 9px 12px;
    cursor: pointer;
}

.btn-logout:hover {
    background: #fff;
    color: var(--red-dark);
}

/* ================= MAIN AREA ================= */
.main-area {
    padding: 28px 32px 60px;
    overflow-x: hidden;
}

.topbar-admin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}

.topbar-admin h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--red-dark);
}

.no-db-pill {
    background: #FEF2F2;
    color: var(--red-dark);
    border: 1px solid #FECACA;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 5px solid var(--red-bright);
    padding: 18px 20px;
}

.kpi-card.orange { border-left-color: var(--red-bright); }
.kpi-card.green { border-left-color: var(--red-dark); }

.kpi-card small {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
}

.kpi-card strong {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--red-dark);
    margin-top: 4px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--red-dark);
}

/* ================= BUTTONS & FORMS ================= */
.btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 18px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--red-dark);
    color: #fff;
}

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

.btn-orange {
    background: var(--red-bright);
    color: #fff;
}

.btn-orange:hover {
    background: var(--red-dark);
    color: #fff;
}

.btn-outline {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--red-bright);
    color: var(--red-bright);
}

.btn-danger {
    background: #FEE2E2;
    color: var(--red-bright);
}

.btn-danger:hover {
    background: var(--red-bright);
    color: #fff;
}

.btn-sm {
    padding: 6px 11px;
    font-size: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--red-dark);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    font-family: inherit;
    font-size: 13.5px;
    background: #fff;
    outline: none;
}

.form-control:focus {
    border-color: var(--red-bright);
}

textarea.form-control {
    min-height: 110px;
    resize: vertical;
}

/* ================= IMAGE UPLOAD & MEDIA PICKER ================= */
.image-picker-box {
    border: 2px dashed #E5B4B4;
    background: #FFF9F9;
    padding: 16px;
}

.image-preview-wrap {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.image-preview-thumb {
    width: 140px;
    height: 96px;
    object-fit: cover;
    border: 2px solid var(--red-bright);
    background: #ddd;
}

.media-library-drawer {
    margin-top: 14px;
    max-height: 230px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: none;
}

.media-library-drawer.open {
    display: block;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
}

.media-item {
    border: 2px solid transparent;
    cursor: pointer;
    background: #fff;
    padding: 3px;
    text-align: center;
}

.media-item.selected,
.media-item:hover {
    border-color: var(--red-bright);
}

.media-item img {
    width: 100%;
    height: 66px;
    object-fit: cover;
    display: block;
}

.media-item small {
    display: block;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}

/* ================= DATA TABLE / CARDS ================= */
.data-table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

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

.data-table th {
    background: #FDF7F7;
    font-size: 11.5px;
    text-transform: uppercase;
    color: var(--red-dark);
    font-weight: 800;
}

.table-thumb {
    width: 72px;
    height: 52px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.status-pill {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-pill.upcoming { background: #DC2626; color: #FFFFFF; }
.status-pill.ongoing  { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.status-pill.completed { background: #5F0B0B; color: #FFFFFF; }

.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.admin-gal-card {
    border: 1px solid var(--border);
    background: #fff;
    overflow: hidden;
}

.admin-gal-card img {
    width: 100%;
    height: 130px;
    object-fit: cover;
}

.admin-gal-info {
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.admin-gal-info span {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

/* ================= MODAL ================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(45, 6, 6, 0.72);
    z-index: 1500;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 16px;
    overflow-y: auto;
}

.modal-backdrop.open {
    display: flex;
}

.modal-box {
    background: #fff;
    width: 100%;
    max-width: 740px;
    border-top: 6px solid var(--red-bright);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.modal-head {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-head h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--red-dark);
}

.modal-body {
    padding: 22px 24px;
}

.modal-foot {
    padding: 14px 24px;
    background: #FDF7F7;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ================= TOAST NOTIFICATION ================= */
.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    background: var(--red-dark);
    color: #fff;
    padding: 13px 20px;
    border-left: 5px solid #fff;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
    z-index: 3000;
    display: none;
}

.toast.show {
    display: block;
}

.editor-toolbar {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        height: auto;
    }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .kpi-grid, .form-grid {
        grid-template-columns: 1fr;
    }
    .main-area {
        padding: 18px 14px 40px;
    }
}
