/* ==========================================
   AI STUDIO EXTENSIONS STORE - Styles v1.0
   Coherente con AI Studio Lite
   ========================================== */
:root {
  --bg: #131314;
  --panel-bg: #1e1f20;
  --surface: #282a2c;
  --surface-hover: #333537;
  --border: #444746;
  --border-hover: #8e918f;
  --text-primary: #e3e3e3;
  --text-secondary: #c4c7c5;
  --accent: #a8c7fa;
  --accent-hover: #7cacf8;
  --accent-bg: #004a77;
  --success: #81c995;
  --warning: #fdd663;
  --danger: #f28b82;
  --font-family: 'Google Sans', 'Segoe UI', system-ui, sans-serif;
  --code-font: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #5f6368; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #80868b; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  font-size: 20px;
  user-select: none;
}
.hidden { display: none !important; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-top { padding: 12px; overflow-y: auto; }
.sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); }

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 20px;
}
.logo-img { width: 24px; height: 24px; border-radius: 50%; }
.logo-text { font-size: 16px; font-weight: 500; }

.new-prompt-btn {
  width: 100%;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 20px;
  font-family: inherit;
  transition: 0.15s;
}
.new-prompt-btn:hover { background: var(--surface-hover); }

.nav-section { margin-bottom: 20px; }
.nav-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 24px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  margin-bottom: 2px;
  transition: 0.15s;
}
.nav-btn:hover { background: var(--surface); }
.nav-btn.active {
  background: var(--accent-bg);
  color: var(--accent);
}
.nav-btn.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

/* ===== MAIN AREA ===== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.top-bar {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}
.prompt-title { display: flex; align-items: center; gap: 8px; }
.prompt-icon { color: var(--text-secondary); font-size: 18px; }
.page-name { font-size: 15px; font-weight: 500; }
.top-right { display: flex; align-items: center; gap: 12px; }
.mode-badge {
  background: var(--surface);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
}

.btn-primary, .btn-secondary, .btn-ghost, .btn-create-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 24px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s;
  border: none;
}
.btn-create-app {
  background: var(--accent);
  color: #000;
  padding: 8px 16px;
}
.btn-create-app:hover { background: var(--accent-hover); }
.btn-primary {
  background: var(--accent);
  color: #000;
  padding: 10px 18px;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 18px;
}
.btn-secondary:hover { background: var(--surface-hover); }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 10px 18px;
}
.btn-ghost:hover { background: rgba(168,199,250,0.08); }

.btn-primary .material-symbols-outlined,
.btn-secondary .material-symbols-outlined,
.btn-ghost .material-symbols-outlined,
.btn-create-app .material-symbols-outlined { font-size: 16px; }

/* ===== VIEW / GALLERY ===== */
.view { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.gallery-container { flex: 1; overflow-y: auto; padding: 32px 40px 60px; }

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.gallery-title { font-size: 28px; font-weight: 400; margin-bottom: 4px; }
.gallery-subtitle { color: var(--text-secondary); font-size: 13px; }
.gallery-actions { display: flex; align-items: center; gap: 10px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  min-width: 240px;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  flex: 1;
  font-family: inherit;
  font-size: 13px;
}
.search-box .material-symbols-outlined {
  color: var(--text-secondary);
  font-size: 18px;
}

/* Cards Grid */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.app-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: 0.2s;
  display: flex;
  flex-direction: column;
  min-height: 240px;
  position: relative;
}
.app-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}

.app-card-preview {
  height: 110px;
  background: linear-gradient(135deg, var(--surface), var(--panel-bg));
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.app-card-preview .material-symbols-outlined {
  font-size: 48px;
  color: var(--accent);
  opacity: 0.9;
}
.app-card-preview.official-gradient {
  background: linear-gradient(135deg, #004a77, #1e1f20);
}
.app-card-preview.production-gradient {
  background: linear-gradient(135deg, rgba(129,201,149,0.15), #1e1f20);
}
.app-card-preview.beta-gradient {
  background: linear-gradient(135deg, rgba(168,199,250,0.15), #1e1f20);
}

.app-card-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.app-card-info h3 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}
.app-card-info p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge .material-symbols-outlined { font-size: 12px; }
.badge-live {
  background: rgba(129, 201, 149, 0.15);
  color: var(--success);
  border: 1px solid rgba(129, 201, 149, 0.4);
}
.badge-beta {
  background: rgba(168, 199, 250, 0.15);
  color: var(--accent);
  border: 1px solid rgba(168, 199, 250, 0.4);
}
.badge-official {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid rgba(168, 199, 250, 0.3);
}
.badge-community {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.card-actions button {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 20px;
}

/* ===== BUILDER ===== */
.builder-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.builder-form,
.builder-preview {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: 0.15s;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { min-height: 80px; resize: vertical; }

.preview-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-weight: 500;
}
.code-output {
  background: #0d0d0e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--code-font);
  font-size: 12px;
  color: var(--success);
  white-space: pre-wrap;
  max-height: 380px;
  overflow: auto;
  line-height: 1.5;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.modal-header h3 { font-size: 18px; font-weight: 500; }
.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
  padding: 4px;
  display: flex;
}
.close-btn:hover { background: var(--surface); color: var(--text-primary); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: #fff;
  padding: 12px 20px;
  border-radius: 24px;
  z-index: 1000;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.toast.show { opacity: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .logo-text,
  .new-prompt-btn span:not(.material-symbols-outlined),
  .nav-label,
  .nav-btn span:not(.material-symbols-outlined) { display: none; }
  .gallery-container { padding: 20px 16px; }
  .builder-layout { grid-template-columns: 1fr; }
}
