/* =============================================
   FILE: public/css/style.css
   PURPOSE: Global styles for iBiz Poster Pro
   ============================================= */

:root {
  --primary:      #4f46e5;
  --primary-dark: #3730a3;
  --secondary:    #06b6d4;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --dark:         #0f172a;
  --dark2:        #1e293b;
  --dark3:        #334155;
  --text-light:   #f1f5f9;
  --text-muted:   #94a3b8;
  --border:       #334155;
  --card-bg:      #1e293b;
  --sidebar-w:    260px;
  --topbar-h:     64px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--dark);
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--secondary); text-decoration: none; }
a:hover { color: #22d3ee; }

/* ── SCROLLBAR ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--dark2); }
::-webkit-scrollbar-thumb { background: var(--dark3); border-radius: 3px; }

/* ── LAYOUT ────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--dark2);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
}

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

.topbar {
  height: var(--topbar-h);
  background: var(--dark2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-body {
  padding: 28px 24px;
  flex: 1;
}

/* ── SIDEBAR LOGO ──────────────────────────── */
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.sidebar-brand .brand-text { font-size: 15px; font-weight: 700; color: var(--text-light); }
.sidebar-brand .brand-sub  { font-size: 11px; color: var(--text-muted); }

/* ── SIDEBAR NAV ───────────────────────────── */
.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-muted); text-transform: uppercase;
  padding: 12px 20px 4px;
}
.nav-item { display: block; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--text-muted);
  border-radius: 0;
  transition: all .2s;
  font-size: 13.5px;
  position: relative;
}
.nav-link:hover {
  background: rgba(255,255,255,.05);
  color: var(--text-light);
}
.nav-link.active {
  background: rgba(79,70,229,.15);
  color: var(--primary);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-link .nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* ── SIDEBAR USER ──────────────────────────── */
.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user .user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0; overflow: hidden;
}
.sidebar-user .user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user .user-name  { font-size: 13px; font-weight: 600; color: var(--text-light); }
.sidebar-user .user-role  { font-size: 11px; color: var(--text-muted); }

/* ── TOPBAR ────────────────────────────────── */
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.hamburger {
  display: none; background: none; border: none;
  color: var(--text-light); font-size: 22px; cursor: pointer;
}

/* ── STAT CARDS ────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: transform .2s, border-color .2s;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue    { background: rgba(79,70,229,.15);  color: #818cf8; }
.stat-icon.green   { background: rgba(16,185,129,.15); color: #34d399; }
.stat-icon.yellow  { background: rgba(245,158,11,.15); color: #fbbf24; }
.stat-icon.cyan    { background: rgba(6,182,212,.15);  color: #22d3ee; }
.stat-icon.red     { background: rgba(239,68,68,.15);  color: #f87171; }
.stat-info .stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-info .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── CARDS ─────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body  { padding: 20px; }

/* ── BUTTONS ───────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .2s;
  text-decoration: none; white-space: nowrap;
}
.btn-sm   { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg   { padding: 11px 22px; font-size: 15px; }
.btn-block{ width: 100%; justify-content: center; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; color: #fff; }

.btn-warning { background: var(--warning); color: #000; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; color: #000; }

.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover  { background: #dc2626; color: #fff; }

.btn-secondary { background: var(--dark3); color: var(--text-light); border-color: var(--dark3); }
.btn-secondary:hover { background: #475569; color: #fff; }

.btn-outline {
  background: transparent; color: var(--text-light);
  border-color: var(--border);
}
.btn-outline:hover { background: rgba(255,255,255,.05); }

/* ── FORMS ─────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-muted); }
.form-control {
  width: 100%; padding: 9px 14px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 13.5px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.2); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

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

/* ── TABLES ────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--dark);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
tbody tr:hover { background: rgba(255,255,255,.02); }

/* ── BADGES ────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-success { background: rgba(16,185,129,.15); color: #34d399; }
.badge-danger  { background: rgba(239,68,68,.15);  color: #f87171; }
.badge-warning { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-info    { background: rgba(6,182,212,.15);  color: #22d3ee; }
.badge-primary { background: rgba(79,70,229,.15);  color: #818cf8; }

/* ── ALERTS / FLASH ────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 10px;
  margin-bottom: 16px; font-size: 13.5px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.3); color: #34d399; }
.alert-danger  { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: #f87171; }
.alert-warning { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); color: #fbbf24; }
.alert-info    { background: rgba(6,182,212,.12);  border: 1px solid rgba(6,182,212,.3);  color: #22d3ee; }

/* ── POSTER GALLERY ────────────────────────── */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.poster-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.poster-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.poster-thumb {
  width: 100%; aspect-ratio: 1;
  object-fit: cover; display: block;
}
.poster-info { padding: 12px; }
.poster-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.poster-cat   { font-size: 11px; color: var(--text-muted); }
.poster-actions { padding: 10px 12px 12px; display: flex; gap: 8px; }
.poster-actions .btn { flex: 1; justify-content: center; }

/* ── STRUCTURE CARDS ───────────────────────── */
.structure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; }
.structure-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 14px; padding: 18px;
  cursor: pointer; transition: all .2s;
  position: relative;
}
.structure-card:hover { border-color: var(--primary); }
.structure-card.selected { border-color: var(--primary); background: rgba(79,70,229,.08); }
.structure-card input[type=radio] { position: absolute; opacity: 0; }
.structure-preview {
  width: 100%; aspect-ratio: 1;
  background: var(--dark3);
  border-radius: 8px; margin-bottom: 12px;
  position: relative; overflow: hidden;
  border: 1px solid var(--border);
}
.structure-preview .preview-poster {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1e3a5f, #0f172a);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 11px;
}
/* Mini layout indicators inside preview */
.layout-indicator {
  position: absolute; background: rgba(79,70,229,.7);
  border-radius: 3px; font-size: 9px;
  color: #fff; padding: 2px 5px; white-space: nowrap;
}
.structure-name  { font-size: 14px; font-weight: 600; }
.structure-desc  { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.structure-check {
  position: absolute; top: 12px; right: 12px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary);
  display: none; align-items: center; justify-content: center;
  font-size: 11px; color: #fff;
}
.structure-card.selected .structure-check { display: flex; }

/* ── SEARCH BAR ────────────────────────────── */
.search-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px; align-items: center;
}
.search-bar .form-control { max-width: 260px; }

/* ── PAGINATION ────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.page-btn {
  padding: 7px 13px; border-radius: 8px;
  background: var(--card-bg); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; cursor: pointer;
  transition: all .2s; text-decoration: none;
}
.page-btn:hover, .page-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* ── LOGIN PAGE ────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--dark);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%; max-width: 420px;
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo .logo-icon {
  width: 60px; height: 60px; border-radius: 16px;
  background: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── MODAL ─────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title  { font-size: 16px; font-weight: 600; }
.modal-close  { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.modal-close:hover { color: var(--text-light); }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── TOAST ─────────────────────────────────── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px;
  min-width: 280px; max-width: 380px;
  display: flex; align-items: flex-start; gap: 12px;
  animation: slideIn .3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger);  }
.toast.warning { border-left: 3px solid var(--warning); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── UTILITIES ─────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.d-flex  { display: flex; }
.gap-2   { gap: 8px; }
.gap-3   { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }  .mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.fw-600 { font-weight: 600; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }

/* ── RESPONSIVE ────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.6); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); }
  .stats-grid  { grid-template-columns: 1fr 1fr; }
  .page-body   { padding: 16px; }
  .login-card  { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .poster-grid { grid-template-columns: 1fr 1fr; }
}
