/* ==========================================================
   AISTUDIO.ID OFFICIAL THEME & DESIGN SYSTEM
   Pixel-Perfect Implementation for auto.erifura.io
   ========================================================== */

:root {
  --bg-main: #0c0e12;
  --bg-surface: #12151b;
  --bg-card: #161922;
  --bg-card-hover: #1c212c;
  --bg-card-inner: #101318;
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-card: rgba(255, 255, 255, 0.09);
  --border-card-hover: rgba(204, 255, 0, 0.35);
  
  --text-primary: #ffffff;
  --text-secondary: #9aa0ac;
  --text-muted: #656c7b;
  
  /* Brand Accent Colors */
  --brand-lime: #ccff00;
  --brand-lime-hover: #b8e600;
  --brand-cyan: #00e5ff;
  --brand-orange: #ff8a00;
  --brand-pink: #ff007a;
  --brand-purple: #8b5cf6;
  --brand-green: #10b981;
  --brand-red: #ef4444;
  --brand-gold: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow-lime: 0 0 25px rgba(204, 255, 0, 0.25);
}

[data-theme="light"] {
  --bg-main: #f3f5f8;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-card-inner: #f1f4f8;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-card: rgba(0, 0, 0, 0.1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(204, 255, 0, 0.4);
}

/* ── Top Navbar ── */
.navbar {
  height: 68px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.brand-icon-wrap {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-title .dot {
  color: var(--brand-cyan);
}

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

.nav-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
}

.nav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.coin-capsule {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-pill);
  color: #fbbf24;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.coin-capsule:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
}

.user-capsule {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
}

.logout-pill {
  padding: 6px 16px;
  background: #3b1414;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-pill);
  color: #f87171;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.logout-pill:hover {
  background: #501919;
  color: #ff9999;
  border-color: rgba(239, 68, 68, 0.6);
}

/* ── App Shell Layout ── */
.app-shell {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 68px);
}

/* ── Left Sidebar ── */
.sidebar {
  width: 270px;
  min-width: 270px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-profile {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--brand-lime);
  color: #0c0e12;
  font-weight: 900;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(204, 255, 0, 0.3);
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.profile-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.profile-sub {
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-coins {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 4px;
}

.member-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.15);
  color: var(--brand-cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

/* Sidebar Menu */
.menu-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.menu-category {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 8px 12px 4px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-link .link-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-link .link-icon {
  font-size: 1.1rem;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.sidebar-link.active {
  background: var(--brand-lime);
  color: #0c0e12;
  font-weight: 800;
  box-shadow: var(--shadow-glow-lime);
}

.sidebar-link.active .link-icon {
  color: #0c0e12;
}

/* Sidebar Badges */
.badge-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-hot {
  background: rgba(255, 138, 0, 0.2);
  color: var(--brand-orange);
  border: 1px solid rgba(255, 138, 0, 0.4);
}

.badge-new {
  background: rgba(0, 229, 255, 0.2);
  color: var(--brand-cyan);
  border: 1px solid rgba(0, 229, 255, 0.4);
}

.badge-count {
  background: rgba(255, 0, 122, 0.2);
  color: var(--brand-pink);
  border: 1px solid rgba(255, 0, 122, 0.4);
}

.badge-topup {
  background: rgba(16, 185, 129, 0.2);
  color: var(--brand-green);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-gray {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* ── Main Content Area ── */
.main-content {
  flex: 1;
  padding: 32px 38px;
  overflow-y: auto;
  max-width: 1440px;
}

/* Top Stats Metric Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.icon-orange {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.icon-purple {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.icon-pink {
  background: rgba(255, 0, 122, 0.15);
  color: #f472b6;
  border: 1px solid rgba(255, 0, 122, 0.3);
}

.stat-val {
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Hub Section Title */
.hub-header {
  margin-bottom: 24px;
}

.hub-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.hub-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Feature Cards Grid (7 Cards) ── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 250px;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-card);
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.card-badge-top {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-workspace {
  background: rgba(255, 138, 0, 0.15);
  color: #ffaa33;
  border: 1px solid rgba(255, 138, 0, 0.3);
}

.badge-vault {
  background: rgba(255, 0, 122, 0.15);
  color: #ff66aa;
  border: 1px solid rgba(255, 0, 122, 0.3);
}

.badge-credentials {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-reference {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-telemetry {
  background: rgba(0, 229, 255, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.badge-billing {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-profile {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.card-desc {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.48;
  margin-bottom: 18px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.tag-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.card-action-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand-lime);
  text-decoration: none;
  transition: transform 0.2s ease;
  margin-top: auto;
}

.feature-card:hover .card-action-link {
  transform: translateX(4px);
}

/* ── Interactive View Containers ── */
.view-container {
  display: none;
}
.view-container.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sub-View Panels & Components */
.panel-box {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-subtitle {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

/* Forms, Inputs & Controls */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #ffffff;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--brand-lime);
  box-shadow: 0 0 15px rgba(204, 255, 0, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand-lime);
  color: #0c0e12;
  box-shadow: var(--shadow-glow-lime);
}

.btn-primary:hover {
  background: var(--brand-lime-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Sub-Tab Nav */
.sub-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.sub-tab-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}

.sub-tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.sub-tab-btn.active {
  background: rgba(204, 255, 0, 0.12);
  border-color: rgba(204, 255, 0, 0.35);
  color: var(--brand-lime);
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.media-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.media-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
}

.media-preview-box {
  width: 100%;
  height: 180px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.media-preview-box video, .media-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.media-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* API Key Table */
.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}

.data-table th {
  background: var(--bg-card-inner);
  color: var(--text-muted);
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Code Snippet Box */
.code-block {
  background: #07090d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  color: #38bdf8;
  overflow-x: auto;
  position: relative;
  line-height: 1.5;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 860px) {
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .main-content {
    padding: 20px 16px;
  }
}
