:root {
  --bg-dark: #0a0c10;
  --bg-card: #12161f;
  --bg-card-hover: #1a202c;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --border-color: #262d3d;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* DESKTOP SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background-color: #0d1117;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  font-size: 24px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
}

.brand-text .badge {
  font-size: 10px;
  background-color: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* NAVIGATION MENU */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  min-height: 44px;
}

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

.nav-item.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(6, 182, 212, 0.15));
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  flex-shrink: 0;
}

.user-name {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  min-height: 38px;
}

/* MOBILE NAV BAR (HIDDEN ON DESKTOP) */
.mobile-top-bar {
  display: none;
  background-color: #0d1117;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 200;
}

.mobile-menu-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 20px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
}

/* TOP BAR */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.page-title h2 {
  font-size: 22px;
  font-weight: 700;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-badge {
  font-size: 12px;
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* TAB PAGES */
.tab-page {
  display: block;
}

.tab-page.hidden {
  display: none !important;
}

/* STUDIO GRID */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.controls-card, .display-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* SEGMENTED CONTROL & BUTTON GROUPS */
.segmented-control, .button-group {
  display: flex;
  background-color: #0d1117;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  gap: 4px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.segment-btn, .ratio-btn, .res-btn {
  flex: 1;
  padding: 10px 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 40px;
}

.segment-btn.active, .ratio-btn.active, .res-btn.active {
  background-color: var(--accent-blue);
  color: #fff;
}

/* MODEL CARDS */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.model-card {
  background-color: #0d1117;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100px;
}

.model-card:hover {
  border-color: var(--accent-blue);
}

.model-card.active {
  border-color: var(--accent-cyan);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(6, 182, 212, 0.1));
}

.model-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.model-name {
  font-size: 13px;
  font-weight: 700;
}

.model-cost {
  font-size: 10px;
  color: var(--accent-cyan);
}

.model-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.model-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tag {
  font-size: 9px;
  background-color: #1a202c;
  padding: 2px 4px;
  border-radius: 4px;
  color: var(--text-muted);
}

/* INPUTS */
.text-input, .prompt-input, .file-input {
  width: 100%;
  background-color: #0d1117;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  color: var(--text-main);
  font-size: 14px;
  min-height: 44px;
}

.prompt-input {
  min-height: 90px;
  resize: vertical;
}

.text-input:focus, .prompt-input:focus {
  border-color: var(--accent-blue);
  outline: none;
}

/* BUTTONS */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #fff;
  border: none;
  padding: 14px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  min-height: 46px;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background-color: #1a202c;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.full-width {
  width: 100%;
}

/* VIDEO PLAYER */
.player-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-preview-box {
  background-color: #000;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

/* TABLES RESPONISVE WRAPPER */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-snippet-box {
  background-color: #0d1117;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
}

.log-terminal pre {
  background-color: #000;
  color: #00ff66;
  padding: 16px;
  border-radius: 8px;
  max-height: 500px;
  overflow-y: auto;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 🔒 FULL-SCREEN ADMIN AUTHENTICATION WALL STYLES */
.auth-wall-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #1e1b4b 0%, #090d16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
}

.auth-card-wrapper {
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.2);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-card-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.auth-logo-badge {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.auth-card-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.auth-card-header p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.auth-footer-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  line-height: 1.3;
  opacity: 0.8;
}

.hidden {
  display: none !important;
}

/* ----------------------------------------------------
   📱 MOBILE & TABLET RESPONSIVE MEDIA QUERIES (< 768px)
   ---------------------------------------------------- */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  /* Show Top Mobile Bar */
  .mobile-top-bar {
    display: flex;
  }

  /* Slide-over Mobile Drawer */
  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 10px 0 30px rgba(0,0,0,0.8);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 9999;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  /* Single Column Studio Grid */
  .studio-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .models-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  .model-card {
    padding: 8px;
    min-height: 90px;
  }

  .model-name {
    font-size: 12px;
  }

  .controls-card, .display-card {
    padding: 16px;
    border-radius: 12px;
  }

  .segmented-control, .button-group {
    padding: 3px;
  }

  .segment-btn, .ratio-btn, .res-btn {
    font-size: 11px;
    padding: 8px 3px;
  }
}
