/* ══ ADMIN CSS ══════════════════════════════════════════════════════════════ */
:root {
  --orange: #E8741A; --orange-l: #F0A030; --orange-d: #C45E10;
  --dark: #0D0D0B; --dark-2: #131310; --dark-3: #1A1A14; --dark-4: #222218;
  --cream: #F5F0E6; --muted: #7A7870; --muted-l: #9A9488;
  --green: #22C55E; --red: #EF4444; --blue: #3B82F6; --yellow: #F59E0B;
  --bg: #F0ECE4; --surface: #FFFFFF; --border: #E8E0D4;
  --text: #1A1410; --text-2: #5A5040;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Nunito', sans-serif; background: var(--bg); color: var(--text); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--orange-l); border-radius: 3px; }
input, select, textarea, button { font-family: 'Nunito', sans-serif; }

/* ══ LOGIN ══════════════════════════════════════════════════════════════════ */
#loginScreen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--dark); padding: 20px;
  background-image: radial-gradient(circle at 20% 50%, rgba(232,116,26,0.08) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(59,200,212,0.05) 0%, transparent 40%);
}
.login-box {
  background: var(--dark-2); border: 1px solid rgba(232,116,26,0.2);
  border-radius: 20px; padding: 48px 40px; max-width: 400px; width: 100%;
  text-align: center; box-shadow: 0 40px 80px rgba(0,0,0,0.6);
}
.login-logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(232,116,26,0.4); margin-bottom: 20px; }
.login-box h1 { font-family: 'Cormorant Garamond', serif; font-size: 2rem; color: var(--cream); font-weight: 700; }
.login-sub { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: #3BC8D4; margin-top: 6px; margin-bottom: 28px; font-weight: 700; }
.field { text-align: left; margin-bottom: 16px; }
.field label { display: block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange-l); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--dark); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; padding: 12px 16px; color: var(--cream);
  font-size: 0.95rem; outline: none; transition: border 0.2s; color-scheme: dark;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--orange); }
.btn-primary {
  width: 100%; background: linear-gradient(135deg, var(--orange-l), var(--orange));
  color: #fff; border: none; border-radius: 8px; padding: 14px;
  font-size: 0.95rem; font-weight: 800; cursor: pointer; letter-spacing: 0.04em;
  transition: opacity 0.2s, transform 0.2s; margin-top: 4px;
  box-shadow: 0 4px 20px rgba(232,116,26,0.4);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.back-link { display: block; margin-top: 18px; color: var(--muted); font-size: 0.82rem; transition: color 0.2s; }
.back-link:hover { color: var(--cream); }
.err-box { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #FCA5A5; border-radius: 8px; padding: 10px 14px; font-size: 0.85rem; font-weight: 700; margin-bottom: 16px; text-align: left; }

/* ══ SHELL ══════════════════════════════════════════════════════════════════ */
#adminShell { display: flex; height: 100vh; overflow: hidden; }

/* ══ SIDEBAR ════════════════════════════════════════════════════════════════ */
#sidebar { width: 252px; background: var(--dark-2); display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid rgba(255,255,255,0.06); overflow-y: auto; }
.sidebar-logo { padding: 22px 20px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.sidebar-logo img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(232,116,26,0.35); flex-shrink: 0; }
.sidebar-logo h2 { font-family: 'Cormorant Garamond', serif; color: var(--cream); font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.sidebar-logo span { font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase; color: #3BC8D4; font-weight: 700; }
#sidebarNav { flex: 1; padding: 12px 0; }
.nav-group { padding: 0 12px 4px; }
.nav-group-label { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.25); padding: 12px 8px 6px; display: block; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: none; background: none; cursor: pointer;
  color: rgba(255,255,255,0.55); font-size: 0.85rem; font-weight: 700;
  border-radius: 8px; text-align: left; transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-btn:hover { background: rgba(255,255,255,0.06); color: var(--cream); }
.nav-btn.active { background: rgba(240,160,48,0.1); color: var(--orange-l); border-left-color: var(--orange-l); }
.nav-btn .nav-icon { font-size: 1rem; flex-shrink: 0; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.07); }
.sidebar-user { font-size: 0.78rem; color: rgba(255,255,255,0.45); margin-bottom: 10px; padding: 0 4px; }
.sidebar-user strong { color: rgba(255,255,255,0.75); display: block; font-size: 0.85rem; }
.logout-btn, .view-site-btn {
  display: block; width: 100%; padding: 9px 12px; border-radius: 8px;
  font-size: 0.82rem; font-weight: 700; cursor: pointer; text-align: center;
  transition: all 0.15s; margin-bottom: 6px; text-decoration: none;
}
.logout-btn { background: rgba(239,68,68,0.1); color: #FCA5A5; border: 1px solid rgba(239,68,68,0.2); }
.logout-btn:hover { background: rgba(239,68,68,0.2); }
.view-site-btn { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.1); }
.view-site-btn:hover { background: rgba(255,255,255,0.1); color: var(--cream); }

/* ══ MAIN ═══════════════════════════════════════════════════════════════════ */
#adminMain { flex: 1; overflow-y: auto; background: var(--bg); }
#adminContent { padding: 32px; max-width: 1200px; }

/* ══ PAGE ELEMENTS ══════════════════════════════════════════════════════════ */
.page-title { font-family: 'Cormorant Garamond', serif; font-size: 1.8rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.page-sub { font-size: 0.85rem; color: var(--text-2); margin-bottom: 28px; }
.saved-toast { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; border-radius: 8px; padding: 10px 16px; font-size: 0.85rem; font-weight: 800; margin-bottom: 16px; display: none; }
.saved-toast.show { display: block; }

/* ══ STAT CARDS ═════════════════════════════════════════════════════════════ */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border-radius: 14px; padding: 22px; border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.stat-card .num { font-family: 'Cormorant Garamond', serif; font-size: 2.2rem; font-weight: 700; line-height: 1; }
.stat-card .lbl { font-size: 0.78rem; color: var(--text-2); margin-top: 5px; font-weight: 600; }
.stat-card .sub { font-size: 0.72rem; font-weight: 800; margin-top: 8px; }

/* ══ CARDS ══════════════════════════════════════════════════════════════════ */
.card { background: var(--surface); border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,0.04); margin-bottom: 22px; overflow: hidden; }
.card-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.card-head h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.25rem; font-weight: 700; }
.card-body { padding: 22px; }

/* ══ BUTTONS ════════════════════════════════════════════════════════════════ */
.btn-save { background: #166534; color: #fff; border: none; border-radius: 8px; padding: 10px 22px; font-weight: 800; font-size: 0.85rem; cursor: pointer; transition: opacity 0.2s; }
.btn-save:hover { opacity: 0.85; }
.btn-add { background: rgba(34,197,94,0.1); color: #166534; border: 1px solid rgba(34,197,94,0.3); border-radius: 8px; padding: 8px 16px; font-size: 0.8rem; font-weight: 800; cursor: pointer; transition: all 0.15s; }
.btn-add:hover { background: rgba(34,197,94,0.2); }
.btn-del { background: rgba(239,68,68,0.1); color: #EF4444; border: 1px solid rgba(239,68,68,0.2); border-radius: 6px; padding: 6px 12px; font-size: 0.75rem; font-weight: 800; cursor: pointer; transition: all 0.15s; }
.btn-del:hover { background: rgba(239,68,68,0.2); }
.btn-edit { background: rgba(245,158,11,0.1); color: #B45309; border: 1px solid rgba(245,158,11,0.25); border-radius: 6px; padding: 6px 12px; font-size: 0.75rem; font-weight: 800; cursor: pointer; transition: all 0.15s; }
.btn-edit:hover { background: rgba(245,158,11,0.2); }
.btn-confirm { background: rgba(34,197,94,0.1); color: #166534; border: 1px solid rgba(34,197,94,0.25); border-radius: 6px; padding: 6px 12px; font-size: 0.75rem; font-weight: 800; cursor: pointer; transition: all 0.15s; }
.btn-confirm:hover { background: rgba(34,197,94,0.2); }
.btn-sm { padding: 7px 14px; border-radius: 6px; font-size: 0.78rem; font-weight: 800; cursor: pointer; border: none; background: linear-gradient(135deg,var(--orange-l),var(--orange)); color: #fff; transition: opacity 0.2s; }
.btn-sm:hover { opacity: 0.85; }

/* ══ FORM FIELDS ════════════════════════════════════════════════════════════ */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange); margin-bottom: 6px; }
.field input[type=text],
.field input[type=email],
.field input[type=tel],
.field input[type=number],
.field input[type=url],
.field input[type=date],
.field input[type=password],
.field select,
.field textarea {
  width: 100%; background: #FDFAF4; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 10px 14px; color: var(--text);
  font-size: 0.9rem; outline: none; transition: border 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--orange); }
.field textarea { resize: vertical; min-height: 80px; }
.field .helper { font-size: 0.72rem; color: var(--text-2); margin-top: 4px; }
.toggle-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #D1C9C0; border-radius: 24px; cursor: pointer; transition: background 0.25s; }
.toggle-slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.25s; }
.toggle input:checked + .toggle-slider { background: var(--orange); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.img-preview { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; border: 1.5px solid var(--border); margin-top: 8px; display: none; }
.img-preview.show { display: block; }

/* ══ TABLE ══════════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; padding: 11px 16px; background: #F5F0E6; color: var(--text-2); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #FDF9F0; }
.td-name { font-weight: 800; }
.td-sub { font-size: 0.75rem; color: var(--text-2); margin-top: 2px; }
.action-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ══ BADGES ═════════════════════════════════════════════════════════════════ */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.badge-confirmed { background: #DCFCE7; color: #166534; }
.badge-pending   { background: #FEF9C3; color: #854D0E; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }
.badge-paid      { background: #DCFCE7; color: #166534; }
.badge-unpaid    { background: #FEE2E2; color: #991B1B; }
.badge-admin     { background: rgba(232,116,26,0.12); color: #92400E; }
.badge-manager   { background: rgba(34,197,94,0.1); color: #166534; }
.badge-staff     { background: rgba(59,130,246,0.1); color: #1E40AF; }
.badge-viewer    { background: rgba(107,114,128,0.12); color: #374151; }
.badge-active    { background: #DCFCE7; color: #166534; }
.badge-inactive  { background: #F3F4F6; color: #6B7280; }

/* ══ GALLERY MANAGER ════════════════════════════════════════════════════════ */
.gallery-grid-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; margin-bottom: 16px; }
.gallery-thumb { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; border: 2px solid var(--border); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb-del { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.7); color: #fff; border: none; border-radius: 50%; width: 26px; height: 26px; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.gallery-thumb-del:hover { background: var(--red); }
.gallery-thumb-cap { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.6); color: #fff; font-size: 0.68rem; font-weight: 700; padding: 4px 8px; text-align: center; }
.add-photo-btn { border: 2px dashed rgba(232,116,26,0.4); border-radius: 10px; aspect-ratio: 4/3; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; background: rgba(232,116,26,0.04); color: var(--orange); font-size: 0.8rem; font-weight: 800; gap: 6px; transition: all 0.2s; }
.add-photo-btn:hover { background: rgba(232,116,26,0.1); border-color: var(--orange); }

/* ══ ROOM MANAGER ═══════════════════════════════════════════════════════════ */
.room-row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.room-row:last-child { border-bottom: none; }
.room-thumb { width: 72px; height: 52px; object-fit: cover; border-radius: 8px; flex-shrink: 0; border: 1.5px solid var(--border); }
.room-row-info { flex: 1; }
.room-row-info strong { font-size: 0.92rem; font-weight: 800; display: block; }
.room-row-info span { font-size: 0.75rem; color: var(--text-2); }
.room-row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.price-inp { width: 90px; padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 0.85rem; font-family: 'Nunito',sans-serif; background: #FDFAF4; }

/* ══ FEATURE EDITOR ═════════════════════════════════════════════════════════ */
.feat-item { border: 1.5px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 12px; position: relative; background: #FDFAF4; }
.feat-del-btn { position: absolute; top: 12px; right: 12px; }
.testi-item { border: 1.5px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 12px; background: #FDFAF4; position: relative; }

/* ══ SECTION BUILDER ════════════════════════════════════════════════════════ */
.section-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px; margin-bottom: 20px; }
.section-type-btn { border: 2px solid var(--border); border-radius: 12px; padding: 18px 16px; cursor: pointer; text-align: center; background: #FDFAF4; transition: all 0.2s; }
.section-type-btn:hover, .section-type-btn.selected { border-color: var(--orange); background: rgba(232,116,26,0.06); }
.section-type-btn .icon { font-size: 1.8rem; display: block; margin-bottom: 8px; }
.section-type-btn .name { font-size: 0.8rem; font-weight: 800; color: var(--text); }
.section-type-btn .desc { font-size: 0.7rem; color: var(--text-2); margin-top: 4px; }
.cs-item { border: 1.5px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 12px; background: #FDFAF4; display: flex; align-items: center; gap: 14px; }
.cs-item-info { flex: 1; }
.cs-item-info strong { font-size: 0.9rem; font-weight: 800; display: block; }
.cs-item-info span { font-size: 0.75rem; color: var(--text-2); }

/* ══ ACCESS DENIED ══════════════════════════════════════════════════════════ */
.access-denied { text-align: center; padding: 80px 20px; color: var(--text-2); }
.access-denied .icon { font-size: 3rem; display: block; margin-bottom: 16px; }

/* ══ SECTION VISIBILITY ═════════════════════════════════════════════════════ */
.vis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px; }
.vis-card { background: #FDFAF4; border: 1.5px solid var(--border); border-radius: 10px; padding: 16px; display: flex; align-items: center; justify-content: space-between; }
.vis-card strong { font-size: 0.85rem; font-weight: 800; }

/* ══ RESPONSIVE ═════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  #sidebar { width: 200px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  #adminShell { flex-direction: column; }
  #sidebar { width: 100%; height: auto; max-height: 220px; }
  #adminContent { padding: 20px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
