/* CruxOS - App-Specific Styles */

/* ========================================
   APP ICONS
======================================== */
.app-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
}

.app-icon.store { background: linear-gradient(135deg, #7f8cff, #6b7aff); }
.app-icon.files { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.app-icon.settings { background: linear-gradient(135deg, #64748b, #475569); }
.app-icon.terminal { background: linear-gradient(135deg, #1a1a2e, #16213e); }
.app-icon.browser { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.app-icon.notes { background: linear-gradient(135deg, #f59e0b, #d97706); }
.app-icon.calculator { background: linear-gradient(135deg, #f97316, #ea580c); }
.app-icon.about { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.app-icon.developer { background: linear-gradient(135deg, #10b981, #059669); }

/* ========================================
   APP STORE
======================================== */
.app-store {
  display: flex;
  height: 100%;
}

.store-sidebar {
  width: 200px;
  border-right: 1px solid var(--border);
  padding: 16px;
  flex-shrink: 0;
}

.store-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.store-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.store-nav-item:hover {
  background: var(--glass);
  color: var(--text);
}

.store-nav-item.active {
  background: rgba(127, 140, 255, 0.15);
  color: var(--accent-light);
}

.store-nav-item svg {
  width: 18px;
  height: 18px;
}

.store-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.store-header {
  margin-bottom: 24px;
}

.store-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.store-header p {
  color: var(--text-muted);
}

.store-search {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.store-search .input {
  flex: 1;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.store-app-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.store-app-card:hover {
  background: var(--glass-strong);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.store-app-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.store-app-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.store-app-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.store-app-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.store-app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.store-app-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--warning);
  font-size: 0.85rem;
}

.store-app-size {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* App Detail View */
.app-detail {
  max-width: 700px;
}

.app-detail-header {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.app-detail-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--r-md);
  flex-shrink: 0;
}

.app-detail-info {
  flex: 1;
}

.app-detail-name {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.app-detail-author {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.app-detail-actions {
  display: flex;
  gap: 10px;
}

.app-detail-meta {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.app-detail-stat {
  text-align: center;
}

.app-detail-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.app-detail-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-detail-section {
  margin-bottom: 24px;
}

.app-detail-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.app-detail-section p {
  color: var(--text-muted);
  line-height: 1.7;
}

.app-screenshots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.app-screenshot {
  width: 200px;
  height: 120px;
  border-radius: var(--r-sm);
  background: var(--glass);
  flex-shrink: 0;
}

/* ========================================
   FILE MANAGER
======================================== */
.file-manager {
  display: flex;
  height: 100%;
}

.fm-sidebar {
  width: 180px;
  border-right: 1px solid var(--border);
  padding: 12px;
  flex-shrink: 0;
}

.fm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
}

.fm-nav-item:hover {
  background: var(--glass);
  color: var(--text);
}

.fm-nav-item.active {
  background: rgba(127, 140, 255, 0.15);
  color: var(--accent-light);
}

.fm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.fm-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.fm-toolbar .btn {
  padding: 6px 10px;
}

.fm-path {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 0 12px;
}

.fm-path-segment {
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--r-xs);
  cursor: pointer;
}

.fm-path-segment:hover {
  background: var(--glass);
  color: var(--text);
}

.fm-path-separator {
  color: var(--text-dim);
}

.fm-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.fm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.fm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.fm-item:hover {
  background: var(--glass);
}

.fm-item.selected {
  background: rgba(127, 140, 255, 0.15);
  border: 1px solid rgba(127, 140, 255, 0.2);
}

.fm-item-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fm-item-icon svg {
  width: 40px;
  height: 40px;
}

.fm-item-icon.folder { color: #3b82f6; }
.fm-item-icon.file { color: var(--text-muted); }
.fm-item-icon.image { color: #f59e0b; }
.fm-item-icon.document { color: #ef4444; }
.fm-item-icon.code { color: #10b981; }

.fm-item-name {
  font-size: 0.8rem;
  text-align: center;
  word-break: break-word;
  max-width: 100%;
}

/* ========================================
   TERMINAL
======================================== */
.terminal {
  background: #0d0d0d;
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  font-size: 0.9rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  line-height: 1.6;
}

.terminal-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-line.prompt {
  color: #10b981;
}

.terminal-line.command {
  color: var(--text);
}

.terminal-line.output {
  color: var(--text-muted);
}

.terminal-line.error {
  color: var(--danger);
}

.terminal-input-line {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
}

.terminal-prompt {
  color: #10b981;
  margin-right: 8px;
  font-weight: 600;
}

.terminal-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* ========================================
   SETTINGS
======================================== */
.settings {
  display: flex;
  height: 100%;
}

.settings-sidebar {
  width: 200px;
  border-right: 1px solid var(--border);
  padding: 16px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.settings-nav-item:hover {
  background: var(--glass);
  color: var(--text);
}

.settings-nav-item.active {
  background: rgba(127, 140, 255, 0.15);
  color: var(--accent-light);
}

.settings-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.settings-group {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

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

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

.settings-item-info {
  flex: 1;
}

.settings-item-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.settings-item-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle {
  width: 44px;
  height: 24px;
  background: var(--glass-strong);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle.active {
  background: var(--accent);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle.active::after {
  left: 23px;
}

/* ========================================
   DEVELOPER TOOLS / APP BUILDER
======================================== */
.dev-tools {
  display: flex;
  height: 100%;
}

.dev-sidebar {
  width: 220px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

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

.dev-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.dev-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dev-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.dev-editor {
  flex: 1;
  overflow: hidden;
  display: flex;
}

.dev-editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.dev-editor-pane:last-child {
  border-right: none;
}

.dev-editor-header {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dev-editor-content {
  flex: 1;
  overflow: auto;
}

.dev-code-editor {
  width: 100%;
  height: 100%;
  background: #0d0d0d;
  color: var(--text);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 16px;
  border: none;
  resize: none;
  outline: none;
}

.dev-preview {
  flex: 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dev-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

/* ========================================
   ABOUT / SYSTEM INFO
======================================== */
.about {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px;
  text-align: center;
}

.about-logo {
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
}

.about-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.about-version {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.about-info {
  width: 100%;
  max-width: 400px;
}

.about-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--glass);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
}

.about-item-label {
  color: var(--text-muted);
}

.about-item-value {
  font-weight: 600;
}

/* ========================================
   CALCULATOR
======================================== */
.calculator {
  padding: 16px;
  max-width: 300px;
  margin: 0 auto;
}

.calc-display {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 16px;
  text-align: right;
}

.calc-expression {
  font-size: 0.9rem;
  color: var(--text-muted);
  min-height: 20px;
}

.calc-result {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.calc-btn {
  padding: 18px;
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calc-btn.number {
  background: var(--glass);
  color: var(--text);
}

.calc-btn.number:hover {
  background: var(--glass-strong);
}

.calc-btn.operator {
  background: rgba(127, 140, 255, 0.2);
  color: var(--accent-light);
}

.calc-btn.operator:hover {
  background: rgba(127, 140, 255, 0.3);
}

.calc-btn.function {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.calc-btn.function:hover {
  background: rgba(255, 255, 255, 0.1);
}

.calc-btn.equals {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: white;
  grid-column: span 2;
}

.calc-btn.equals:hover {
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
}

/* ========================================
   NOTES
======================================== */
.notes {
  display: flex;
  height: 100%;
}

.notes-sidebar {
  width: 200px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.notes-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.note-item {
  padding: 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  margin-bottom: 4px;
  transition: all var(--transition-fast);
}

.note-item:hover {
  background: var(--glass);
}

.note-item.active {
  background: rgba(127, 140, 255, 0.15);
}

.note-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-date {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.notes-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.notes-editor-toolbar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.notes-editor-content {
  flex: 1;
  padding: 16px;
}

.notes-textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  resize: none;
  outline: none;
}

/* ========================================
   BROWSER
======================================== */
.browser {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.browser-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.browser-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  border: none;
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.browser-nav-btn:hover {
  background: var(--glass-strong);
  color: var(--text);
}

.browser-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.browser-url {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.browser-url svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.browser-url input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.browser-content {
  flex: 1;
  background: white;
}

.browser-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.browser-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg);
  padding: 32px;
}

.browser-home-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
}

.browser-home-search {
  width: 100%;
  max-width: 500px;
  display: flex;
  gap: 12px;
}

.browser-home-search .input {
  flex: 1;
}

.browser-shortcuts {
  display: flex;
  gap: 16px;
  margin-top: 32px;
}

.browser-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.browser-shortcut:hover {
  background: var(--glass);
}

.browser-shortcut-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  background: var(--glass);
  display: flex;
  align-items: center;
  justify-content: center;
}

.browser-shortcut-name {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ========================================
   UPLOAD DIALOG
======================================== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 48px 32px;
  text-align: center;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(127, 140, 255, 0.05);
}

.upload-zone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--text-dim);
}

.upload-zone-title {
  font-weight: 700;
  margin-bottom: 8px;
}

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

.upload-zone input[type="file"] {
  display: none;
}

/* Upload progress */
.upload-progress {
  margin-top: 24px;
}

.upload-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--glass);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
}

.upload-file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-xs);
  background: rgba(127, 140, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.upload-file-info {
  flex: 1;
  min-width: 0;
}

.upload-file-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.upload-file-progress {
  margin-top: 8px;
}

/* ========================================
   PACKAGE BUILDER FORM
======================================== */
.pkg-form {
  max-width: 600px;
}

.pkg-form-section {
  margin-bottom: 24px;
}

.pkg-form-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pkg-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pkg-icon-picker {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.pkg-icon-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pkg-icon-preview img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r-sm);
}

.pkg-file-list {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-height: 200px;
  overflow-y: auto;
}

.pkg-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.pkg-file-item:last-child {
  border-bottom: none;
}

.pkg-file-item-name {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

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

.pkg-file-item-remove {
  width: 24px;
  height: 24px;
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pkg-file-item-remove:hover {
  background: rgba(239, 71, 111, 0.2);
  color: var(--danger);
}

/* ========================================
   LOADING STATES
======================================== */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 14, 22, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
}

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

/* ========================================
   TOAST NOTIFICATIONS
======================================== */
.toast-container {
  position: fixed;
  bottom: 70px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(25, 30, 45, 0.98), rgba(18, 22, 35, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: toastIn var(--transition-normal) forwards;
  max-width: 350px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.removing {
  animation: toastOut var(--transition-fast) forwards;
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast-close {
  width: 24px;
  height: 24px;
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  background: var(--glass);
  color: var(--text);
}
  background: rgba(127, 140, 255, 0.15);
}

.note-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-date {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.notes-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.notes-editor-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.notes-title-input {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  font-family: inherit;
  outline: none;
}

.notes-content {
  flex: 1;
  padding: 16px;
}

.notes-textarea {
  width: 100%;
  height: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  resize: none;
  outline: none;
}

/* ========================================
   BROWSER
======================================== */
.browser {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.browser-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.browser-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  border: none;
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.browser-nav-btn:hover {
  background: var(--glass-strong);
  color: var(--text);
}

.browser-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.browser-url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.browser-url-bar svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.browser-url-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.browser-content {
  flex: 1;
  background: white;
}

.browser-frame {
  width: 100%;
  height: 100%;
  border: none;
}

/* ========================================
   LOADING STATES
======================================== */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 14, 22, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
}

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

/* ========================================
   TOAST NOTIFICATIONS
======================================== */
.toast-container {
  position: fixed;
  bottom: 70px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--z-notification);
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(25, 30, 45, 0.98), rgba(18, 22, 35, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: toastIn var(--transition-normal) forwards;
  max-width: 350px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.removing {
  animation: toastOut var(--transition-fast) forwards;
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-icon.success { color: var(--success); }
.toast-icon.error { color: var(--danger); }
.toast-icon.warning { color: var(--warning); }
.toast-icon.info { color: var(--info); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
}

.toast-close:hover {
  color: var(--text);
}

/* ========================================
   UPLOAD MODAL
======================================== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(127, 140, 255, 0.05);
}

.upload-zone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--text-dim);
}

.upload-zone-text {
  color: var(--text-muted);
  margin-bottom: 8px;
}

.upload-zone-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ========================================
   APP PACKAGE INFO
======================================== */
.package-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.package-field {
  background: var(--glass);
  border-radius: var(--r-sm);
  padding: 12px;
}

.package-field-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.package-field-value {
  font-weight: 600;
}
  background: rgba(127, 140, 255, 0.15);
}

.note-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-date {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.notes-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.notes-editor-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.notes-title-input {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  outline: none;
}

.notes-content {
  flex: 1;
  padding: 16px;
}

.notes-textarea {
  width: 100%;
  height: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  resize: none;
  outline: none;
}

/* ========================================
   BROWSER
======================================== */
.browser {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.browser-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.browser-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  border: none;
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.browser-nav-btn:hover {
  background: var(--glass-strong);
  color: var(--text);
}

.browser-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.browser-url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.browser-url-bar svg {
  color: var(--text-dim);
  flex-shrink: 0;
}

.browser-url-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.browser-content {
  flex: 1;
  background: white;
}

.browser-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.browser-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg);
  padding: 32px;
}

.browser-home-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
}

.browser-home-search {
  width: 100%;
  max-width: 500px;
  display: flex;
  gap: 12px;
}

.browser-home-search .input {
  flex: 1;
}

.browser-shortcuts {
  display: flex;
  gap: 16px;
  margin-top: 32px;
}

.browser-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.browser-shortcut:hover {
  background: var(--glass);
}

.browser-shortcut-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  background: var(--glass-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.browser-shortcut-name {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ========================================
   UPLOAD DIALOG
======================================== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(127, 140, 255, 0.05);
}

.upload-zone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--text-dim);
}

.upload-zone-text {
  font-weight: 600;
  margin-bottom: 4px;
}

.upload-zone-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upload-progress {
  margin-top: 16px;
}

.upload-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--glass);
  border-radius: var(--r-sm);
  margin-bottom: 12px;
}

.upload-file-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.upload-file-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-size {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ========================================
   LOADING STATES
======================================== */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 14, 22, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
}

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

/* ========================================
   APP PACKAGE BUILDER
======================================== */
.package-builder {
  padding: 20px;
}

.package-form {
  max-width: 600px;
}

.package-preview {
  margin-top: 24px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--r-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  overflow-x: auto;
}

.package-preview pre {
  margin: 0;
  white-space: pre-wrap;
}

/* ========================================
   INSTALLED APPS MANAGEMENT
======================================== */
.installed-apps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.installed-app-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.installed-app-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.installed-app-info {
  flex: 1;
  min-width: 0;
}

.installed-app-name {
  font-weight: 600;
}

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

.installed-app-actions {
  display: flex;
  gap: 8px;
}

/* ========================================
   TOAST NOTIFICATIONS
======================================== */
.toast-container {
  position: fixed;
  bottom: 70px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--z-notification);
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(25, 30, 45, 0.98), rgba(18, 22, 35, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-width: 280px;
  max-width: 400px;
  animation: toastIn var(--transition-normal) forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.removing {
  animation: toastOut var(--transition-fast) forwards;
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-icon.success { color: var(--success); }
.toast-icon.error { color: var(--danger); }
.toast-icon.warning { color: var(--warning); }
.toast-icon.info { color: var(--info); }

.toast-message {
  flex: 1;
  font-size: 0.9rem;
}

.toast-close {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.toast-close:hover {
  background: var(--glass);
  color: var(--text);
}

/* ========================================
   FILE MANAGER - Enhanced
======================================== */
.file-manager {
  display: flex;
  height: 100%;
  background: var(--bg);
}

.fm-sidebar {
  width: 200px;
  border-right: 1px solid var(--border);
  padding: 12px;
  flex-shrink: 0;
}

.fm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

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

.fm-nav-item.active {
  background: rgba(127, 140, 255, 0.15);
  color: var(--accent);
}

.fm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fm-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.fm-path {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--r-md);
  font-size: 0.85rem;
  overflow-x: auto;
}

.fm-path-segment {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}

.fm-path-segment:hover {
  background: var(--surface-hover);
}

.fm-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.fm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.fm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.fm-item:hover {
  background: var(--surface);
}

.fm-item.selected {
  background: rgba(127, 140, 255, 0.2);
  outline: 2px solid var(--accent);
}

.fm-item-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.fm-item-icon.folder {
  color: #f59e0b;
}

.fm-item-icon.file {
  color: #64748b;
}

.fm-item-icon svg {
  width: 100%;
  height: 100%;
}

.fm-item-name {
  font-size: 0.85rem;
  word-break: break-word;
  max-width: 100%;
  line-height: 1.3;
}

/* ========================================
   UPLOAD ZONE
======================================== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(127, 140, 255, 0.05);
}

.upload-zone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

.upload-zone-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

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

/* ========================================
   BADGE STYLES
======================================== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50px;
  background: var(--surface);
  color: var(--text-muted);
}

.badge-primary {
  background: var(--accent);
  color: white;
}

.badge-success {
  background: var(--success);
  color: white;
}

.badge-danger {
  background: var(--danger);
  color: white;
}

/* ========================================
   CARD STYLES
======================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}

.card-header {
  margin-bottom: 16px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* ========================================
   DIVIDER
======================================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ========================================
   BUTTON VARIANTS
======================================== */
.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}
