/* ═══════════════════════════════════════════════════════════════════
   FlutterPlaza Code Push — Console Styles
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Layout ───────────────────────────────────────────────────── */
.console-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 150;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-bright);
  text-decoration: none;
  display: block;
  margin-bottom: 20px;
}

.sidebar-logo span {
  color: var(--accent);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info {
  overflow: hidden;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-tier {
  margin-top: 4px;
}

/* ─── Sidebar Nav ──────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-hover);
  text-decoration: none;
}

.nav-item.active {
  color: var(--accent-light);
  background: rgba(99, 102, 241, 0.08);
  border-right: 2px solid var(--accent);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

/* ─── Main Content ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.main-header {
  height: var(--nav-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.main-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-bright);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

.main-body {
  padding: 32px;
  max-width: 1200px;
}

/* ─── Breadcrumb ───────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

.breadcrumb .sep {
  color: var(--text-muted);
}

.breadcrumb .current {
  color: var(--text-bright);
  font-weight: 500;
}

/* ─── Stats Grid ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-bright);
}

/* ─── App Cards Grid ───────────────────────────────────────────── */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.app-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.app-card-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.app-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.app-card-meta span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── Metadata Grid ────────────────────────────────────────────── */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.meta-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.meta-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 4px;
}

.meta-value {
  font-size: 0.95rem;
  color: var(--text-bright);
  font-weight: 500;
  word-break: break-all;
}

/* ─── Section Header ───────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
}

/* ─── Auth Pages ───────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-bright);
  text-align: center;
  margin-bottom: 8px;
}

.auth-logo span {
  color: var(--accent);
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent-light);
  cursor: pointer;
}

/* ─── API Key Display ──────────────────────────────────────────── */
.api-key-display {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 20px 0;
  text-align: center;
}

.api-key-display .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.api-key-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent-light);
  word-break: break-all;
  margin-bottom: 12px;
  user-select: all;
}

.api-key-warning {
  background: var(--yellow-muted);
  border: 1px solid var(--yellow);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--yellow);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Inline Rollout Bar ───────────────────────────────────────── */
.rollout-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.rollout-bar .progress-bar {
  flex: 1;
  height: 6px;
}

.rollout-bar span {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Rollout Slider ───────────────────────────────────────────── */
.rollout-slider {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rollout-slider input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

.rollout-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
}

.rollout-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
}

.rollout-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-bright);
  min-width: 36px;
  text-align: right;
}

/* ─── Billing Plan Cards ───────────────────────────────────────── */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  transition: border-color 0.2s;
}

.plan-card.current-plan {
  border-color: var(--accent);
}

.plan-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.plan-card-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-bright);
  margin: 12px 0;
}

.plan-card-price small {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 16px 0 24px;
  text-align: left;
}

.plan-features li {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-features li::before {
  content: "\2713";
  color: var(--green);
  font-weight: 700;
}

/* ─── Settings ─────────────────────────────────────────────────── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 16px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

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

.settings-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 100px;
}

.settings-value {
  font-size: 0.9rem;
  color: var(--text-bright);
  text-align: right;
  word-break: break-all;
}

/* ─── API Key Masked ───────────────────────────────────────────── */
.api-key-masked {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.api-key-masked .reveal-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.api-key-masked .reveal-btn:hover {
  color: var(--text);
  border-color: var(--border-light);
}

/* ─── Copy Button ──────────────────────────────────────────────── */
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

/* ─── Section gap ──────────────────────────────────────────────── */
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-16 { margin-top: 16px; }

/* ─── File info after drop ─────────────────────────────────────── */
.file-info {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── Usage section ────────────────────────────────────────────── */
.usage-bar-wrapper {
  margin-top: 8px;
}

.usage-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ─── Sidebar overlay on mobile ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 140;
}

.sidebar-overlay.open {
  display: block;
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

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

  .hamburger {
    display: block;
  }

  .main-body {
    padding: 20px 16px;
  }

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

  .apps-grid {
    grid-template-columns: 1fr;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }

  .meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .settings-value {
    text-align: left;
  }
}

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

  .meta-grid {
    grid-template-columns: 1fr;
  }
}
