/* ============================================================
   ACCENT COLOR DEFAULT
   ============================================================ */
:root {
  --accent-color: #e95420;
}

/* ============================================================
   FONT SIZE SCALING
   ============================================================ */
body.font-small .desktop-window,
body.font-small #top-panel,
body.font-small #dock,
body.font-small .context-menu,
body.font-small #activities-overlay { zoom: 0.88; }

body.font-large .desktop-window,
body.font-large #top-panel,
body.font-large #dock,
body.font-large .context-menu,
body.font-large #activities-overlay { zoom: 1.15; }

/* ============================================================
   TOP PANEL
   ============================================================ */
#top-panel {
  grid-area: panel;
  background: #1a1a1a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 400;
  z-index: 200;
  user-select: none;
  -webkit-user-select: none;
}

#activities-btn {
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
#activities-btn:hover {
  background: rgba(255,255,255,0.12);
}

#panel-clock {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 500;
  cursor: default;
}

#system-tray {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
#system-tray:hover {
  background: rgba(255,255,255,0.12);
}

.tray-icon {
  width: 16px;
  height: 16px;
  fill: #fff;
  opacity: 0.9;
}

/* ============================================================
   DOCK / SIDEBAR
   ============================================================ */
#dock {
  grid-area: dock;
  background: rgba(0,0,0,0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 4px;
  z-index: 150;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.dock-icon {
  width: 50px;
  height: 50px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dock-icon:hover {
  background: rgba(255,255,255,0.12);
  transform: scale(1.12);
}
.dock-icon svg {
  width: 34px;
  height: 34px;
}

/* Active indicator dot */
.dock-icon.active::after {
  content: '';
  position: absolute;
  left: -3px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--accent-color);
  border-radius: 50%;
}

/* Hide non-pinned dock icons unless the app is open (active) */
.dock-icon:not([data-pinned]):not(.active):not(#dock-show-apps) {
  display: none;
}

/* Show Apps button stays at bottom */
#dock-show-apps {
  margin-top: auto;
}

.dock-separator {
  width: 32px;
  height: 1px;
  background: rgba(255,255,255,0.15);
  margin: 4px 0;
}

/* ============================================================
   DESKTOP AREA
   ============================================================ */
#desktop-area {
  grid-area: desktop;
  position: relative;
  overflow: hidden;
  /* Default wallpaper */
  background: url('../assets/wallpapers/noble-numbat.jpg') center/cover no-repeat;
}

/* ============================================================
   RIGHT-CLICK CONTEXT MENU
   ============================================================ */
.context-menu {
  position: absolute;
  background: #3d3d3d;
  border: 1px solid #555;
  border-radius: 10px;
  padding: 6px 0;
  min-width: 220px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  z-index: 500;
  font-size: 13px;
  color: #eee;
  overflow: hidden;
}
.context-menu.hidden { display: none; }

.context-item {
  padding: 7px 18px;
  cursor: pointer;
  transition: background 0.1s;
}
.context-item:hover {
  background: var(--accent-color);
}

.context-separator {
  height: 1px;
  background: #555;
  margin: 4px 0;
}

/* ============================================================
   DESKTOP WINDOW (shared frame styles)
   ============================================================ */
.desktop-window {
  position: absolute;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}
.desktop-window:focus-within {
  box-shadow: 0 12px 48px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.1);
}
.desktop-window.minimized { display: none; }
.desktop-window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
}

/* --- GNOME-style Title Bar Buttons --- */
.title-buttons {
  display: flex;
  gap: 0;
  flex-shrink: 0;
}
.title-btn {
  width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #aaa;
  transition: background 0.12s, color 0.12s;
}
.title-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.btn-close:hover,
.profile-btn-close:hover {
  background: var(--accent-color);
  color: #fff;
}

/* --- Resize handles (all windows) --- */
[id$="-resize-handle"],
#resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 20;
}

/* ============================================================
   TERMINAL WINDOW (sizing)
   ============================================================ */
#terminal-window {
  top: 30px;
  left: 40px;
  width: 800px;
  height: 520px;
  min-width: 400px;
  min-height: 250px;
  z-index: 10;
  /* Needed for absolute-positioned nano/vim editors inside */
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  #ubuntu-desktop {
    grid-template-columns: 56px 1fr;
  }
  #dock {
    padding: 4px 0;
  }
  .dock-icon {
    width: 36px;
    height: 36px;
    padding: 4px;
  }
  .dock-icon svg {
    width: 24px;
    height: 24px;
  }
  #terminal-window,
  #profile-window {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
  }
  #terminal { font-size: 12px; padding: 6px 8px; }
  #input { font-size: 12px; }
  #title-bar { font-size: 11px; }
}

/* ============================================================
   LIGHT THEME
   ============================================================ */
body.light-theme #top-panel {
  background: #e8e8e8;
  color: #333;
}

body.light-theme #activities-btn:hover {
  background: rgba(0,0,0,0.08);
}

body.light-theme .tray-icon {
  fill: #333;
}

body.light-theme #dock {
  background: rgba(240,240,240,0.92);
}

body.light-theme .dock-icon:hover {
  background: rgba(0,0,0,0.08);
}

body.light-theme .desktop-window {
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

body.light-theme .context-menu {
  background: #f5f5f5;
  color: #333;
  border-color: #ccc;
}

body.light-theme .context-item:hover {
  background: rgba(0,0,0,0.06);
}

/* Window headers — all apps */
body.light-theme #title-bar,
body.light-theme #settings-header,
body.light-theme #files-header,
body.light-theme #browser-header,
body.light-theme #profile-header,
body.light-theme #calculator-header,
body.light-theme #calendar-header,
body.light-theme #weather-header,
body.light-theme #monitor-header,
body.light-theme #music-header,
body.light-theme #snake-header,
body.light-theme #imageviewer-header,
body.light-theme #pdf-header,
body.light-theme #photobooth-header,
body.light-theme #notepad-header {
  background: #e0e0e0;
  color: #333;
}

body.light-theme .title-btn {
  color: #555;
}

/* Terminal */
body.light-theme #terminal {
  background: #f8f8f8;
  color: #333;
}

body.light-theme #terminal-window {
  --bg: #f8f8f8;
  --fg: #333;
}

/* Files */
body.light-theme #files-body {
  background: #fafafa;
}

body.light-theme #files-sidebar {
  background: #f0f0f0;
  border-right-color: #ddd;
}

body.light-theme .files-place {
  color: #444;
}

body.light-theme .files-place:hover {
  background: rgba(0,0,0,0.06);
}

body.light-theme #files-content {
  background: #fff;
  color: #333;
}

body.light-theme #files-statusbar {
  background: #f0f0f0;
  color: #555;
}

/* Browser */
body.light-theme #browser-urlbar {
  background: #f0f0f0;
}

body.light-theme #browser-url-input {
  background: #fff;
  color: #333;
  border-color: #ccc;
}

body.light-theme #browser-bookmarks {
  background: #f5f5f5;
  border-bottom-color: #ddd;
}

body.light-theme #browser-content {
  background: #fff;
}

body.light-theme #browser-landing {
  background: #fafafa;
  color: #333;
}

/* Profile */
body.light-theme #profile-body {
  background: #fafafa;
}

body.light-theme #profile-sidebar {
  background: #f0f0f0;
  border-right-color: #ddd;
}

body.light-theme .profile-nav-item {
  color: #555;
}

body.light-theme .profile-nav-item:hover {
  background: rgba(0,0,0,0.05);
}

body.light-theme #profile-content {
  background: #fff;
  color: #333;
}

body.light-theme .profile-card {
  background: #f5f5f5;
  color: #333;
}

/* Calculator */
body.light-theme #calc-display {
  background: #f5f5f5;
  color: #333;
}

body.light-theme #calc-buttons .calc-btn {
  background: #e8e8e8;
  color: #333;
}

body.light-theme #calculator-window {
  background: #f0f0f0;
}

/* Calendar */
body.light-theme #calendar-window {
  background: #fff;
  color: #333;
}

body.light-theme #cal-grid {
  background: #fff;
  color: #333;
}

body.light-theme .cal-day:hover {
  background: rgba(0,0,0,0.06);
}

/* Weather */
body.light-theme #weather-window {
  background: #f5f5f5;
  color: #333;
}

body.light-theme #weather-main {
  color: #333;
}

/* Monitor */
body.light-theme #monitor-body {
  background: #fafafa;
  color: #333;
}

body.light-theme .monitor-tab {
  color: #555;
}

body.light-theme .monitor-tab.active {
  color: #333;
}

body.light-theme .monitor-bar {
  background: #ddd;
}

/* Music */
body.light-theme #music-window {
  background: #f5f5f5;
  color: #333;
}

body.light-theme #music-playlist {
  background: #fff;
}

body.light-theme .music-track {
  color: #333;
}

body.light-theme .music-track:hover {
  background: rgba(0,0,0,0.04);
}

/* Snake */
body.light-theme #snake-window {
  background: #f0f0f0;
  color: #333;
}

/* Notepad */
body.light-theme #notepad-body {
  background: #fff;
  color: #333;
}

body.light-theme #notepad-textarea {
  background: #fff;
  color: #333;
}

/* Image Viewer */
body.light-theme #imageviewer-toolbar {
  background: #e8e8e8;
}

body.light-theme #imageviewer-display {
  background: #f0f0f0;
}

body.light-theme .iv-tool-btn {
  color: #444;
}

/* PDF Viewer */
body.light-theme #pdf-toolbar {
  background: #e8e8e8;
}

body.light-theme #pdf-content {
  background: #f0f0f0;
}

/* Photo Booth */
body.light-theme #photobooth-window {
  background: #f0f0f0;
}

body.light-theme #photobooth-controls {
  background: #e8e8e8;
}

/* Activities overlay */
body.light-theme #activities-overlay {
  background: rgba(240,240,240,0.95);
}

body.light-theme .activities-app-name {
  color: #333;
}

body.light-theme #activities-search {
  background: #fff;
  color: #333;
  border-color: #ccc;
}

/* ============================================================
   DOCK BOTTOM POSITION
   ============================================================ */
#ubuntu-desktop.dock-bottom {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "panel"
    "desktop"
    "dock";
}

#ubuntu-desktop.dock-bottom #dock {
  flex-direction: row;
  width: 100%;
  height: auto;
  padding: 4px 8px;
  border-radius: 0;
  justify-content: center;
  gap: 4px;
}

#ubuntu-desktop.dock-bottom .dock-separator {
  width: 1px;
  height: 32px;
  margin: 0 4px;
}

#ubuntu-desktop.dock-bottom #dock-show-apps {
  margin-top: 0;
  margin-left: auto;
}

/* ============================================================
   DISABLE ANIMATIONS
   ============================================================ */
body.no-animations,
body.no-animations *,
body.no-animations *::before,
body.no-animations *::after {
  animation-duration: 0s !important;
  transition-duration: 0s !important;
}
