/* =====================================================
   PREMIORAPLUS — Admin Panel Styles
   ===================================================== */

:root {
  --cream:       #F7F3EC;
  --cream-dark:  #EFE8D8;
  --cognac:      #8B5E3C;
  --cognac-dark: #6B4423;
  --gold:        #C9A227;
  --gold-light:  #D4B96A;
  --dark:        #1C1008;
  --brown:       #3D2010;
  --text:        #2C1810;
  --text-muted:  #7A5A42;
  --border:      #D9C9B0;
  --white:       #FDFAF5;
  --sidebar-bg:  #2A1508;
  --sidebar-w:   240px;
  --success:     #4a7c59;
  --success-bg:  #edf7f0;
  --error:       #8b2020;
  --error-bg:    #fdf0f0;
  --warning:     #7a5a10;
  --warning-bg:  #fdf8e8;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  background: #f0ebe0;
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Sidebar ── */
.admin-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.3s ease;
}
.sidebar-brand {
  padding: 24px 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .brand-name {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cream);
}
.sidebar-brand .brand-sub {
  font-size: 0.68rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-top: 3px;
  display: block;
}
.sidebar-nav { padding: 16px 0; flex: 1; }
.sidebar-nav-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(247,243,236,0.35);
  padding: 12px 22px 6px;
  display: block;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 22px;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(247,243,236,0.65);
  transition: all 0.25s;
  border-left: 2px solid transparent;
  letter-spacing: 0.5px;
}
.sidebar-nav a i {
  width: 18px;
  text-align: center;
  font-size: 0.88rem;
  opacity: 0.75;
}
.sidebar-nav a:hover {
  color: var(--cream);
  background: rgba(247,243,236,0.06);
  border-left-color: rgba(201,162,39,0.5);
}
.sidebar-nav a.active {
  color: var(--gold-light);
  background: rgba(201,162,39,0.1);
  border-left-color: var(--gold);
}
.sidebar-nav a.active i { opacity: 1; }
.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.8rem; color: rgba(247,243,236,0.45);
  padding: 8px 0; transition: color 0.25s;
}
.sidebar-footer a:hover { color: rgba(247,243,236,0.8); }

/* ── Main Layout ── */
.admin-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0; z-index: 100;
}
.topbar-title {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--brown);
}
.topbar-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  font-size: 0.76rem; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  border: none; cursor: pointer; transition: all 0.25s;
  text-decoration: none;
}
.topbar-btn-primary { background: var(--cognac); color: #fff; }
.topbar-btn-primary:hover { background: var(--cognac-dark); }
.topbar-btn-outline { background: transparent; color: var(--cognac); border: 1px solid var(--cognac); }
.topbar-btn-outline:hover { background: var(--cognac); color: #fff; }

.admin-content { padding: 32px; flex: 1; }

/* ── Alert / Flash ── */
.alert {
  padding: 13px 18px;
  font-size: 0.86rem;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 10px;
  border-left: 3px solid;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-error   { background: var(--error-bg);   color: var(--error);   border-color: var(--error); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }

/* ── Cards / Stats ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  padding: 24px 22px;
  display: flex; align-items: center; gap: 16px;
}
.stat-card-icon {
  width: 48px; height: 48px;
  background: var(--cream-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: var(--cognac); flex-shrink: 0;
}
.stat-card-val {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--brown);
  line-height: 1;
  margin-bottom: 3px;
}
.stat-card-lbl { font-size: 0.72rem; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }

/* ── Panel / Box ── */
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  margin-bottom: 28px;
}
.panel-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.panel-head h2 {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: 1.05rem; font-weight: 600;
  color: var(--brown);
}
.panel-body { padding: 22px; }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.data-table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--cream);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--cream); }
.data-table .thumb {
  width: 52px; height: 42px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.data-table .thumb-ph {
  width: 52px; height: 42px;
  background: var(--cream-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--gold-light);
  border: 1px solid var(--border);
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.badge-active   { background: #edf7f0; color: #2d6a2d; }
.badge-inactive { background: #f5f0ea; color: var(--text-muted); }
.badge-gold     { background: #fdf8e0; color: #7a5a10; }
.tbl-actions { display: flex; gap: 8px; align-items: center; }
.tbl-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  border: 1px solid; cursor: pointer; transition: all 0.2s;
  text-decoration: none; background: transparent;
}
.tbl-btn-edit   { color: var(--cognac); border-color: var(--cognac); }
.tbl-btn-edit:hover   { background: var(--cognac); color: #fff; }
.tbl-btn-delete { color: var(--error); border-color: #d97979; }
.tbl-btn-delete:hover { background: var(--error); color: #fff; }
.tbl-empty { text-align: center; padding: 48px 20px; color: var(--text-muted); font-size: 0.9rem; }

/* ── Forms ── */
.form-section { margin-bottom: 36px; }
.form-section-title {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: 1rem; font-weight: 600;
  color: var(--brown);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.form-section-title i { color: var(--cognac); font-size: 0.9rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.fg {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 18px;
}
.fg label {
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-muted);
}
.fg input,
.fg textarea,
.fg select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--cream);
  font-family: inherit; font-size: 0.88rem;
  color: var(--text); outline: none;
  transition: border-color 0.25s, background 0.25s;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
.fg input:focus,
.fg textarea:focus,
.fg select:focus { border-color: var(--cognac); background: var(--white); }
.fg textarea { resize: vertical; min-height: 120px; }
.fg .hint { font-size: 0.75rem; color: var(--text-muted); }
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative; width: 44px; height: 24px;
  display: inline-block;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  cursor: pointer;
  transition: background 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  transition: transform 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--cognac); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Image Upload ── */
.img-upload-area {
  border: 2px dashed var(--border);
  background: var(--cream);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}
.img-upload-area:hover,
.img-upload-area.dragover {
  border-color: var(--cognac);
  background: var(--cream-dark);
}
.img-upload-area input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.img-upload-icon { font-size: 2rem; color: var(--gold); margin-bottom: 10px; }
.img-upload-text { font-size: 0.85rem; color: var(--text-muted); }
.img-upload-text strong { color: var(--cognac); }
.img-upload-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }
.img-previews {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 16px;
}
.img-preview-item {
  position: relative; width: 100px; height: 80px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--cream-dark);
}
.img-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(28,16,8,0.75);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; border-radius: 0;
  transition: background 0.2s;
}
.img-preview-remove:hover { background: var(--error); }
.img-preview-primary {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(201,162,39,0.85);
  color: var(--dark);
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 1px; text-align: center;
  padding: 2px 0;
  text-transform: uppercase;
}

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; margin-top: 16px; }
.page-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--white);
  cursor: pointer; color: var(--text); transition: all 0.2s;
  text-decoration: none;
}
.page-btn:hover, .page-btn.active { background: var(--cognac); color: #fff; border-color: var(--cognac); }

/* ── Password change ── */
.pw-section { max-width: 440px; }

/* ── Login Page ── */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--cognac-dark) 0%, #3a1c08 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-box {
  background: var(--white);
  width: 100%; max-width: 400px;
  padding: 48px 44px;
}
.login-brand {
  text-align: center;
  margin-bottom: 36px;
}
.login-brand .brand-name {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-size: 1.8rem; font-weight: 500;
  letter-spacing: 3px; text-transform: uppercase;
  color: var(--brown); display: block;
}
.login-brand .brand-sub {
  font-size: 0.7rem; letter-spacing: 3px;
  text-transform: uppercase; color: var(--gold);
  margin-top: 5px; display: block;
}
.login-divider {
  display: flex; align-items: center;
  justify-content: center; gap: 12px;
  margin: 20px 0 28px;
}
.login-divider::before,
.login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-divider span { font-size: 0.65rem; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); }
.login-box .fg { margin-bottom: 20px; }
.login-box .fg label { font-size: 0.68rem; }
.login-box .fg input { padding: 12px 14px; font-size: 0.9rem; }
.login-submit {
  width: 100%;
  padding: 13px;
  background: var(--cognac);
  color: #fff; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.82rem;
  font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase;
  transition: background 0.3s;
  margin-top: 8px;
}
.login-submit:hover { background: var(--cognac-dark); }
.login-note { font-size: 0.78rem; color: var(--text-muted); text-align: center; margin-top: 20px; }
.login-note span { color: var(--cognac); font-weight: 600; }
.login-back { display: flex; justify-content: center; margin-top: 20px; }
.login-back a { font-size: 0.78rem; color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.login-back a:hover { color: var(--cognac); }

/* ── Confirm Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(28,16,8,0.6);
  z-index: 9000;
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--white);
  padding: 36px 32px;
  max-width: 380px; width: 100%;
  text-align: center;
}
.modal-icon { font-size: 2.2rem; color: var(--error); margin-bottom: 14px; }
.modal-box h3 { font-size: 1.2rem; margin-bottom: 10px; }
.modal-box p { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.modal-btn { padding: 10px 24px; font-size: 0.8rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; cursor: pointer; border: 1px solid; transition: all 0.25s; }
.modal-btn-cancel { background: transparent; color: var(--text-muted); border-color: var(--border); }
.modal-btn-cancel:hover { background: var(--cream); }
.modal-btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.modal-btn-danger:hover { background: #6b1515; }

/* ── Contacts table ── */
.contact-row-unread td { font-weight: 600; }
.contact-msg-preview { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Tab Sections ── */
.settings-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 28px; }
.stab {
  padding: 11px 20px;
  font-size: 0.76rem; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  cursor: pointer; color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.25s;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.stab:hover { color: var(--cognac); }
.stab.active { color: var(--cognac); border-bottom-color: var(--cognac); }
.stab-content { display: none; }
.stab-content.active { display: block; }

/* ── Logo Preview ── */
.logo-preview-wrap { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.logo-preview-box {
  width: 160px; height: 70px;
  background: var(--cream-dark);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.logo-preview-box img { max-width: 140px; max-height: 60px; object-fit: contain; }
.logo-preview-box .no-logo { font-size: 0.75rem; color: var(--text-muted); letter-spacing: 1px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-topbar { padding: 0 18px; }
  .admin-content { padding: 20px 18px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .sidebar-toggle-btn {
    display: flex;
    align-items: center; justify-content: center;
    width: 38px; height: 38px;
    background: none; border: 1px solid var(--border);
    color: var(--cognac); cursor: pointer; font-size: 1rem;
  }
}
@media (min-width: 901px) {
  .sidebar-toggle-btn { display: none; }
}
