/* ═══════════════════════════════════════
   Digital Signage — Admin stylesheet
   ═══════════════════════════════════════ */

:root {
  --primary:       #1e293b;
  --primary-dark:  #0f172a;
  --primary-mid:   #293548;
  --accent:        #3b82f6;
  --accent-dark:   #2563eb;
  --success:       #22c55e;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #06b6d4;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --bg:            #f1f5f9;
  --card:          #ffffff;
  --border:        #e2e8f0;
  --sidebar-w:     256px;
  --bar-h:         60px;
  --radius:        8px;
  --shadow:        0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ──────────────────────────────────────
   LAYOUT
   ────────────────────────────────────── */

.layout {
  display: flex;
  min-height: 100vh;
}

/* ──────────────────────────────────────
   SIDEBAR
   ────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 18px 20px;
  background: var(--primary-dark);
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .3px;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
}

/* Display link button in sidebar */
.sidebar-display-link {
  margin: 14px 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: rgba(59,130,246,.18);
  border: 1px solid rgba(59,130,246,.35);
  border-radius: var(--radius);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 500;
  transition: background .15s;
  text-decoration: none;
}
.sidebar-display-link:hover {
  background: rgba(59,130,246,.28);
  text-decoration: none;
  color: #bfdbfe;
}
.sidebar-display-link .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%,100% { opacity:1; } 50% { opacity:.4; }
}

.nav-section {
  padding: 18px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #f1f5f9; text-decoration: none; }
.nav-link.active { background: var(--accent); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 600; color: #f1f5f9; }
.user-role  { font-size: 11px; color: rgba(255,255,255,.4); }
.logout-link {
  display: block;
  text-align: center;
  padding: 7px;
  border-radius: 6px;
  background: rgba(239,68,68,.15);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s;
}
.logout-link:hover { background: rgba(239,68,68,.25); text-decoration: none; color: #fca5a5; }

/* ──────────────────────────────────────
   MAIN CONTENT
   ────────────────────────────────────── */

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

.topbar {
  height: var(--bar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.page { padding: 24px; flex: 1; }

/* ──────────────────────────────────────
   CARDS
   ────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: #fafafa;
}
.card-title { font-size: 14px; font-weight: 700; }
.card-body  { padding: 20px; }

/* ──────────────────────────────────────
   STATS
   ────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.blue::before  { background: var(--accent); }
.stat-card.green::before { background: var(--success); }
.stat-card.amber::before { background: var(--warning); }
.stat-card.red::before   { background: var(--danger); }
.stat-card.cyan::before  { background: var(--info); }
.stat-value { font-size: 34px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-icon  { font-size: 28px; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); opacity: .12; }

/* ──────────────────────────────────────
   BUTTONS
   ────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 6px; border: none;
  font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: filter .15s, box-shadow .15s;
  white-space: nowrap; font-family: inherit;
}
.btn:hover { text-decoration: none; filter: brightness(.93); }
.btn:active { filter: brightness(.87); }

.btn-xs  { padding: 4px 9px;  font-size: 11.5px; border-radius: 5px; }
.btn-sm  { padding: 6px 12px; font-size: 12.5px; }
.btn-lg  { padding: 11px 22px; font-size: 15px; }

.btn-primary   { background: var(--accent);   color: #fff; }
.btn-success   { background: var(--success);  color: #fff; }
.btn-danger    { background: var(--danger);   color: #fff; }
.btn-warning   { background: var(--warning);  color: #fff; }
.btn-info      { background: var(--info);     color: #fff; }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; filter: none; }

.btn-outline-primary {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline-primary:hover { background: rgba(59,130,246,.08); filter: none; }

/* ──────────────────────────────────────
   FORMS
   ────────────────────────────────────── */

.form-group  { margin-bottom: 18px; }
.form-label  { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.required::after { content: ' *'; color: var(--danger); }
.form-hint   { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13.5px; color: var(--text); background: var(--card);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control   { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.form-check-label { font-size: 13px; font-weight: 500; cursor: pointer; }

/* Priority radio buttons */
.priority-group { display: flex; gap: 8px; }
.priority-radio { display: none; }
.priority-label {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border); border-radius: 8px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all .15s; color: var(--text-muted);
}
.priority-radio:checked + .priority-label {
  border-color: var(--warning); background: #fef3c7; color: #92400e;
}
.priority-label:hover { border-color: var(--warning); }

/* ──────────────────────────────────────
   DROPZONE / FILE UPLOAD
   ────────────────────────────────────── */

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius); padding: 36px 20px;
  text-align: center; cursor: pointer;
  transition: all .2s; background: #f8fafc;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #eff6ff; }
.dropzone-icon { font-size: 44px; margin-bottom: 10px; line-height: 1; }
.dropzone-text { font-size: 14px; color: var(--text-muted); }
.dropzone-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.dropzone-file { margin-top: 10px; font-weight: 600; color: var(--text); font-size: 13px; }
.preview-img   { margin-top: 14px; max-width: 260px; border-radius: 6px; border: 1px solid var(--border); }

/* ──────────────────────────────────────
   TABLE
   ────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-muted);
  background: #f8fafc; border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

.thumb {
  width: 80px; height: 48px;
  object-fit: cover; border-radius: 5px; border: 1px solid var(--border);
}
.pdf-thumb {
  width: 80px; height: 48px;
  background: #fee2e2; border: 1px solid #fca5a5; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.content-title { font-weight: 600; }
.content-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ──────────────────────────────────────
   BADGES
   ────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #cffafe; color: #155e75; }
.badge-muted   { background: #f1f5f9; color: #475569; }

/* ──────────────────────────────────────
   PRIORITY STARS
   ────────────────────────────────────── */

.stars { display: inline-flex; gap: 1px; }
.star  { font-size: 13px; }
.star.on  { color: var(--warning); }
.star.off { color: #e2e8f0; }

/* ──────────────────────────────────────
   TOGGLE SWITCH
   ────────────────────────────────────── */

.toggle { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle input { display: none; }
.toggle-track {
  position: absolute; inset: 0;
  background: #cbd5e1; border-radius: 24px; cursor: pointer;
  transition: background .2s;
}
.toggle-track::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; left: 3px; top: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-track { background: var(--success); }
.toggle input:checked + .toggle-track::before { transform: translateX(18px); }

/* ──────────────────────────────────────
   ALERTS / FLASH
   ────────────────────────────────────── */

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: 7px; margin-bottom: 16px;
  font-size: 13.5px; border-width: 1px; border-style: solid;
}
.alert-close {
  margin-left: auto; cursor: pointer; opacity: .5;
  background: none; border: none; font-size: 16px; color: inherit;
  line-height: 1; padding: 0 2px;
}
.alert-close:hover { opacity: 1; }

.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #f0f9ff; color: #075985; border-color: #bae6fd; }

/* ──────────────────────────────────────
   MODAL
   ────────────────────────────────────── */

.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 999;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card); border-radius: 12px; padding: 28px;
  max-width: 440px; width: 92%;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: modal-in .15s ease;
}
@keyframes modal-in { from { transform: scale(.96); opacity:0; } }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.modal-body  { font-size: 14px; color: var(--text-muted); margin-bottom: 22px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ──────────────────────────────────────
   EMPTY STATE
   ────────────────────────────────────── */

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-icon  { font-size: 52px; margin-bottom: 14px; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-text  { font-size: 14px; margin-bottom: 20px; }

/* ──────────────────────────────────────
   ACTIONS BAR
   ────────────────────────────────────── */

.actions-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}

/* ──────────────────────────────────────
   ROW ACTIONS
   ────────────────────────────────────── */

.row-actions { display: flex; gap: 5px; }

/* ──────────────────────────────────────
   LOGIN PAGE
   ────────────────────────────────────── */

.login-wrapper {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #293548 100%);
  padding: 20px;
}
.login-card {
  background: var(--card); border-radius: 14px;
  padding: 42px 40px; width: 100%; max-width: 380px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-brand {
  text-align: center; margin-bottom: 32px;
}
.login-brand-icon { font-size: 52px; margin-bottom: 12px; }
.login-brand h1   { font-size: 22px; font-weight: 800; color: var(--text); }
.login-brand p    { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-submit     { width: 100%; margin-top: 6px; padding: 11px; font-size: 14px; }
.login-footer     { text-align: center; margin-top: 18px; font-size: 12px; color: var(--text-muted); }

/* ──────────────────────────────────────
   USER CARD (users page)
   ────────────────────────────────────── */

.user-tag {
  display: inline-flex; align-items: center; gap: 6px;
}
.user-tag-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* ──────────────────────────────────────
   SECTION HEADINGS
   ────────────────────────────────────── */

.section-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.section-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* ──────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────── */

@media (max-width: 900px) {
  .sidebar   { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main      { margin-left: 0; }
  .form-row  { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px; }
}

/* ──────────────────────────────────────
   MISC UTILITIES
   ────────────────────────────────────── */

.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.fw-bold       { font-weight: 700; }
.mt-1  { margin-top: 6px; }
.mt-2  { margin-top: 12px; }
.mt-3  { margin-top: 18px; }
.mb-1  { margin-bottom: 6px; }
.mb-2  { margin-bottom: 12px; }
.mb-3  { margin-bottom: 18px; }
.mb-4  { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
