/* ══════════════════════════════════════════════════════════
   SKY LOG PANEL — Tablet-style dark UI with purple accents
   ══════════════════════════════════════════════════════════ */

:root {
  --purple: #6C007D;
  --purple-light: #8a1a9e;
  --purple-glow: rgba(108, 0, 125, 0.35);
  --purple-subtle: rgba(108, 0, 125, 0.12);

  --bg-body: #0a0a0f;
  --bg-tablet: #111118;
  --bg-sidebar: rgba(15, 15, 22, 0.95);
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.05);

  --border: rgba(255, 255, 255, 0.06);
  --border-active: rgba(108, 0, 125, 0.5);

  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.3);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --sidebar-width: 280px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  overflow: hidden;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(108, 0, 125, 0.4); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ═══════════════════════════════════════
   TABLET FRAME
   ═══════════════════════════════════════ */
.tablet-frame {
  display: flex;
  width: 100%;
  height: 100vh;
  max-width: 1800px;
  margin: 0 auto;
  background: var(--bg-tablet);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-shadow:
    0 0 80px rgba(108, 0, 125, 0.08),
    inset 0 0 120px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

/* Ambient glow */
.tablet-frame::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(108, 0, 125, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
  backdrop-filter: blur(20px);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .material-symbols-rounded {
  font-size: 22px;
  color: var(--purple);
}

.sidebar-header h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

/* ─── Filter sections ─── */
.filter-section {
  padding: 14px 16px 6px;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.filter-label .material-symbols-rounded {
  font-size: 15px;
}

.filter-section input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

.filter-section input::placeholder {
  color: var(--text-muted);
}

.filter-section input:focus {
  border-color: var(--border-active);
  background: rgba(108, 0, 125, 0.08);
  box-shadow: 0 0 0 3px rgba(108, 0, 125, 0.1);
}

/* ─── Category Navigation ─── */
.category-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 20px;
}

.category-item {
  margin-bottom: 2px;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: background 0.2s;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all 0.2s;
  user-select: none;
}

.category-header:hover {
  background: var(--bg-card-hover);
}

.category-header .material-symbols-rounded {
  font-size: 18px;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.category-header .chevron {
  margin-left: auto;
  font-size: 18px;
  transition: transform 0.25s ease;
}

.category-item.expanded .chevron {
  transform: rotate(180deg);
}

.category-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
  flex: 1;
}

.category-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 24px;
  text-align: center;
}

/* Active category */
.category-item.active > .category-header {
  background: var(--purple);
  box-shadow: 0 2px 12px var(--purple-glow);
}

.category-item.active > .category-header .material-symbols-rounded,
.category-item.active > .category-header .category-name {
  color: #fff;
}

.category-item.active > .category-header .category-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Subcategories */
.subcategory-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.category-item.expanded .subcategory-list {
  max-height: 500px;
}

.subcategory-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 38px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  user-select: none;
}

.subcategory-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.subcategory-item.active {
  background: var(--purple-subtle);
  color: #fff;
}

.subcategory-item.active .dot {
  background: var(--purple);
  box-shadow: 0 0 6px var(--purple-glow);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s;
}

/* ═══════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

/* ─── Top Bar ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 17, 24, 0.8);
  backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--purple);
  padding: 3px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 8px var(--purple-glow);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
}

.stat-chip .material-symbols-rounded {
  font-size: 16px;
  color: var(--purple);
}

.btn-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-refresh:hover {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
  box-shadow: 0 2px 12px var(--purple-glow);
}

.btn-refresh .material-symbols-rounded {
  font-size: 18px;
  transition: transform 0.4s;
}

.btn-refresh:hover .material-symbols-rounded {
  transform: rotate(180deg);
}

/* ─── Logs Container ─── */
.logs-container {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.logs-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.logs-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  background: rgba(17, 17, 24, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.logs-table td {
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.025);
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Column widths */
.col-id { width: 60px; }
.col-char { width: 60px; }
.col-category { width: 130px; }
.col-title { width: 150px; }
.col-message { width: auto; }
.col-side { width: 65px; }
.col-date { width: 140px; }

/* Row hover */
.logs-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.logs-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.logs-table tbody tr:hover td {
  color: var(--text-primary);
}

/* Category badge in table */
.cat-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--purple-subtle);
  color: var(--purple-light);
  letter-spacing: 0.2px;
}

/* Side badge */
.side-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.side-badge.server {
  background: rgba(59, 130, 246, 0.12);
  color: rgba(96, 165, 250, 0.9);
}

.side-badge.client {
  background: rgba(16, 185, 129, 0.12);
  color: rgba(52, 211, 153, 0.9);
}

/* Title in table */
.title-text {
  font-weight: 500;
  color: var(--text-primary);
}

/* Date in table */
.date-text {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* Char ID */
.char-id {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--purple-light);
}

/* Log ID */
.log-id {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 11.5px;
}

/* ─── Loading ─── */
.loading-row td {
  text-align: center;
  padding: 60px 0 !important;
  color: var(--text-muted);
  font-size: 13px;
  white-space: normal !important;
}

.loading-row td > * {
  display: block;
  margin: 0 auto;
}

.loading-row td span {
  margin-top: 14px;
}

.loader {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(108, 0, 125, 0.2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* No results */
.no-results td {
  text-align: center;
  padding: 60px 0 !important;
  color: var(--text-muted);
  font-size: 13px;
  white-space: normal !important;
}

/* ─── Pagination ─── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: rgba(17, 17, 24, 0.6);
}

.pagination button {
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0 6px;
}

.pagination button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.1);
}

.pagination button.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
  box-shadow: 0 2px 8px var(--purple-glow);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.pagination .page-info {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 10px;
}

/* ═══════════════════════════════════════
   MODAL
   ═══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 90%;
  max-width: 620px;
  background: var(--bg-tablet);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(108, 0, 125, 0.1);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s;
  overflow: hidden;
}

.modal-overlay.visible .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.detail-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  min-width: 90px;
  padding-top: 2px;
}

.detail-value {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
  flex: 1;
}

.detail-value.message-full {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  white-space: pre-wrap;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar {
    width: 240px;
    min-width: 240px;
  }

  .col-category, .col-side {
    display: none;
  }
}

@media (max-width: 600px) {
  .sidebar {
    position: absolute;
    left: -260px;
    height: 100%;
    z-index: 50;
    transition: left 0.3s;
  }

  .sidebar.open {
    left: 0;
  }
}

/* ═══════════════════════════════════════
   USER PROFILE (Sidebar)
   ═══════════════════════════════════════ */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--purple);
  object-fit: cover;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-id {
  font-size: 10.5px;
  color: var(--text-muted);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.btn-logout .material-symbols-rounded {
  font-size: 17px;
}

/* ═══════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════ */
.login-body {
  overflow: auto;
}

.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
}

/* Ambient glow blobs */
.login-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.5;
}

.login-glow-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(108, 0, 125, 0.3) 0%, transparent 70%);
  top: -100px;
  right: -80px;
  animation: floatGlow 8s ease-in-out infinite;
}

.login-glow-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(108, 0, 125, 0.2) 0%, transparent 70%);
  bottom: -50px;
  left: -60px;
  animation: floatGlow 10s ease-in-out infinite reverse;
}

@keyframes floatGlow {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -20px); }
}

/* Login Card */
.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(17, 17, 24, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  backdrop-filter: blur(24px);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 60px rgba(108, 0, 125, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  z-index: 1;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--purple);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: 0 4px 20px var(--purple-glow);
}

.login-icon .material-symbols-rounded {
  font-size: 28px;
  color: #fff;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Error box */
.login-error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 24px;
}

.login-error .material-symbols-rounded {
  font-size: 20px;
  color: #ef4444;
  flex-shrink: 0;
  margin-top: 1px;
}

.login-error strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #fca5a5;
  margin-bottom: 2px;
}

.login-error p {
  font-size: 12px;
  color: rgba(252, 165, 165, 0.7);
  line-height: 1.4;
}

/* Discord Button */
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: #5865F2;
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.3);
}

.login-btn:hover {
  background: #4752c4;
  box-shadow: 0 6px 24px rgba(88, 101, 242, 0.4);
  transform: translateY(-1px);
}

.login-btn:active {
  transform: translateY(0);
}

.discord-icon {
  flex-shrink: 0;
}

/* Info text */
.login-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.login-info .material-symbols-rounded {
  font-size: 16px;
  color: var(--purple-light);
  flex-shrink: 0;
}

.login-info span:last-child {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Footer */
.login-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 1;
}

.login-footer-dot {
  opacity: 0.4;
}
