:root {
  --bg-primary: #121212;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #242424;
  --bg-hover: #2e2e2e;
  --border-color: #ffffff14;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --text-terminal: #CCCCCC;
  --accent-color: #ffffff;
  --accent-hover: #e0e0e0;
  --accent-text: #000000;
  --danger-color: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --success-color: #10b981;
  
  --font-body: 'Poppins', sans-serif;
  --font-code: 'Google Sans Code', monospace;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 25px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 4px 12px #0000001a;
  --shadow-md: 0 8px 24px #00000033;
  --shadow-lg: 0 24px 48px #00000033;
}

body.light-theme {
  --bg-primary: #f9f9f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f0f0;
  --bg-hover: #e4e4e4;
  --border-color: #0000001f;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --text-terminal: #343a40;
  --accent-color: #111827;
  --accent-hover: #374151;
  --accent-text: #ffffff;
  --danger-bg: rgba(239, 68, 68, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  height: 100vh;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

#mobile-blocker { display: none; }
.app-container { display: flex; flex-direction: column; height: 100%; }

@media (max-width: 768px) {
  .app-container { display: none; }
  #mobile-blocker {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center; padding: 32px; width: 100%; height: 100%;
    position: fixed; top: 0; left: 0; background: var(--bg-primary); z-index: 9999;
  }
  .blocker-content ion-icon { font-size: 64px; color: var(--text-secondary); margin-bottom: 24px; }
  .blocker-content h1 { color: var(--text-primary); font-size: 28px; font-weight: 600; margin-bottom: 12px; }
  .blocker-content p { color: var(--text-secondary); font-size: 16px; margin-bottom: 8px; }
  .blocker-content span { color: var(--text-muted); font-size: 14px; display: block; max-width: 320px; line-height: 1.5; }
}

.topbar {
  height: 60px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 24px;
  flex-shrink: 0;
  margin: 7px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  font-size: 24px;
}

.badge {
  background: var(--danger-color);
  color: #fff;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.hidden { display: none !important; }

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
}

.divider-horizontal {
  width: 100%;
  height: 1px;
  background: var(--border-color);
  margin: 24px 0;
}

.action-btn {
  background: transparent;
  color: var(--text-primary);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.action-btn ion-icon { font-size: 16px; }
.action-btn.icon-only { padding: 0px; }
.action-btn.icon-only ion-icon { font-size: 35px;}

.action-btn.outline {
  background: transparent;
  border: 1px solid var(--border-color);
}
.action-btn.outline:hover {
  background: var(--bg-hover);
}

.action-btn.primary {
  background: var(--accent-color);
  color: var(--accent-text);
  font-weight: 600;
}
.action-btn.primary:hover {
  background: var(--accent-hover);
}

.action-btn.danger {
  background: var(--danger-bg);
  color: var(--danger-color);
}
.action-btn.danger:hover {
  background: var(--danger-color);
  color: #fff;
}

.w-full { width: 100%; margin-top: 16px; padding: 12px; font-size: 14px; }

.profile-dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 15px;
  width: 210px;
  padding: 5px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  animation: dropdownFade 0.2s ease;
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.menu-item ion-icon{
  font-size: 17px;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item.danger { color: var(--danger-color); }
.menu-item.danger:hover { background: var(--danger-bg); }

.workspace {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  margin: 7px;
  margin-top: 0px;
}

.editor-pane {
  width: 60%;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  margin-right: 4.5px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
}

.resizer {
  width: 3px;
  height: 90%;
  align-self: center;
  background: var(--border-color);
  cursor: col-resize;
  z-index: 10;
  transition: background 0.2s;
  border-radius: 50px;
}
.resizer:hover, .resizer.active {
  background: var(--text-secondary);
}

.terminal-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  min-width: 0;
  margin-left: 4.5px;
  border-radius: 20px;
  overflow: hidden;
}

.monaco-editor {
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  overflow: hidden;
}

.pane-header {
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  border-top-right-radius: 20px;
  border-top-left-radius: 20px;
}

.flex-between { display: flex; justify-content: space-between; align-items: center; border-top-left-radius: 20px;}

.icon-btn { cursor: pointer; font-size: 18px; color: var(--text-muted); transition: color 0.2s; }
.icon-btn:hover { color: var(--text-primary); }

#editor-container { flex: 1; }

.term-body {
  flex: 1;
  padding: 20px;
  font-family: var(--font-code);
  font-size: 14px;
  line-height: 1.5;
  overflow-y: auto;
  color: var(--text-terminal);
  white-space: pre-wrap;
  word-wrap: break-word;
  cursor: text;
}

#term-input-wrapper { display: none; }
#term-input {
  background: transparent;
  border: none;
  color: var(--text-terminal);
  font-family: inherit;
  font-size: inherit;
  outline: none;
  padding: 0;
  margin: 0;
  width: 50%;
  caret-color: var(--text-terminal);
}

.text-success { color: var(--success-color); font-weight: normal; }
.run-status { color: var(--text-secondary); font-style: normal; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 50;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  opacity: 1;
  visibility: visible;
}

.overlay.hidden {
  display: block !important; 
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(1);
  background: var(--bg-secondary);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  z-index: 100;
  box-shadow: var(--shadow-lg);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.3s;
}

.modal.hidden {
  display: block !important;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -45%) scale(0.95);
  pointer-events: none;
}

#collab-modal {
    width: 400px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal.large-modal { width: 700px; max-width: 90vw; padding: 40px; }

#share-modal {
    width: 400px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#share-loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    width: 100%;
}

#share-content-container {
    width: 100%;
}

.modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  background: var(--bg-tertiary);
  border-radius: 50%;
  padding: 4px;
}
.modal-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.modal h3 { font-size: 20px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.modal p { color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; line-height: 1.5; }

.input-group { display: flex; gap: 8px; margin-bottom: 16px; }
.input-group input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 13px 16px;
  border-radius: var(--radius-full);
  outline: none;
  font-size: 13px;
  font-family: var(--font-code);
}

form input, #prompt-input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 13px 20px;
  border-radius: 50px;
  outline: none;
  font-size: 14px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
  font-family: inherit;
}
form input:focus, #prompt-input:focus { border-color: var(--text-secondary); }

.auth-toggle { margin-top: 20px; font-size: 13px; color: var(--text-secondary); text-align: center; }
.auth-toggle strong { color: var(--text-primary); cursor: pointer; font-weight: 600; transition: color 0.2s; }
.auth-toggle strong:hover { color: var(--text-secondary); }

.account-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  margin-top: 24px;
}

@media (max-width: 600px) {
  .account-grid { grid-template-columns: 1fr; gap: 24px; }
}

.account-section h4 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 16px;
  background: var(--bg-tertiary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  gap: 12px;
  flex-wrap: nowrap;
}

.setting-row > span {
  white-space: nowrap;
  font-weight: 500;
}

.custom-select-wrapper {
  position: relative;
  min-width: 130px;
  width: auto;
  font-size: 13px;
  flex-shrink: 0;
}

.custom-select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 50px;
  cursor: pointer;
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.custom-select-trigger:hover {
  border-color: var(--text-secondary);
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 15px;
  z-index: 10;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  padding: 3px;
}

.custom-option {
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.2s;
  color: var(--text-primary);
  border-radius: 11px;
}

.custom-option:hover {
  background: var(--bg-hover);
}

.lists-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
  cursor: pointer;
  position: relative;
  font-family: inherit;
  transition: color 0.2s;
}

.tab-btn.active { color: var(--text-primary); }
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px 2px 0 0;
}

.items-list {
  flex: 1;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.empty-state {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 32px 0;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-tertiary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.list-item:hover {
  border-color: var(--border-color);
}

.list-item-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.list-item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.action-icon {
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.action-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.action-icon.danger:hover { background: var(--danger-bg); color: var(--danger-color); }

.loader-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 120px;
  width: 100%;
}

.loader-text {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.ios-spinner {
  display: inline-block;
  position: relative;
  width: 28px;
  height: 28px;
  color: var(--text-secondary);
  margin: 0 auto;
}

.ios-spinner div {
  position: absolute;
  left: 13px;
  top: 0;
  width: 2px;
  height: 7px;
  background: currentColor;
  border-radius: 4px;
  transform-origin: 1px 14px;
  animation: spinner-fade 1.2s linear infinite;
}

.ios-spinner div:nth-child(1) { transform: rotate(0deg); animation-delay: -1.1s; }
.ios-spinner div:nth-child(2) { transform: rotate(30deg); animation-delay: -1.0s; }
.ios-spinner div:nth-child(3) { transform: rotate(60deg); animation-delay: -0.9s; }
.ios-spinner div:nth-child(4) { transform: rotate(90deg); animation-delay: -0.8s; }
.ios-spinner div:nth-child(5) { transform: rotate(120deg); animation-delay: -0.7s; }
.ios-spinner div:nth-child(6) { transform: rotate(150deg); animation-delay: -0.6s; }
.ios-spinner div:nth-child(7) { transform: rotate(180deg); animation-delay: -0.5s; }
.ios-spinner div:nth-child(8) { transform: rotate(210deg); animation-delay: -0.4s; }
.ios-spinner div:nth-child(9) { transform: rotate(240deg); animation-delay: -0.3s; }
.ios-spinner div:nth-child(10) { transform: rotate(270deg); animation-delay: -0.2s; }
.ios-spinner div:nth-child(11) { transform: rotate(300deg); animation-delay: -0.1s; }
.ios-spinner div:nth-child(12) { transform: rotate(330deg); animation-delay: 0s; }

@keyframes spinner-fade {
  0% { opacity: 1; }
  100% { opacity: 0.15; }
}

#toast-container {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 9px 24px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes toastIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.monaco-menu .action-item:has(.action-label[aria-label="Change All Occurrences"]),
.monaco-menu .action-item:has(.action-label[aria-label="Command Palette"]) {
  display: none !important;
}