/* ============================
   BMG Admin Panel Styles
   ============================ */

:root {
  --a-bg: #f0f3f7;
  --a-sidebar: #062a4a;
  --a-sidebar-deep: #041e36;
  --a-sidebar-text: #b3c0d0;
  --a-sidebar-active: #c0392b;
  --a-card: #fff;
  --a-border: #dfe4ec;
  --a-text: #1a2733;
  --a-text-soft: #4a5a6e;
  --a-muted: #8492a6;
  --a-success: #2e8b57;
  --a-danger: #c0392b;
  --a-warning: #d97706;
  --a-blue: #1e6fb8;
}

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--a-bg);
  color: var(--a-text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--a-blue); text-decoration: none; }
a:hover { color: var(--a-sidebar); }

/* ----------- Login ----------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(4, 30, 54, .92) 0%, rgba(6, 42, 74, .85) 100%),
    radial-gradient(circle at 30% 30%, rgba(74, 144, 194, .3) 0%, transparent 60%);
  background-color: #041e36;
  padding: 24px;
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  padding: 44px 38px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo img { height: 64px; margin: 0 auto 14px; display: block; }
.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--a-sidebar);
  margin: 0 0 4px;
}
.login-logo p {
  font-size: .85rem;
  color: var(--a-muted);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ----------- Layout ----------- */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--a-sidebar);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  padding: 22px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand img { height: 56px; width: auto; background: rgba(255, 255, 255, .96); padding: 6px 8px; border-radius: 8px; object-fit: contain; }
.sidebar-brand div {
  font-family: 'Playfair Display', serif;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
}
.sidebar-brand small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: .7rem;
  color: rgba(255, 255, 255, .6);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}
.sidebar-section {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, .35);
  padding: 16px 24px 8px;
  font-weight: 600;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: var(--a-sidebar-text);
  font-size: .92rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.sidebar-nav a:hover {
  background: rgba(255, 255, 255, .04);
  color: #fff;
}
.sidebar-nav a.active {
  background: rgba(192, 57, 43, .15);
  border-left-color: var(--a-sidebar-active);
  color: #fff;
}
.sidebar-nav .icon {
  width: 18px;
  text-align: center;
  font-size: 1rem;
  opacity: .85;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-footer form { margin: 0; }
.sidebar-footer button {
  background: rgba(255, 255, 255, .06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .12);
  padding: 9px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
  width: 100%;
  transition: all .2s;
}
.sidebar-footer button:hover {
  background: var(--a-sidebar-active);
  border-color: var(--a-sidebar-active);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--a-border);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--a-sidebar);
  margin: 0;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar a { color: var(--a-text-soft); font-size: .88rem; }
.topbar a:hover { color: var(--a-sidebar); }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  background: var(--a-bg);
  border-radius: 30px;
  font-size: .85rem;
  color: var(--a-text-soft);
}
.user-chip .avatar {
  width: 28px; height: 28px;
  background: var(--a-sidebar);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .8rem;
}

.content {
  padding: 28px 32px;
  flex: 1;
}

/* ----------- Cards / Stats ----------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--a-card);
  border: 1px solid var(--a-border);
  border-radius: 8px;
  padding: 22px 22px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--a-blue);
}
.stat-card.danger::before { background: var(--a-danger); }
.stat-card.success::before { background: var(--a-success); }
.stat-card.warning::before { background: var(--a-warning); }
.stat-card .label {
  font-size: .76rem;
  color: var(--a-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}
.stat-card .value {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--a-sidebar);
  line-height: 1.1;
}
.stat-card .meta {
  font-size: .8rem;
  color: var(--a-muted);
  margin-top: 4px;
}

.card {
  background: var(--a-card);
  border: 1px solid var(--a-border);
  border-radius: 8px;
  margin-bottom: 22px;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--a-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-header h2 {
  font-family: 'Playfair Display', serif;
  margin: 0;
  font-size: 1.15rem;
  color: var(--a-sidebar);
}
.card-body { padding: 24px; }

/* ----------- Buttons ----------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  line-height: 1;
}
.btn-primary { background: var(--a-blue); color: #fff; border-color: var(--a-blue); }
.btn-primary:hover { background: #155a99; border-color: #155a99; color: #fff; }
.btn-success { background: var(--a-success); color: #fff; border-color: var(--a-success); }
.btn-danger { background: var(--a-danger); color: #fff; border-color: var(--a-danger); }
.btn-danger:hover { background: #a93226; color: #fff; }
.btn-ghost { background: transparent; color: var(--a-text-soft); border-color: var(--a-border); }
.btn-ghost:hover { background: var(--a-bg); color: var(--a-sidebar); }
.btn-sm { padding: 6px 11px; font-size: .78rem; }
.btn-icon {
  padding: 7px 9px;
  background: transparent;
  border: 1px solid var(--a-border);
  color: var(--a-text-soft);
  border-radius: 4px;
}
.btn-icon:hover { background: var(--a-bg); color: var(--a-sidebar); }
.btn-icon.danger:hover { background: #fde8e7; color: var(--a-danger); border-color: var(--a-danger); }

/* ----------- Tables ----------- */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--a-border);
  font-size: .9rem;
  vertical-align: middle;
}
.table th {
  background: var(--a-bg);
  color: var(--a-text-soft);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.table tr:hover { background: rgba(30, 111, 184, .03); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline-block; margin: 0; }
.table .actions .btn-icon { margin-left: 4px; }
.table .thumb {
  width: 50px; height: 50px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  background-color: var(--a-bg);
  border: 1px solid var(--a-border);
  display: inline-block;
}

/* ----------- Forms ----------- */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--a-text);
  font-size: .85rem;
}
.form-group .help {
  display: block;
  margin-top: 5px;
  font-size: .76rem;
  color: var(--a-muted);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--a-border);
  border-radius: 5px;
  font-family: inherit;
  font-size: .92rem;
  background: #fff;
  color: var(--a-text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--a-blue);
  box-shadow: 0 0 0 3px rgba(30, 111, 184, .12);
}
textarea.form-control { min-height: 110px; resize: vertical; line-height: 1.55; }
textarea.form-control.tall { min-height: 220px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--a-bg);
  border-radius: 5px;
  border: 1px solid var(--a-border);
}
.checkbox-row input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }
.checkbox-row label { margin: 0; font-weight: 500; cursor: pointer; }

.image-preview {
  margin-top: 10px;
  border: 1px solid var(--a-border);
  border-radius: 5px;
  padding: 10px;
  background: var(--a-bg);
}
.image-preview img { max-height: 160px; border-radius: 4px; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--a-border);
  margin-top: 14px;
}

/* ----------- Badges ----------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 30px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
}
.badge-active { background: #e6f4ea; color: #1e6f3f; }
.badge-inactive { background: #f0f0f0; color: var(--a-muted); }
.badge-unread { background: #fde8e7; color: var(--a-danger); }
.badge-read { background: var(--a-bg); color: var(--a-muted); }

/* ----------- Alerts ----------- */
.alert {
  padding: 12px 16px;
  border-radius: 5px;
  margin-bottom: 18px;
  font-size: .88rem;
  border-left: 4px solid;
}
.alert-success { background: #e6f4ea; color: #1e6f3f; border-color: #2e8b57; }
.alert-error { background: #fde8e7; color: #a93226; border-color: var(--a-danger); }
.alert-info { background: #e8f1fb; color: #155a99; border-color: var(--a-blue); }

/* ----------- Empty state ----------- */
.empty-state {
  text-align: center;
  padding: 50px 24px;
  color: var(--a-muted);
}
.empty-state h3 { color: var(--a-text-soft); margin-bottom: 8px; font-family: 'Playfair Display', serif; }

/* ----------- Page header (admin) ----------- */
.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.page-actions h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin: 0;
  color: var(--a-sidebar);
}
.page-actions .actions { display: flex; gap: 10px; }

/* ----------- Responsive ----------- */
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .25s;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .topbar { padding: 14px 18px; }
  .content { padding: 20px 18px; }
  .table { font-size: .82rem; }
  .table th, .table td { padding: 10px 8px; }
}
