/* ============================================================
   macOS Web — per-app styles
   ============================================================ */

/* ---------- Generic split-view (sidebar + content) ---------- */
.app-split { display: flex; height: 100%; }
.app-sidebar {
  width: 200px; flex-shrink: 0;
  background: rgba(240,240,240,0.6);
  backdrop-filter: blur(20px);
  border-right: 0.5px solid rgba(0,0,0,0.1);
  padding: 12px 8px; overflow-y: auto;
}
body.dark .app-sidebar { background: rgba(38,38,38,0.7); border-right-color: rgba(255,255,255,0.08); }
.sidebar-section { font-size: 11px; font-weight: 600; color: #8a8a8e; padding: 10px 8px 4px; }
.sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px; font-size: 13px; cursor: default;
  color: #333;
}
body.dark .sidebar-item { color: #ddd; }
.sidebar-item:hover { background: rgba(0,0,0,0.05); }
.sidebar-item.active { background: rgba(var(--accent-rgb),0.18); color: var(--accent); font-weight: 500; }
.sidebar-item .si-ico { width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.app-content { flex: 1; overflow-y: auto; }

/* ---------- Finder ---------- */
.finder-toolbar {
  height: 38px; display: flex; align-items: center; gap: 14px;
  padding: 0 14px; border-bottom: 0.5px solid rgba(0,0,0,0.08);
  font-size: 13px; color: #555;
}
.finder-path { font-weight: 600; color: #222; }
body.dark .finder-path { color: #eee; }
.finder-grid {
  display: grid; grid-template-columns: repeat(auto-fill, 96px);
  gap: 16px 8px; padding: 18px; align-content: start;
}
.finder-file {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px; border-radius: 8px; cursor: default; text-align: center;
}
.finder-file:hover { background: rgba(0,0,0,0.05); }
.finder-file.selected { background: rgba(var(--accent-rgb),0.2); }
.finder-file .ff-icon { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; font-size: 44px; }
.finder-file .ff-name { font-size: 12px; color: #333; line-height: 1.2; word-break: break-word; }
body.dark .finder-file .ff-name { color: #ddd; }

/* ---------- Terminal ---------- */
.terminal {
  height: 100%; background: rgba(22,22,24,0.96); color: #e0e0e0;
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.45; padding: 10px 12px;
  overflow-y: auto; cursor: text;
}
.terminal .term-line { white-space: pre-wrap; word-break: break-word; }
.terminal .term-green { color: #3ad06a; }
.terminal .term-blue { color: #5ea0ff; }
.terminal .term-yellow { color: #f0c050; }
.terminal .term-red { color: #ff6b6b; }
.terminal .term-dim { color: #888; }
.term-input-line { display: flex; }
.term-prompt { color: #3ad06a; white-space: pre; }
.term-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #e0e0e0; font-family: inherit; font-size: inherit; caret-color: #3ad06a;
}
.window:has(.terminal) .titlebar { background: rgba(40,40,42,0.92); }
.window:has(.terminal) .win-title { color: #ccc; }

/* ---------- Calculator ---------- */
.calc { display: flex; flex-direction: column; height: 100%; background: #1c1c1e; }
.calc-display {
  flex: 1; min-height: 90px; display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 16px 22px; color: #fff; font-weight: 300;
  font-size: 56px; overflow: hidden; line-height: 1;
}
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: #1c1c1e; }
.calc-key {
  height: 58px; border: none; font-size: 23px; cursor: pointer;
  background: #5a5a5e; color: #fff; transition: filter 0.1s;
  display: flex; align-items: center; justify-content: center;
}
.calc-key:hover { filter: brightness(1.18); }
.calc-key:active { filter: brightness(0.85); }
.calc-key.func { background: #d4d4d2; color: #1c1c1e; }
.calc-key.op { background: #ff9f0a; color: #fff; font-size: 27px; }
.calc-key.op.active { background: #fff; color: #ff9f0a; }
.calc-key.zero { grid-column: span 2; justify-content: flex-start; padding-left: 24px; }

/* ---------- Notes ---------- */
.notes-app { display: flex; height: 100%; }
.notes-list {
  width: 230px; flex-shrink: 0; background: #fafafa;
  border-right: 0.5px solid rgba(0,0,0,0.1); overflow-y: auto;
}
body.dark .notes-list { background: #262626; border-right-color: rgba(255,255,255,0.08); }
.notes-toolbar { padding: 8px 12px; display: flex; gap: 8px; border-bottom: 0.5px solid rgba(0,0,0,0.06); }
.notes-new-btn { background: none; border: none; cursor: pointer; color: #d6a72e; font-size: 18px; }
.note-entry { padding: 11px 14px; border-bottom: 0.5px solid rgba(0,0,0,0.06); cursor: default; border-radius: 6px; margin: 2px 6px; }
.note-entry.active { background: #ffe49a; }
body.dark .note-entry.active { background: #5a4d1f; }
.note-entry .ne-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-entry .ne-preview { font-size: 12px; opacity: 0.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-editor { flex: 1; display: flex; flex-direction: column; }
.notes-editor-date { text-align: center; font-size: 11px; color: #999; padding: 8px; }
.notes-textarea {
  flex: 1; border: none; outline: none; resize: none; padding: 4px 28px 20px;
  font-size: 15px; line-height: 1.55; font-family: var(--font); color: #222; background: transparent;
}
body.dark .notes-textarea { color: #eee; }

/* ---------- TextEdit ---------- */
.textedit-area {
  width: 100%; height: 100%; border: none; outline: none; resize: none;
  padding: 24px 32px; font-size: 14px; line-height: 1.6;
  font-family: var(--font); color: #222; background: #fff;
}
body.dark .textedit-area { background: #1e1e1e; color: #eee; }

/* ---------- Safari ---------- */
.safari { display: flex; flex-direction: column; height: 100%; }
.safari-toolbar {
  height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: rgba(245,245,245,0.9); border-bottom: 0.5px solid rgba(0,0,0,0.1);
}
body.dark .safari-toolbar { background: rgba(40,40,40,0.92); }
.safari-nav-btn { width: 28px; height: 28px; border: none; background: none; border-radius: 6px; cursor: pointer; color: #555; font-size: 16px; }
.safari-nav-btn:hover { background: rgba(0,0,0,0.07); }
.safari-url {
  flex: 1; height: 30px; border-radius: 8px; border: none;
  background: rgba(0,0,0,0.06); text-align: center; font-size: 13px;
  padding: 0 14px; outline: none; color: #333; font-family: var(--font);
}
body.dark .safari-url { background: rgba(255,255,255,0.1); color: #eee; }
.safari-frame { flex: 1; border: none; width: 100%; background: #fff; }
.safari-start {
  flex: 1; overflow-y: auto; padding: 40px; background: #f5f5f7;
  display: flex; flex-direction: column; align-items: center;
}
body.dark .safari-start { background: #1a1a1a; }
.safari-start h1 { font-size: 28px; font-weight: 600; margin-bottom: 28px; color: #333; }
body.dark .safari-start h1 { color: #eee; }
.safari-favorites { display: grid; grid-template-columns: repeat(auto-fill, 90px); gap: 22px; justify-content: center; width: 100%; max-width: 640px; }
.safari-fav { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.safari-fav-icon {
  width: 64px; height: 64px; border-radius: 14px; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700;
}
.safari-fav span { font-size: 12px; color: #555; }
body.dark .safari-fav span { color: #ccc; }

/* ---------- Calendar ---------- */
.calendar { display: flex; flex-direction: column; height: 100%; background: #fff; }
body.dark .calendar { background: #1e1e1e; }
.cal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.cal-month { font-size: 22px; font-weight: 700; }
.cal-month span { color: #ff3b30; }
.cal-nav { display: flex; gap: 4px; }
.cal-nav button { width: 30px; height: 28px; border: none; background: none; cursor: pointer; font-size: 16px; color: #888; border-radius: 6px; }
.cal-nav button:hover { background: rgba(0,0,0,0.06); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7,1fr); padding: 0 12px; }
.cal-weekdays div { text-align: right; padding: 6px 10px; font-size: 11px; font-weight: 600; color: #999; border-top: 0.5px solid rgba(0,0,0,0.1); }
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7,1fr); grid-auto-rows: 1fr; padding: 0 12px 12px; }
.cal-day { border-top: 0.5px solid rgba(0,0,0,0.07); border-left: 0.5px solid rgba(0,0,0,0.07); padding: 6px 10px; font-size: 14px; text-align: right; color: #333; position: relative; }
body.dark .cal-day { color: #ddd; border-color: rgba(255,255,255,0.08); }
.cal-day:nth-child(7n) { border-right: 0.5px solid rgba(0,0,0,0.07); }
.cal-day.other { color: #ccc; }
.cal-day.today .cal-daynum {
  background: #ff3b30; color: #fff; border-radius: 50%;
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; float: right;
}
.cal-event { font-size: 10.5px; background: var(--accent); color: #fff; border-radius: 3px; padding: 1px 4px; margin-top: 3px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- System Settings ---------- */
.settings { display: flex; height: 100%; }
.settings-content { flex: 1; padding: 28px 32px; overflow-y: auto; }
.settings-content h2 { font-size: 20px; margin-bottom: 20px; }
.settings-group {
  background: rgba(0,0,0,0.03); border-radius: 10px; overflow: hidden; margin-bottom: 22px;
}
body.dark .settings-group { background: rgba(255,255,255,0.05); }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 0.5px solid rgba(0,0,0,0.07); font-size: 13.5px;
}
.settings-row:last-child { border-bottom: none; }
body.dark .settings-row { border-bottom-color: rgba(255,255,255,0.06); }
.wallpaper-grid { display: grid; grid-template-columns: repeat(auto-fill, 110px); gap: 16px; }
.wallpaper-thumb { width: 110px; height: 68px; border-radius: 9px; cursor: pointer; border: 2.5px solid transparent; background-size: cover; background-position: center; }
.wallpaper-thumb.active { border-color: var(--accent); }
.accent-swatches { display: flex; gap: 10px; }
.accent-swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.accent-swatch.active { border-color: rgba(0,0,0,0.3); box-shadow: 0 0 0 2px #fff inset; }

/* macOS-style switch */
.mac-switch { width: 38px; height: 23px; border-radius: 12px; background: #c8c8cc; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.mac-switch.on { background: #30d158; }
.mac-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.2s; }
.mac-switch.on::after { transform: translateX(15px); }

/* ---------- About This Mac ---------- */
.about { display: flex; flex-direction: column; align-items: center; padding: 30px 40px; text-align: center; height: 100%; justify-content: center; }
.about-logo { margin-bottom: 16px; color: #888; }
.about h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.5px; }
.about .about-version { font-size: 14px; color: #888; margin-top: 2px; margin-bottom: 22px; }
.about-specs { font-size: 12.5px; line-height: 1.9; color: #444; }
body.dark .about-specs { color: #ccc; }
.about-specs b { display: inline-block; min-width: 96px; text-align: right; margin-right: 10px; color: #888; font-weight: 500; }

/* ---------- Music ---------- */
.music { display: flex; flex-direction: column; height: 100%; background: linear-gradient(160deg,#2a2a3e,#1a1a24); color: #fff; }
.music-now { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.music-art { width: 200px; height: 200px; border-radius: 14px; box-shadow: 0 16px 50px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; font-size: 80px; margin-bottom: 24px; }
.music-track-title { font-size: 19px; font-weight: 600; }
.music-track-artist { font-size: 14px; opacity: 0.65; margin-top: 2px; }
.music-progress { width: 80%; max-width: 320px; margin: 22px 0 8px; }
.music-bar { height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; }
.music-bar-fill { height: 100%; width: 35%; background: #fff; border-radius: 2px; }
.music-time { display: flex; justify-content: space-between; font-size: 11px; opacity: 0.6; }
.music-controls { display: flex; align-items: center; gap: 28px; margin-top: 18px; }
.music-controls button { background: none; border: none; color: #fff; cursor: pointer; font-size: 22px; opacity: 0.9; }
.music-controls .play-btn { font-size: 40px; }

/* ---------- Photos ---------- */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 4px; padding: 14px; }
.photo-tile { aspect-ratio: 1; border-radius: 6px; overflow: hidden; cursor: pointer; transition: transform 0.12s; }
.photo-tile:hover { transform: scale(1.03); z-index: 2; }

/* ---------- Generic placeholder app ---------- */
.app-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 14px; color: #999; padding: 30px; text-align: center; }
.app-placeholder .ph-icon { width: 88px; height: 88px; }
.app-placeholder h2 { font-size: 19px; color: #555; }
body.dark .app-placeholder h2 { color: #ccc; }
.app-placeholder p { font-size: 13px; max-width: 360px; line-height: 1.5; }
