/* ============================================================
   admin.css — Admin Panel Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --navy:        #0d1b2a;
  --navy-light:  #162234;
  --navy-mid:    #1e3a5f;
  --amber:       #e8a020;
  --amber-light: #f5c052;
  --cream:       #faf7f2;
  --text:        #1a1a2e;
  --text-muted:  #6b7280;
  --text-light:  #9ca3af;
  --white:       #ffffff;
  --red:         #dc2626;
  --red-light:   #fef2f2;
  --green:       #16a34a;
  --green-light: #f0fdf4;
  --blue:        #2563eb;
  --blue-light:  #eff6ff;
  --border:      #e5e0d8;
  --bg:          #f4f1ec;
  --sidebar-w:   260px;
  --header-h:    64px;
  --shadow-sm:   0 1px 3px rgba(13,27,42,0.08);
  --shadow-md:   0 4px 16px rgba(13,27,42,0.12);
  --radius:      10px;
  --radius-sm:   6px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:   'DM Sans', sans-serif;
  --font-mono:   'DM Mono', monospace;
  --transition:  0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a  { color: inherit; text-decoration: none; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr;
}

.login-left {
  background: var(--navy);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 3rem; position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 80% at 30% 50%, rgba(232,160,32,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 60% at 80% 80%, rgba(30,58,95,0.6) 0%, transparent 60%);
}
.login-left-grid {
  position: absolute; inset: 0; opacity: 0.04;
  background-image: linear-gradient(var(--white) 1px, transparent 1px), linear-gradient(90deg, var(--white) 1px, transparent 1px);
  background-size: 32px 32px;
}
.login-brand { position: relative; z-index: 1; text-align: center; }
.login-brand-icon {
  width: 72px; height: 72px; border-radius: 16px;
  background: var(--amber); margin: 0 auto 1.5rem;
  display: flex; align-items: center; justify-content: center; font-size: 2rem;
  box-shadow: 0 8px 24px rgba(232,160,32,0.3);
}
.login-brand h1 { color: var(--white); font-family: var(--font-display); font-size: 2rem; margin-bottom: 0.5rem; }
.login-brand p  { color: rgba(255,255,255,0.5); font-size: 0.9rem; }

.login-right {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem;
}
.login-card { width: 100%; max-width: 420px; }
.login-card h2 { font-family: var(--font-display); font-size: 1.9rem; margin-bottom: 0.4rem; }
.login-card > p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

.login-card .form-group { margin-bottom: 1.25rem; }
.login-card label {
  display: block; font-size: 0.85rem; font-weight: 600;
  margin-bottom: 0.4rem; color: var(--navy);
}
.login-card .form-control {
  width: 100%; padding: 0.7rem 1rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.9rem;
  background: var(--white); outline: none; transition: var(--transition);
}
.login-card .form-control:focus { border-color: var(--navy-mid); box-shadow: 0 0 0 3px rgba(30,58,95,0.1); }
.login-card .form-control.error { border-color: var(--red); }

.login-btn {
  width: 100%; padding: 0.8rem;
  background: var(--navy); color: var(--white);
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; margin-top: 0.5rem; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover { background: var(--navy-mid); transform: translateY(-1px); }

.login-divider { text-align: center; margin: 1.5rem 0; color: var(--text-light); font-size: 0.8rem; }

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--navy); 
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-icon {
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--amber); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.sidebar-title { color: var(--white); font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.sidebar-sub   { color: rgba(255,255,255,0.4); font-size: 0.7rem; }

.sidebar-nav   { flex: 1; padding: 1.25rem 0; }
.nav-section   { margin-bottom: 1.75rem; }
.nav-section-label {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255,255,255,0.3); padding: 0 1.25rem; margin-bottom: 0.4rem;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0.6rem 1.25rem;
  color: rgba(255,255,255,0.65); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; border-radius: 0;
  transition: var(--transition); position: relative;
}
.nav-item:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.nav-item.active { color: var(--white); background: rgba(255,255,255,0.08); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--amber); border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--red); color: var(--white);
  font-size: 0.7rem; font-weight: 700; padding: 1px 7px; border-radius: 100px;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 0.6rem 0; margin-bottom: 0.5rem;
}
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy-mid); border: 2px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: var(--amber);
  flex-shrink: 0;
}
.sidebar-user-info small { display: block; color: rgba(255,255,255,0.4); font-size: 0.7rem; }
.sidebar-user-info span  { color: rgba(255,255,255,0.8); font-size: 0.82rem; font-weight: 600; }
.logout-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm);
  background: rgba(220,38,38,0.1); border: 1px solid rgba(220,38,38,0.2);
  color: rgba(220,38,38,0.8); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: var(--transition); text-align: left;
}
.logout-btn:hover { background: rgba(220,38,38,0.2); color: #ef4444; }

/* ---- Main Content ---- */
.main-content {
  flex: 1; margin-left: var(--sidebar-w);
  min-height: 100vh; display: flex; flex-direction: column;
}

.admin-header {
  height: var(--header-h); background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.admin-header-left { display: flex; align-items: center; gap: 1rem; }
.admin-header h1   { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.admin-header p    { font-size: 0.82rem; color: var(--text-muted); }
.header-actions    { display: flex; align-items: center; gap: 0.75rem; }

.page-content { flex: 1; padding: 2rem; }

/* ============================================================
   STATS CARDS
   ============================================================ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem; margin-bottom: 2rem; width: 100%;
}
.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-info small { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-info h3    { font-size: 2rem; font-weight: 700; color: var(--navy); font-family: var(--font-mono); line-height: 1.1; margin: 0.25rem 0; }
.stat-info p     { font-size: 0.8rem; color: var(--text-light); margin: 0; }
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.stat-navy   { background: rgba(13,27,42,0.08); color: var(--navy); }
.stat-amber  { background: rgba(232,160,32,0.12); color: var(--amber); }
.stat-green  { background: rgba(22,163,74,0.1);  color: var(--green); }
.stat-red    { background: rgba(220,38,38,0.1);  color: var(--red); }

/* ============================================================
   DATA TABLE
   ============================================================ */
.table-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.table-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap;
}
.table-header h2  { font-size: 1rem; font-weight: 700; color: var(--navy); }
.table-header p   { font-size: 0.82rem; color: var(--text-muted); margin: 0; }
.table-toolbar    { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.search-input-wrap { position: relative; }
.search-input-wrap input {
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.85rem;
  background: var(--bg); outline: none; width: 220px;
  transition: var(--transition);
}
.search-input-wrap input:focus { border-color: var(--navy-mid); background: var(--white); width: 260px; }
.search-icon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-light); font-size: 0.9rem; pointer-events: none;
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 0.875rem 1.25rem;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 1rem 1.25rem; font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }

.td-title  { font-weight: 600; max-width: 280px; }
.td-title a:hover { color: var(--navy-mid); }
.td-thumb  {
  width: 44px; height: 44px; border-radius: 6px;
  object-fit: cover; border: 1px solid var(--border);
}
.td-thumb-placeholder {
  width: 44px; height: 44px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: var(--text-light);
}
.td-date   { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.8rem; white-space: nowrap; }
.td-actions{ display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }

.table-empty { padding: 3rem; text-align: center; color: var(--text-muted); }
.table-empty .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.4; }

/* ============================================================
   BUTTONS (Admin)
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.85rem;
  padding: 0.55rem 1.1rem; border-radius: var(--radius-sm);
  border: 2px solid transparent; cursor: pointer;
  transition: var(--transition); letter-spacing: 0.02em; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary  { background: var(--navy); color: var(--white); border-color: var(--navy); }
.btn-primary:hover  { background: var(--navy-mid); }
.btn-accent   { background: var(--amber); color: var(--navy); border-color: var(--amber); }
.btn-danger   { background: var(--red-light); color: var(--red); border-color: transparent; }
.btn-danger:hover   { background: var(--red); color: var(--white); }
.btn-edit     { background: var(--blue-light); color: var(--blue); border-color: transparent; }
.btn-edit:hover     { background: var(--blue); color: var(--white); }
.btn-success  { background: var(--green-light); color: var(--green); border-color: transparent; }
.btn-success:hover  { background: var(--green); color: var(--white); }
.btn-sm       { padding: 0.38rem 0.8rem; font-size: 0.78rem; }
.btn-outline  { background: transparent; color: var(--navy); border-color: var(--border); }
.btn-outline:hover  { border-color: var(--navy); }

/* ============================================================
   FORMS (Admin)
   ============================================================ */
.form-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow-sm);
}
.form-section-title {
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  border-bottom: 1px solid var(--border); padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}
.form-group  { margin-bottom: 1.25rem; }
.form-label  { display: block; font-size: 0.85rem; font-weight: 600; color: var(--navy); margin-bottom: 0.4rem; }
.form-label .required { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%; padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.9rem; color: var(--text); background: var(--white);
  outline: none; transition: var(--transition);
}
.form-control:focus { border-color: var(--navy-mid); box-shadow: 0 0 0 3px rgba(30,58,95,0.08); }
.form-control.error { border-color: var(--red); }
textarea.form-control { resize: vertical; min-height: 160px; }
.form-error  { font-size: 0.78rem; color: var(--red); margin-top: 0.3rem; display: none; }
.form-error.visible { display: block; }
.form-hint   { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Image upload */
.img-upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 1.5rem; text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--bg);
}
.img-upload-area:hover  { border-color: var(--navy-mid); background: var(--cream); }
.img-upload-area.dragover { border-color: var(--amber); background: rgba(232,160,32,0.05); }
.img-upload-area p { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }
.img-preview {
  max-width: 200px; max-height: 150px; margin: 0.75rem auto 0;
  border-radius: var(--radius-sm); object-fit: cover;
  border: 1px solid var(--border);
}

/* ============================================================
   MODAL (Confirm Delete)
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(13,27,42,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  opacity: 0; visibility: hidden; transition: 0.25s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-box {
  background: var(--white); border-radius: 16px;
  width: 100%; max-width: 420px; padding: 2rem;
  box-shadow: var(--shadow-md);
  transform: scale(0.95); transition: transform 0.25s ease;
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-box-icon { font-size: 2.5rem; text-align: center; margin-bottom: 1rem; }
.modal-box h3   { text-align: center; margin-bottom: 0.5rem; font-size: 1.15rem; }
.modal-box p    { text-align: center; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.modal-actions  { display: flex; gap: 0.75rem; justify-content: center; }
.modal-actions .btn { min-width: 120px; justify-content: center; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 0.875rem 1.25rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500;
  margin-bottom: 1.5rem;
  display: flex; align-items: flex-start; gap: 10px; border: 1px solid;
}
.alert-success { background: var(--green-light); border-color: #bbf7d0; color: #166534; }
.alert-error   { background: var(--red-light);   border-color: #fecaca; color: #991b1b; }
.alert-info    { background: var(--blue-light);  border-color: #bfdbfe; color: #1e40af; }

/* ============================================================
   FEEDBACK TABLE
   ============================================================ */
.feedback-msg {
  max-width: 320px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-muted); font-size: 0.85rem;
}
.unread-row td { background: rgba(232,160,32,0.04); }
.unread-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--amber); margin-right: 6px;
}

/* ============================================================
   BADGE / CHIPS
   ============================================================ */
.chip {
  display: inline-block; padding: 0.2rem 0.7rem;
  border-radius: 100px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
}
.chip-navy  { background: rgba(13,27,42,0.08);  color: var(--navy); }
.chip-amber { background: rgba(232,160,32,0.12); color: #92600a; }
.chip-green { background: rgba(22,163,74,0.1);  color: var(--green); }
.chip-red   { background: rgba(220,38,38,0.08); color: var(--red); }
.chip-blue  { background: rgba(37,99,235,0.08); color: var(--blue); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  /* Prevent ALL horizontal overflow */
  html, body { overflow-x: hidden; max-width: 100%; }

  /* Login */
  .login-page { grid-template-columns: 1fr; }
  .login-left { display: none; }

  /* Sidebar */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }

  /* Main layout — no left margin, no overflow */
  .main-content { margin-left: 0 !important; overflow-x: hidden; width: 100%; }

  /* Header */
  .admin-header { padding: 0 1rem; }
  .admin-header h1 { font-size: 0.95rem; }
  .admin-header p  { font-size: 0.72rem; }
  .header-actions .btn-outline { display: none; }

  /* Page content */
  .page-content { padding: 1rem; width: 100%; box-sizing: border-box; }

  /* ── Stats grid: always 2 equal columns, never overflow ── */
  .stats-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.65rem !important;
    margin-bottom: 1.25rem !important;
    width: 100% !important;
  }
  .stat-card { padding: 0.875rem !important; gap: 0.5rem !important; }
  .stat-info small { font-size: 0.68rem !important; }
  .stat-info h3    { font-size: 1.5rem !important; }
  .stat-info p     { font-size: 0.72rem !important; }
  .stat-icon { width: 34px !important; height: 34px !important; font-size: 0.9rem !important; border-radius: 8px !important; }

  /* ── Quick-action buttons ── */
  .quick-actions {
    flex-direction: column !important;
    gap: 0.5rem !important;
    margin-bottom: 1.25rem !important;
  }
  .quick-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* ── Table card ── */
  .table-card { overflow: hidden; width: 100%; }
  .table-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.6rem !important;
    padding: 0.875rem 1rem !important;
  }
  .table-toolbar {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
  .table-toolbar .btn,
  .table-toolbar select { width: 100% !important; }
  .search-input-wrap { width: 100% !important; }
  .search-input-wrap input { width: 100% !important; }
  .table-toolbar > div { width: 100% !important; }

  /* Data table — hide cols 4+ */
  .data-table th:nth-child(n+4),
  .data-table td:nth-child(n+4) { display: none !important; }
  .data-table th, .data-table td { padding: 0.75rem 0.875rem; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }
  .form-card { padding: 1.25rem; }

  /* Modal */
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; justify-content: center; }
}