/* =========================================
   VV Admin Panel - Dark Theme CSS
   ========================================= */
:root {
  --bg:        #0d1117;
  --sidebar:   #161b22;
  --card:      #21262d;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --gold:      #FFC61A;
  --sky:       #5BC8F5;
  --navy:      #0B2A7A;
  --green:     #3fb950;
  --red:       #f85149;
  --purple:    #a371f7;
  --yellow:    #d29922;
  --sidebar-w: 240px;
  --topbar-h:  60px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #0d1f4a 0%, var(--bg) 70%);
}

.login-wrap { width: 100%; max-width: 400px; padding: 1rem; }

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  justify-content: center;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 1.5rem;
}

/* =========================================
   LAYOUT
   ========================================= */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
}

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

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  z-index: 90;
}

.content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1200px;
  width: 100%;
}

/* =========================================
   SIDEBAR ELEMENTS
   ========================================= */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-vv {
  background: var(--gold);
  color: #000;
  font-weight: 700;
  font-size: 16px;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -1px;
}

.logo-text {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.sidebar-close {
  display: none;
  cursor: pointer;
  font-size: 24px;
  color: var(--muted);
  line-height: 1;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.nav-item:hover { background: var(--border); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(255, 198, 26, 0.12); color: var(--gold); }

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-detail { min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; truncate: ellipsis; white-space: nowrap; overflow: hidden; }
.user-role { font-size: 11px; }

.role-owner { color: var(--gold); }
.role-admin  { color: var(--sky); }

.btn-logout {
  display: flex; align-items: center;
  color: var(--muted);
  padding: 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.btn-logout:hover { color: var(--red); background: rgba(248,81,73,.1); text-decoration: none; }
.btn-logout svg { width: 18px; height: 18px; }

/* =========================================
   TOPBAR
   ========================================= */
.hamburger {
  display: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
}
.hamburger svg { width: 22px; height: 22px; display: block; }

.page-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
}

.btn-site {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(91,200,245,.1);
  color: var(--sky);
  border: 1px solid rgba(91,200,245,.3);
  white-space: nowrap;
}
.btn-site:hover { background: rgba(91,200,245,.2); text-decoration: none; }

/* =========================================
   CARDS
   ========================================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.icon-blue   { background: rgba(91,200,245,.15); color: var(--sky); }
.icon-green  { background: rgba(63,185,80,.15);  color: var(--green); }
.icon-yellow { background: rgba(255,198,26,.15); color: var(--gold); }
.icon-purple { background: rgba(163,113,247,.15); color: var(--purple); }

.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* =========================================
   TABLES
   ========================================= */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 8px 12px;
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(48,54,61,.7);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,.03); }

/* =========================================
   BADGES
   ========================================= */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-published { background: rgba(63,185,80,.15); color: var(--green); }
.badge-draft     { background: rgba(139,148,158,.15); color: var(--muted); }
.badge-you       { background: rgba(91,200,245,.15); color: var(--sky); margin-left: 4px; }
.badge-role-owner { background: rgba(255,198,26,.15); color: var(--gold); }
.badge-role-admin { background: rgba(91,200,245,.15); color: var(--sky); }

/* =========================================
   BUTTONS
   ========================================= */
.btn-primary {
  display: inline-flex; align-items: center;
  padding: 8px 16px;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity .15s;
  text-decoration: none;
}
.btn-primary:hover { opacity: .88; text-decoration: none; }

.btn-secondary {
  display: inline-flex; align-items: center;
  padding: 8px 16px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.btn-secondary:hover { background: var(--border); color: var(--text); text-decoration: none; }

.btn-sm {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
}
.btn-sm:hover { opacity: .8; text-decoration: none; }

.btn-edit   { background: rgba(91,200,245,.15); color: var(--sky); }
.btn-delete { background: rgba(248,81,73,.15);  color: var(--red); }

.w-full { width: 100%; justify-content: center; }

.action-btns { display: flex; gap: 6px; align-items: center; }

/* =========================================
   FORMS
   ========================================= */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-group small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; }
.form-group code { background: var(--bg); padding: 1px 5px; border-radius: 3px; font-size: 11px; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--gold); }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group select option { background: var(--card); }

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.flex-1 { flex: 1; min-width: 140px; }
.flex-2 { flex: 2; min-width: 200px; }

.form-actions { display: flex; gap: 10px; padding-top: .5rem; }

/* =========================================
   ALERTS
   ========================================= */
.alert {
  padding: 10px 14px;
  border-radius: 7px;
  margin-bottom: 1rem;
  font-size: 13px;
  font-weight: 500;
}
.alert-success { background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.3); color: var(--green); }
.alert-error   { background: rgba(248,81,73,.12);  border: 1px solid rgba(248,81,73,.3);  color: var(--red); }

/* =========================================
   MISC
   ========================================= */
.mt-6 { margin-top: 1.5rem; }
.mb-6 { margin-bottom: 1.5rem; }
.muted { color: var(--muted); }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
  font-size: 13px;
}

.tag-text { color: var(--muted); font-size: 12px; }

.thumb-sm {
  width: 48px; height: 36px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.thumb-placeholder {
  width: 48px; height: 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.thumb-preview {
  margin-top: 8px;
  max-width: 200px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.pagination {
  display: flex;
  gap: 4px;
  padding: 1rem 0 .25rem;
  justify-content: center;
}

.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: background .15s, color .15s;
  text-decoration: none;
}
.page-btn:hover { background: var(--border); color: var(--text); text-decoration: none; }
.page-btn.active { background: var(--gold); color: #000; border-color: var(--gold); }

/* =========================================
   MOBILE SIDEBAR
   ========================================= */
#sidebar-toggle:checked ~ .sidebar {
  transform: translateX(0);
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }

  #sidebar-toggle:checked ~ .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.5);
  }

  .sidebar-close { display: block; }
  .hamburger { display: flex; }

  .main-wrap { margin-left: 0; }

  .cards-grid { grid-template-columns: repeat(2, 1fr); }

  .page-title { font-size: 15px; }

  .form-row { flex-direction: column; }

  /* Overlay when sidebar open */
  #sidebar-toggle:checked ~ .main-wrap::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
  }
}

@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .content { padding: 1rem; }
}

/* =========================================
   USER MANAGEMENT PAGE
   ========================================= */
.user-mgmt-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.25rem;
  align-items: start;
}

.row-editing {
  background: rgba(255, 198, 26, 0.06) !important;
  outline: 1px solid rgba(255, 198, 26, 0.25);
}

@media (max-width: 900px) {
  .user-mgmt-grid {
    grid-template-columns: 1fr;
  }
}
