/* =========================================================
   Admin Panel — extends css/style.css variables & fonts
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&display=swap');

.admin-body { background: var(--cream-alt); min-height: 100vh; }

/* ---------- Shell / Sidebar ---------- */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--maroon-darker), var(--maroon-dark));
    color: var(--cream);
    display: flex;
    flex-direction: column;
    padding: 1.6rem 1.2rem;
    position: sticky;
    top: 0;
    height: 100vh;
}
.admin-brand { display: flex; gap: 1rem; align-items: center; margin-bottom: 2.2rem; padding: 0 0.3rem; }
.admin-brand .brand-mark { width: 96px; height: 96px; font-size: 2rem; }
.admin-brand-logo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35);
}
.admin-brand-name {
    font-family: 'Cinzel', 'Playfair Display', serif;
    font-weight: 700;
    color: var(--gold-light);
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.3;
}
.admin-brand-sub { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(251,246,236,0.5); }

.admin-nav { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.admin-nav a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    color: rgba(251,246,236,0.75);
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
}
.admin-nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.admin-nav a.active { background: linear-gradient(135deg, var(--gold-light), var(--gold-deep)); color: var(--maroon-darker); font-weight: 600; }

.admin-sidebar-foot { display: flex; flex-direction: column; gap: 0.6rem; padding-top: 1.2rem; margin-top: 1rem; border-top: 1px solid rgba(255,255,255,0.1); }
.admin-sidebar-foot a { font-size: 0.85rem; color: rgba(251,246,236,0.6); }
.admin-sidebar-foot a:hover { color: var(--gold-light); }

/* ---------- Main area ---------- */
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 1.3rem 2rem;
    background: var(--white);
    border-bottom: 1px solid rgba(107,15,26,0.08);
    position: sticky;
    top: 0;
    z-index: 10;
}
.admin-topbar h1 { font-size: 1.55rem; }
.admin-user { font-size: 0.85rem; color: var(--text-muted); }
.admin-content { padding: 2rem; flex: 1; }

/* ---------- Footer ---------- */
.admin-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 1.2rem 2rem;
    border-top: 1px solid rgba(107,15,26,0.08);
    background: var(--white);
    font-size: 0.82rem;
    color: var(--text-muted);
}
.admin-footer a { color: var(--maroon); font-weight: 500; }
.admin-footer a:hover { color: var(--gold-deep); }

/* ---------- Flash messages ---------- */
.admin-flash { padding: 0.9rem 1.2rem; border-radius: 10px; margin-bottom: 1.5rem; font-size: 0.9rem; font-weight: 500; }
.admin-flash-success { background: rgba(201,162,39,0.12); border: 1px solid rgba(201,162,39,0.4); color: var(--gold-deep); }
.admin-flash-error { background: rgba(178,34,34,0.08); border: 1px solid rgba(178,34,34,0.3); color: #b22222; }

/* ---------- Dashboard stats ---------- */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.3rem; margin-bottom: 2.2rem; }
.admin-stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(107,15,26,0.06);
    display: flex;
    align-items: center;
    gap: 1.1rem;
    transition: var(--transition);
}
.admin-stat-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(107,15,26,0.14); border-color: rgba(201, 169, 110,0.35); }
.admin-stat-card .icon-circle { width: 52px; height: 52px; }
.admin-stat-value { font-family: 'Playfair Display', serif; font-size: 1.9rem; color: var(--maroon-dark); line-height: 1; }
.admin-stat-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.3rem; }

.admin-panel-title { font-size: 1.1rem; margin-bottom: 1rem; }

/* ---------- Table card ---------- */
.admin-table-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(107,15,26,0.06); overflow: hidden; margin-bottom: 2rem; }
.admin-table-head { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 1.5rem; border-bottom: 1px solid rgba(107,15,26,0.08); flex-wrap: wrap; gap: 0.8rem; }
.admin-table-head h2 { font-size: 1.05rem; }

.admin-table-scroll { overflow-x: auto; }
table.admin-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.admin-table th, .admin-table td { text-align: left; padding: 0.9rem 1.5rem; font-size: 0.88rem; border-bottom: 1px solid rgba(107,15,26,0.06); vertical-align: middle; }
.admin-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); background: var(--cream-alt); font-weight: 600; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background-color 0.2s ease; }
.admin-table tbody tr:hover { background-color: rgba(201, 169, 110, 0.08); }

.admin-thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: var(--cream-alt); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.admin-thumb svg { width: 55%; height: 55%; stroke: var(--maroon-dark); fill: none; stroke-width: 1.5; }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.admin-table tbody tr:hover .admin-thumb img { transform: scale(1.12); }

.admin-badge { display: inline-block; padding: 0.25rem 0.7rem; border-radius: 9999px; font-size: 0.72rem; font-weight: 600; background: var(--gold-pale); color: var(--gold-deep); white-space: nowrap; }
.admin-badge-muted { background: rgba(107,15,26,0.06); color: var(--text-muted); }

.admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.admin-actions a, .admin-actions button {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(107,15,26,0.15);
    background: var(--white);
    color: var(--maroon);
    cursor: pointer;
    transition: var(--transition);
}
.admin-actions a:hover, .admin-actions button:hover { background: var(--maroon); color: var(--cream); border-color: var(--maroon); }
.admin-actions .danger { color: #b22222; border-color: rgba(178,34,34,0.25); }
.admin-actions .danger:hover { background: #b22222; color: #fff; border-color: #b22222; }

.admin-empty { padding: 3rem 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Forms ---------- */
.admin-form-card { background: var(--white); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); border: 1px solid rgba(107,15,26,0.06); max-width: 760px; }
.image-preview {
    width: 150px; height: 150px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--cream-alt);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
    border: 1px dashed rgba(107,15,26,0.25);
    overflow: hidden;
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview svg { width: 40%; height: 40%; stroke: rgba(107,15,26,0.35); fill: none; stroke-width: 1.4; }
.form-help { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.4rem; }
.form-actions { display: flex; gap: 0.8rem; margin-top: 1.6rem; }

/* ---------- Rates page ---------- */
.rates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.rate-amount-field { display: flex; align-items: center; gap: 0.4rem; }
.rate-amount-field span:first-child { color: var(--text-muted); font-weight: 600; }
.rate-amount-field input {
    width: 110px;
    padding: 0.5rem 0.6rem;
    border: 1px solid rgba(107,15,26,0.15);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
}
.rate-amount-field input:focus { outline: none; border-color: var(--gold-deep); }
.form-help-inline { color: var(--text-muted); font-size: 0.8rem; }

/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-slider { position: absolute; inset: 0; background: rgba(107,15,26,0.15); border-radius: 9999px; transition: var(--transition); pointer-events: none; }
.switch-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.switch input:checked + .switch-slider { background: linear-gradient(135deg, var(--gold-light), var(--gold-deep)); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

@media (max-width: 900px) {
    .rates-grid { grid-template-columns: 1fr; }
}

/* ---------- Auth (login) page ---------- */
.admin-auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(155deg, var(--maroon-darker) 0%, var(--maroon-dark) 55%, var(--maroon) 100%);
    padding: 2rem;
}
.auth-card { background: var(--white); border-radius: 20px; padding: 2.6rem; width: 100%; max-width: 400px; box-shadow: 0 30px 70px rgba(0,0,0,0.35); }
.auth-brand { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 1.8rem; }
.auth-brand-name { font-family: 'Playfair Display', serif; font-weight: 700; color: var(--maroon-dark); }
.auth-brand-sub { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold-deep); }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.3rem; }
.auth-sub { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.5rem; }
.auth-alert { background: rgba(178,34,34,0.08); border: 1px solid rgba(178,34,34,0.3); color: #b22222; padding: 0.8rem 1rem; border-radius: 10px; font-size: 0.85rem; margin-bottom: 1.2rem; }
.auth-back { display: block; text-align: center; margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-muted); }
.auth-back:hover { color: var(--maroon); }

.password-field { position: relative; }
.password-field input { padding-right: 2.6rem; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.3rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.5rem;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
}
.password-toggle svg { width: 18px; height: 18px; }
.password-toggle:hover { color: var(--maroon); }
.password-toggle.is-visible { color: var(--gold-deep); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 1rem 1.2rem; gap: 1.5rem; }
    .admin-brand { margin-bottom: 0; }
    .admin-nav { flex-direction: row; overflow-x: auto; flex: 1; }
    .admin-nav a { white-space: nowrap; }
    .admin-sidebar-foot { flex-direction: row; margin-top: 0; padding-top: 0; border-top: none; }
}
@media (max-width: 640px) {
    .admin-content { padding: 1.2rem; }
    .admin-topbar { padding: 1rem 1.2rem; }
    .admin-topbar h1 { font-size: 1.25rem; }
    table.admin-table { min-width: 560px; }
    .admin-sidebar { flex-wrap: wrap; row-gap: 0.6rem; padding: 0.9rem 1rem; }
    .admin-brand { gap: 0.7rem; }
    .admin-brand .brand-mark,
    .admin-brand-logo { width: 52px; height: 52px; font-size: 1.2rem; }
    .admin-nav { order: 3; width: 100%; overflow-x: auto; }
    .admin-sidebar-foot { margin-left: auto; gap: 1rem; }
    .admin-form-card, .auth-card { padding: 1.5rem; }
    .admin-auth-body { padding: 1rem; }
}
