/* ==========================================================================
   Desktop features added on top of styles.css:
   App Store-style project windows, Quick Look, Spotlight, notifications,
   menu bar menus, About This Mac, and Xcode.
   ========================================================================== */

/* --- App Store-style project window ------------------------------------- */
.appstore-page { padding: 24px 28px 32px; color: var(--text-color); overflow-y: auto; height: 100%; box-sizing: border-box; }
.as-hero { display: grid; grid-template-columns: 96px 1fr auto; gap: 18px; align-items: center; }
.as-icon { width: 112px; height: 112px; margin: -8px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.25)); }
.as-title h2 { margin: 0; font-size: 24px; font-weight: 700; }
.as-title p { margin: 2px 0 8px; opacity: 0.65; font-size: 14px; }
.as-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.as-badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: rgba(128,128,128,0.18); }
.as-badge-new { background: var(--accent); color: #fff; }
.as-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.as-get { background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; font-size: 13px; padding: 8px 16px; border-radius: 999px; white-space: nowrap; }
.as-get:hover { filter: brightness(1.1); }
.as-secondary { display: flex; gap: 12px; }
.as-secondary a { color: var(--accent); text-decoration: none; font-size: 12px; font-weight: 500; }
.as-secondary a:hover { text-decoration: underline; }

.as-gallery-wrap { position: relative; margin: 24px -28px 8px; }
.as-gallery { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 28px 12px; scrollbar-width: thin; outline: none; }
.as-shot { flex: 0 0 auto; scroll-snap-align: start; scroll-margin-left: 28px; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 14px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.25); }
.as-shot img { display: block; height: 380px; width: auto; aspect-ratio: 460 / 999; background: rgba(128,128,128,0.15); }
.as-shot:focus-visible, .as-gallery:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.as-nav { position: absolute; top: 50%; transform: translateY(-60%); z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(30,30,32,0.75); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; transition: opacity 0.2s; }
.as-prev { left: 10px; }
.as-next { right: 10px; }
.as-gallery-wrap:hover .as-nav, .as-nav:focus-visible { opacity: 1; }

.as-section { border-top: 1px solid rgba(128,128,128,0.25); padding-top: 14px; margin-top: 14px; }
.as-section h3 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.as-desc { margin: 0; line-height: 1.55; font-size: 14px; }
.as-features { margin: 0; padding-left: 18px; columns: 2; column-gap: 28px; font-size: 13px; line-height: 1.5; }
.as-features li { break-inside: avoid; margin-bottom: 6px; }
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.as-chips span { font-size: 12px; padding: 4px 10px; border-radius: 6px; background: rgba(128,128,128,0.15); }

@media (max-width: 768px) {
    .appstore-page { padding: 16px 16px 24px; }
    .as-hero { grid-template-columns: 72px 1fr; }
    .as-icon { width: 86px; height: 86px; margin: -7px; }
    .as-title h2 { font-size: 20px; }
    .as-actions { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
    .as-gallery-wrap { margin: 16px -16px 4px; }
    .as-gallery { padding: 4px 16px 10px; }
    .as-shot { scroll-margin-left: 16px; }
    .as-shot img { height: 300px; }
    .as-nav { display: none; }
    .as-features { columns: 1; }
}

/* --- Quick Look ---------------------------------------------------------- */
#quicklook { position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; align-items: center; justify-content: center; animation: fxFadeIn 0.18s ease-out; }
@keyframes fxFadeIn { from { opacity: 0; } to { opacity: 1; } }
#quicklook .ql-img { max-height: calc(100dvh - 110px); max-width: calc(100vw - 140px); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
#quicklook .ql-bar { position: absolute; top: 0; left: 0; right: 0; height: 44px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 500; }
#quicklook .ql-close { position: absolute; right: 14px; background: none; border: 0; color: #fff; font-size: 18px; cursor: pointer; }
#quicklook .ql-nav { background: rgba(255,255,255,0.12); border: 0; color: #fff; width: 44px; height: 44px; border-radius: 50%; margin: 0 16px; cursor: pointer; font-size: 16px; }
#quicklook .ql-nav:hover { background: rgba(255,255,255,0.22); }
@media (max-width: 768px) {
    #quicklook .ql-img { max-width: calc(100vw - 24px); max-height: calc(100dvh - 140px); }
    #quicklook .ql-nav { position: absolute; bottom: 24px; margin: 0; }
    #quicklook .ql-prev { left: 30%; }
    #quicklook .ql-next { right: 30%; }
}

/* --- Menu bar dropdowns -------------------------------------------------- */
#menubar .menu-item[data-menu], #spotlight-btn { cursor: default; border-radius: 4px; }
#menubar .menu-item.menu-open { background: rgba(255,255,255,0.22); }
.menu-dropdown { position: fixed; z-index: 99999; min-width: 230px; padding: 5px; border-radius: 9px; background: rgba(40,40,44,0.82); backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6); box-shadow: 0 10px 30px rgba(0,0,0,0.35), inset 0 0 0 0.5px rgba(255,255,255,0.18); color: #fff; font-size: 13px; animation: fxFadeIn 0.12s ease-out; }
.md-item { display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 4px; width: 100%; padding: 4px 10px 4px 6px; border: 0; border-radius: 5px; background: none; color: inherit; font: inherit; text-align: left; cursor: default; }
.md-item:not(:disabled):hover, .md-item:not(:disabled):focus-visible { background: var(--accent); outline: none; }
.md-item:disabled { opacity: 0.4; }
.md-check { font-size: 11px; }
.md-shortcut { opacity: 0.55; padding-left: 18px; font-size: 12px; }
.md-sep { height: 1px; margin: 5px 8px; background: rgba(255,255,255,0.15); }

/* --- Notifications ------------------------------------------------------- */
#notif-stack { position: fixed; top: 34px; right: 12px; z-index: 99990; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 24px)); }
.mac-notif { position: relative; display: grid; grid-template-columns: 38px 1fr; gap: 10px; padding: 12px 14px; border-radius: 16px; background: rgba(40,40,44,0.78); backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6); box-shadow: 0 10px 30px rgba(0,0,0,0.3), inset 0 0 0 0.5px rgba(255,255,255,0.18); color: #fff; cursor: pointer; animation: notifIn 0.35s cubic-bezier(.2,.9,.3,1.2); }
.mac-notif.leaving { animation: notifOut 0.25s ease-in forwards; }
@keyframes notifIn { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes notifOut { to { transform: translateX(120%); opacity: 0; } }
.mn-icon { width: 38px; height: 38px; border-radius: 9px; }
.mn-head { display: flex; justify-content: space-between; font-size: 11px; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.02em; }
.mn-title { font-weight: 600; font-size: 13px; margin-top: 1px; }
.mn-body { font-size: 12.5px; opacity: 0.85; line-height: 1.35; margin-top: 1px; }
.mn-close { position: absolute; top: -6px; left: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(90,90,95,0.95); color: #fff; font-size: 9px; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.mac-notif:hover .mn-close, .mac-notif:focus-within .mn-close { opacity: 1; }
@media (max-width: 768px) { #notif-stack { top: 10px; right: 50%; transform: translateX(50%); } }

/* --- Spotlight ----------------------------------------------------------- */
#spotlight-backdrop { position: fixed; inset: 0; z-index: 99995; }
#spotlight { position: absolute; top: 18vh; left: 50%; transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); border-radius: 14px; overflow: hidden; background: rgba(36,36,40,0.82); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6); box-shadow: 0 24px 70px rgba(0,0,0,0.45), inset 0 0 0 0.5px rgba(255,255,255,0.2); color: #fff; animation: fxFadeIn 0.12s ease-out; }
.sp-bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; font-size: 20px; }
.sp-bar i { opacity: 0.6; }
.sp-bar input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: inherit; font: 300 22px var(--system-font); }
.sp-bar input::placeholder { color: rgba(255,255,255,0.4); }
.sp-results { max-height: min(420px, 55vh); overflow-y: auto; border-top: 1px solid rgba(255,255,255,0.1); padding: 4px 8px 8px; }
.sp-results:empty { display: none; }
.sp-group { font-size: 11px; font-weight: 600; opacity: 0.5; padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.sp-row { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 8px; cursor: default; }
.sp-row img { width: 32px; height: 32px; border-radius: 7px; flex-shrink: 0; }
.sp-row img.round { border-radius: 50%; }
.sp-row.selected { background: var(--accent); }
.sp-title { font-size: 14px; }
.sp-sub { font-size: 12px; opacity: 0.65; }
.sp-row.selected .sp-sub { opacity: 0.85; }
.sp-empty { padding: 18px; text-align: center; opacity: 0.6; font-size: 14px; }
.sp-hint { font-size: 11px; opacity: 0.45; text-align: center; padding: 6px 0 9px; border-top: 1px solid rgba(255,255,255,0.08); }
@media (max-width: 768px) { #spotlight { top: 10vh; } .sp-hint { display: none; } }

/* --- About This Mac ------------------------------------------------------ */
.about-mac { height: 100%; box-sizing: border-box; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--text-color); }
.am-photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.about-mac h1 { margin: 16px 0 2px; font-size: 22px; font-weight: 700; }
.am-sub { margin: 0 0 16px; opacity: 0.6; font-size: 13px; }
.am-specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 18px; font-size: 12.5px; text-align: left; }
.am-specs dt { text-align: right; font-weight: 600; }
.am-specs dd { margin: 0; opacity: 0.8; }
.am-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.am-btn { border: 0; border-radius: 7px; padding: 6px 14px; font: 500 13px var(--system-font); background: var(--accent); color: #fff; cursor: pointer; }
.am-btn.am-secondary { background: rgba(128,128,128,0.25); color: var(--text-color); }
.am-foot { margin-top: auto; padding-top: 16px; font-size: 11px; opacity: 0.45; }

/* --- Terminal extras ----------------------------------------------------- */
.term-pre { margin: 0; font: inherit; white-space: pre-wrap; word-break: break-word; }
.term-cmd { color: #ffd866; }
.term-dir { color: #00bfff; font-weight: bold; }
.term-file { color: #e6e6e6; }
.term-logo { color: #33ff00; }

/* --- Safari start page --------------------------------------------------- */
.sf-btn { background: none; border: 0; color: #666; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.sf-btn:hover { background: rgba(0,0,0,0.07); color: #222; }
.safari-view { flex: 1; position: relative; display: flex; min-height: 0; }
.safari-view > [hidden] { display: none !important; }
.sf-start { flex: 1; overflow-y: auto; padding: 32px 36px; background: linear-gradient(#f6f6f8, #ececf0); color: #1d1d1f; }
.sf-start h2 { margin: 0 0 18px; font-size: 20px; font-weight: 700; }
.sf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 18px 12px; }
.sf-fav { display: flex; flex-direction: column; align-items: center; gap: 7px; background: none; border: 0; cursor: pointer; font: 12px var(--system-font); color: #1d1d1f; padding: 4px; border-radius: 10px; }
.sf-fav:hover { background: rgba(0,0,0,0.05); }
.sf-fav img, .sf-fa { width: 58px; height: 58px; border-radius: 13px; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.sf-fa { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 28px; }
.sf-blocked { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 30px; text-align: center; color: #444; background: #f6f6f8; }
.sf-blocked i { font-size: 38px; color: #999; }
.sf-blocked h3 { margin: 8px 0 0; color: #1d1d1f; }
.sf-blocked p { margin: 0 0 10px; max-width: 360px; font-size: 13px; }

/* --- Mail compose -------------------------------------------------------- */
.mail-app { display: flex; flex-direction: column; height: 100%; box-sizing: border-box; color: var(--text-color); font-size: 13px; }
.mail-row { display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-bottom: 1px solid rgba(128,128,128,0.25); }
.mail-row label { opacity: 0.55; min-width: 56px; }
.mail-row input { flex: 1; background: none; border: 0; outline: none; color: inherit; font: inherit; }
.mail-chip { background: rgba(10,132,255,0.18); color: var(--accent); padding: 2px 8px; border-radius: 10px; }
#mail-body { flex: 1; resize: none; border: 0; outline: none; padding: 14px 16px; background: none; color: inherit; font: 14px/1.5 var(--system-font); }
.mail-actions { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid rgba(128,128,128,0.25); }
.mail-hint { flex: 1; opacity: 0.5; font-size: 12px; }

/* --- Xcode --------------------------------------------------------------- */
.xcode-app { display: flex; flex-direction: column; height: 100%; background: #1f1f24; color: #dfdfe0; font-size: 12px; }
.xc-loading { margin: auto; font-size: 22px; opacity: 0.6; }
.xc-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #2b2b30; border-bottom: 1px solid #111; }
.xc-run, .xc-stop { width: 30px; height: 26px; border-radius: 6px; border: 0; background: none; color: #dfdfe0; cursor: pointer; font-size: 13px; }
.xc-run:not(:disabled):hover, .xc-stop:not(:disabled):hover { background: rgba(255,255,255,0.1); }
.xc-run:disabled, .xc-stop:disabled { opacity: 0.35; cursor: default; }
.xc-scheme { background: rgba(255,255,255,0.08); padding: 4px 10px; border-radius: 6px; }
.xc-scheme i { font-size: 9px; opacity: 0.6; margin: 0 4px; }
.xc-status { flex: 1; text-align: center; background: rgba(0,0,0,0.25); padding: 4px 10px; border-radius: 6px; opacity: 0.85; margin-left: 12px; }
.xc-status .fa-circle-check { color: #32d74b; }
.xc-body { flex: 1; display: flex; min-height: 0; }
.xc-nav { width: 220px; flex-shrink: 0; background: #26262b; border-right: 1px solid #111; padding: 10px 6px; overflow-y: auto; }
.xc-proj { font-weight: 600; padding: 6px 8px 4px; opacity: 0.9; }
.xc-proj i { color: #64a8ff; margin-right: 4px; }
.xc-file { display: block; width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; padding: 4px 8px 4px 24px; border-radius: 5px; cursor: pointer; }
.xc-file i, .xc-tab i { color: #f05138; margin-right: 4px; }
.xc-file:hover { background: rgba(255,255,255,0.06); }
.xc-file.active { background: #0a5fd8; color: #fff; }
.xc-file.active i { color: #fff; }
.xc-note { font-size: 11px; opacity: 0.5; padding: 10px 8px; margin: 0; }
.xc-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.xc-tab { padding: 6px 12px; background: #2b2b30; border-bottom: 1px solid #111; font-size: 11.5px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xc-editor { flex: 1; display: flex; overflow: auto; font: 12.5px/1.6 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; outline: none; }
.xc-gutter { white-space: pre; text-align: right; padding: 12px 10px 12px 14px; color: #6c6c72; user-select: none; position: sticky; left: 0; background: #1f1f24; }
.xc-code { margin: 0; padding: 12px 16px 12px 4px; font: inherit; color: #dfdfe0; white-space: pre; tab-size: 4; }
.sw-k { color: #fc5fa3; font-weight: 600; }
.sw-t { color: #5dd8ff; }
.sw-s { color: #fc6a5d; }
.sw-n { color: #d0bf69; }
.sw-c { color: #6c7986; }
.sw-a { color: #fd8f3f; }
.xc-console { height: 130px; flex-shrink: 0; overflow-y: auto; background: #18181c; border-top: 1px solid #111; padding: 8px 12px; font: 11.5px/1.6 Menlo, Consolas, monospace; color: #b8b8bd; }
.xc-console .xc-ok { color: #32d74b; font-weight: 600; }
@media (max-width: 768px) { .xc-nav { width: 140px; } .xc-scheme { display: none; } }

/* --- Sad Mac easter egg -------------------------------------------------- */
#sad-mac { position: fixed; inset: 0; z-index: 100001; background: #000; color: #ddd; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 24px; cursor: pointer; animation: fxFadeIn 0.6s; outline: none; }
#sad-mac img { width: 120px; image-rendering: pixelated; margin-bottom: 18px; }
#sad-mac .sm-title { font-size: 18px; margin: 0; }
#sad-mac .sm-body { font-size: 13px; opacity: 0.6; margin: 0; }

/* --- Safari bookmarks bar ------------------------------------------------ */
.sf-favbar { display: flex; gap: 2px; padding: 3px 8px; background: #f0f0f0; border-bottom: 1px solid #ccc; overflow-x: auto; scrollbar-width: none; color: #333; }
.sf-favbar::-webkit-scrollbar { display: none; }
.sf-mark { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; border: 0; background: none; color: inherit; font: 12px var(--system-font); padding: 3px 8px; border-radius: 5px; cursor: pointer; }
.sf-mark:hover { background: rgba(0,0,0,0.08); }
.sf-mark i { font-size: 13px; width: 14px; text-align: center; }
.sf-mark img { width: 18px; height: 18px; margin: -2px; }
