/* Antigravity Premium Slate Theme */

:root {
  --bg-primary: #121212;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #242424;
  
  --border-color: #2c2c2c;
  --border-hover: #3e3e3e;
  
  --text-main: #f3f4f6;
  --text-muted: #8a8d93;
  --text-label: #b2b5be;
  
  --accent-blue: #007acc;
  --accent-hover: #0098ff;
  
  --status-active: #10b981;
  --status-suspended: #ef4444;
  --status-offline: #6b7280;
  
  --glass-bg: rgba(26, 26, 26, 0.8);
  --glass-blur: blur(12px);
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-title: 'Outfit', var(--font-family);
}

/* Base Styles & Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Dashboard Layout */
.dashboard-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top Header */
.main-header {
  height: 56px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-svg {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.brand-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.1rem;
}

.dashboard-badge {
  font-size: 0.7rem;
  background-color: var(--border-color);
  padding: 2px 8px;
  border-radius: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-offline);
}

.status-indicator.live {
  background-color: var(--status-active);
  box-shadow: 0 0 8px var(--status-active);
  animation: pulse 2s infinite;
}

.status-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* Main Layout Grid */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left Sidebar */
.sidebar-panel {
  width: 320px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 24px;
  overflow-y: auto;
}

.panel-section h3 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header-row h3 {
  margin-bottom: 0;
}

/* Forms & Inputs */
.add-form-vertical {
  width: 100%;
}

.input-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-group-vertical input {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-group-vertical input:focus {
  border-color: var(--accent-blue);
}

.input-group-vertical input::placeholder {
  color: #555;
}

.btn-submit-account {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.btn-submit-account:hover {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.input-wrapper {
  display: flex;
  gap: 8px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--accent-blue);
}

.input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 0.85rem;
}

.input-wrapper input::placeholder {
  color: #555;
}

.btn-add {
  background-color: var(--bg-tertiary);
  border: none;
  border-radius: 4px;
  color: var(--text-main);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-add:hover {
  background-color: var(--accent-blue);
}

/* Account List styling */
.account-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.no-accounts {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
}

.account-item-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, background-color 0.2s;
}

.account-item-card:hover {
  border-color: var(--border-hover);
  background-color: rgba(255, 255, 255, 0.01);
}

.account-item-card.active-tab {
  border-color: var(--accent-blue);
  background-color: rgba(0, 122, 204, 0.04);
}

.account-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.account-email {
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-ellipsis: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
}

.btn-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
}

.btn-delete:hover {
  color: var(--status-suspended);
  background-color: rgba(239, 68, 68, 0.1);
}

.account-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Badge System */
.badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-live {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--status-active);
}

.badge-offline {
  background-color: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
}

.badge-suspended {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--status-suspended);
}

.badge-plan {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-clear-all {
  background: none;
  border: none;
  color: var(--status-suspended);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-clear-all:hover {
  text-decoration: underline;
}

/* Right Detail Column */
.ide-panel-replica {
  flex: 1;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  padding: 32px 48px;
  overflow-y: auto;
}

.empty-detail-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  gap: 16px;
}

.empty-detail-state h3 {
  font-family: var(--font-title);
  color: var(--text-main);
  font-size: 1.2rem;
  font-weight: 500;
}

.empty-detail-state p {
  font-size: 0.85rem;
  max-width: 320px;
}

/* IDE Settings Section Replica */
.ide-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.main-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--text-main);
  margin-bottom: 4px;
}

.sub-title {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.btn-refresh {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.2s, background-color 0.2s;
}

.btn-refresh:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-tertiary);
}

/* Loader Styles */
.btn-loader {
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Account Meta Block */
.account-meta-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 24px;
}

.meta-row {
  display: flex;
  gap: 32px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.meta-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}

/* IDE Card Layout Replica */
.ide-panel-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 24px;
}

.card-section-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.card-section-header h2 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-main);
}

/* Enable AI Overage Replica */
.overage-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.toggle-title {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.toggle-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 600px;
}

/* Overage Toggle Switch (Visual Only) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: not-allowed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #333;
  transition: .3s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--accent-blue);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Credits & Flow metrics display */
.credits-display-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 32px;
}

.credit-metric {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric-label {
  font-size: 0.9rem;
  color: var(--text-label);
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-actions {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

.btn-action {
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.btn-action.primary {
  background-color: var(--accent-blue);
  border: 1px solid var(--accent-blue);
  color: var(--text-main);
}

.btn-action.primary:hover {
  background-color: var(--accent-hover);
}

.btn-action.secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-action.secondary:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-tertiary);
}

/* Model Quota Row Item styling */
.quota-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.model-quota-row {
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  border-radius: 6px;
  transition: background-color 0.2s, transform 0.2s;
}

.model-quota-row:hover {
  background-color: rgba(255, 255, 255, 0.02);
  transform: translateX(4px);
}

.model-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.model-label-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}

.badge-tag {
  font-size: 0.65rem;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 1px 4px;
  border-radius: 3px;
}

.model-refresh {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Segmented Progress Bar */
.quota-segments {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.quota-segment {
  height: 6px;
  flex-grow: 1;
  background-color: var(--border-color);
  border-radius: 3px;
  transition: background-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.2s;
}

.quota-segment:hover {
  transform: scaleY(1.2);
}

/* All active segments are monochrome white */
.quota-segment.active.level-high,
.quota-segment.active.level-med,
.quota-segment.active.level-low,
.quota-segment.active.level-critical {
  background-color: #ffffff;
}

/* Token helper styles in Add Account form */
.form-helper-row {
  text-align: center;
  margin-top: 10px;
}

.token-helper-link {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.token-helper-link:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

/* ==================================================
   MOBILE RESPONSIVENESS
================================================== */
@media (max-width: 768px) {
  .main-header {
    padding: 0 16px;
  }
  
  .brand-name {
    font-size: 0.9rem;
  }
  
  .dashboard-badge {
    display: none;
  }

  .main-layout {
    flex-direction: column;
    overflow-y: auto;
  }

  /* Cleaner Navigation / Sidebar on Mobile */
  .sidebar-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    height: auto;
    max-height: auto; /* Allow natural height or limit it */
    overflow: visible;
  }
  
  /* Hide 'Tambah Akun' form on mobile to save space, focus on navigation */
  .sidebar-panel .panel-section:first-child {
    display: none;
  }

  .account-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
    gap: 12px;
  }

  .account-item-card {
    min-width: 220px;
    flex-shrink: 0;
  }

  .ide-panel-replica {
    padding: 24px 16px;
    overflow-y: visible;
  }

  .meta-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .main-title {
    font-size: 1.5rem;
  }

  .ide-section-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .model-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .model-refresh {
    font-size: 0.75rem;
    align-self: flex-start;
    color: #666;
  }

  /* Mobile Monochrome Clean Quota Design */
  .quota-segments {
    gap: 2px;
    margin-top: 8px;
  }

  .quota-segment {
    height: 3px;
    background-color: #333;
    border-radius: 0; /* sharper look */
  }

  /* Remove all colors and glows, force monochrome */
  .quota-segment.active.level-high,
  .quota-segment.active.level-med,
  .quota-segment.active.level-low,
  .quota-segment.active.level-critical {
    background-color: #ffffff !important;
    box-shadow: none !important;
  }

  .model-quota-row {
    padding: 16px 0;
    border-radius: 0;
    border-bottom: 1px solid #222;
  }

  .model-quota-row:hover {
    background-color: transparent;
    transform: none;
  }
  
  .badge-tag {
    border-color: #555;
    color: #aaa;
  }
}
