/* Kurt OS Fluent Design Style Sheet */

/* Variables */
:root {
  --bg-color: #f3f4f6;
  --text-color: #1f2937;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
  --win-bg: #ffffff;
  --win-border: rgba(0, 0, 0, 0.1);
  --win-header-bg: #f3f4f6;
  --win-header-text: #1f2937;
  --accent-color: #0078d4;
  --accent-hover: #106ebe;
  --taskbar-bg: rgba(243, 244, 246, 0.8);
  --start-bg: rgba(255, 255, 255, 0.85);
  --active-indicator: #0078d4;
  
  /* Fonts */
  --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

.dark {
  --bg-color: #0f172a;
  --text-color: #f1f5f9;
  --glass-bg: rgba(15, 23, 42, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --win-bg: #1e293b;
  --win-border: rgba(255, 255, 255, 0.1);
  --win-header-bg: #0f172a;
  --win-header-text: #f1f5f9;
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --taskbar-bg: rgba(15, 23, 42, 0.85);
  --start-bg: rgba(30, 41, 59, 0.9);
  --active-indicator: #3b82f6;
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--bg-color);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 100, 100, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 100, 100, 0.4);
}

/* Glassmorphism */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(125%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* Boot Screen */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #0b0f19;
  color: #ffffff;
  transition: opacity 0.8s ease-in-out;
}
#boot-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}
.boot-logo {
  font-size: 5rem;
  color: #3b82f6;
  filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.5));
  margin-bottom: 2rem;
  animation: float 3s ease-in-out infinite;
}
.boot-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Desktop Setup */
#desktop {
  position: relative;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  display: flex;
  flex-direction: column;
}
#desktop.fade-in {
  opacity: 1;
}

#desktop-icons {
  flex: 1;
  padding: 1.5rem;
  display: grid;
  grid-template-rows: repeat(auto-fill, 90px);
  grid-auto-flow: column;
  justify-content: start;
  gap: 1.25rem;
  z-index: 10;
}
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 86px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.2s, border 0.2s;
  border: 1px solid transparent;
}
.desktop-icon:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.1);
}
.dark .desktop-icon:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.05);
}
.desktop-icon i {
  font-size: 2.25rem;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.desktop-icon span {
  font-size: 0.75rem;
  color: #ffffff;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  line-height: 1.2;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Taskbar */
#taskbar {
  height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 1000;
  transition: background-color 0.3s;
}

/* Center aligned taskbar option */
#taskbar.center-aligned #taskbar-center-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
}
#taskbar.center-aligned #start-btn {
  margin-right: 4px;
}

#taskbar-left {
  display: flex;
  align-items: center;
}
#taskbar-apps {
  display: flex;
  align-items: center;
  gap: 6px;
}
.taskbar-item {
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-color);
  transition: all 0.2s;
  position: relative;
  padding: 0 8px;
  gap: 8px;
}
.external-home-btn {
  text-decoration: none;
}
.taskbar-item:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.15);
}
.dark .taskbar-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.05);
}
.taskbar-item i {
  font-size: 1.5rem;
}
.taskbar-item.active {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}
.dark .taskbar-item.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.1);
}
.taskbar-item.running::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 3px;
  background: var(--active-indicator);
  border-radius: 2px;
  transition: width 0.2s;
}
.taskbar-item.active.running::after {
  width: 14px;
}

#taskbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tray-icon {
  font-size: 1.1rem;
  opacity: 0.8;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
}
.tray-icon:hover {
  background: rgba(255, 255, 255, 0.15);
}
#clock {
  font-size: 0.75rem;
  font-weight: 500;
  text-align: right;
  line-height: 1.3;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
#clock:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Start Button */
#start-btn {
  background: transparent;
  color: var(--accent-color);
  font-size: 1.4rem;
  transition: transform 0.2s;
}
#start-btn:hover {
  transform: scale(1.15);
}
#start-btn:active {
  transform: scale(0.95);
}

/* Start Menu */
#start-menu {
  position: absolute;
  bottom: 58px;
  left: 12px;
  width: 520px;
  height: 600px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.2s;
}
#start-menu.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
#taskbar.center-aligned ~ #start-menu {
  left: 50%;
  transform: translate(-50%, 20px);
}
#taskbar.center-aligned ~ #start-menu.open {
  transform: translate(-50%, 0);
}

/* Start Menu Header / Search */
.start-search-container {
  padding: 24px 24px 16px 24px;
}
.start-search {
  width: 100%;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  outline: none;
  font-size: 0.85rem;
  color: var(--text-color);
  transition: all 0.2s;
}
.dark .start-search {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.05);
}
.start-search:focus {
  background: #ffffff;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.dark .start-search:focus {
  background: #1e293b;
}

/* Start Menu Apps Grid */
.start-pinned-section {
  flex: 1;
  padding: 0 24px 12px 24px;
  overflow-y: auto;
}
.start-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
  opacity: 0.8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.start-section-title button {
  background: transparent;
  border: none;
  color: var(--accent-color);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}
.start-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.start-app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.start-app-item:hover {
  background: rgba(255, 255, 255, 0.2);
}
.dark .start-app-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.start-app-item i {
  font-size: 1.8rem;
  margin-bottom: 6px;
}
.start-app-item span {
  font-size: 0.7rem;
  font-weight: 500;
  text-align: center;
}

/* Start Menu Footer */
.start-footer {
  height: 64px;
  background: rgba(0, 0, 0, 0.05);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.dark .start-footer {
  background: rgba(0, 0, 0, 0.2);
  border-top-color: rgba(255, 255, 255, 0.05);
}
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.power-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-color);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s;
}
.power-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.dark .power-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Windows Container */
#windows-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

/* Window Element styling */
.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background-color: var(--win-bg);
  border: 1px solid var(--win-border);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.15s;
}
.window.active-win {
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
  border-color: rgba(59, 130, 246, 0.3);
}
.window.open-animation {
  opacity: 1;
  transform: scale(1);
}
.window.minimized {
  pointer-events: none;
  opacity: 0;
  transform: scale(0.7) translateY(200px);
}
.window.maximized {
  border-radius: 0 !important;
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: calc(100vh - 48px) !important;
  box-shadow: none !important;
}

/* Window Header */
.window-header {
  height: 36px;
  background: var(--win-header-bg);
  color: var(--win-header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: default;
  border-bottom: 1px solid var(--win-border);
  flex-shrink: 0;
}
.window.active-win .window-header {
  background: var(--win-bg);
}
.window-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.window-title i {
  font-size: 1.1rem;
}
.window-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.win-btn {
  width: 28px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 0.75rem;
}
.win-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}
.dark .win-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.win-btn.close:hover {
  background: #e81123 !important;
  color: #ffffff !important;
}

/* Window Content Body */
.window-content {
  flex: 1;
  overflow: hidden;
  background-color: var(--win-bg);
  position: relative;
}

/* Resizing Handles */
.resize-handle {
  position: absolute;
  z-index: 999;
}
.resize-n  { top: 0; left: 4px; right: 4px; height: 4px; cursor: n-resize; }
.resize-s  { bottom: 0; left: 4px; right: 4px; height: 4px; cursor: s-resize; }
.resize-e  { top: 4px; bottom: 4px; right: 0; width: 4px; cursor: e-resize; }
.resize-w  { top: 4px; bottom: 4px; left: 0; width: 4px; cursor: w-resize; }
.resize-nw { top: 0; left: 0; width: 6px; height: 6px; cursor: nw-resize; }
.resize-ne { top: 0; right: 0; width: 6px; height: 6px; cursor: ne-resize; }
.resize-sw { bottom: 0; left: 0; width: 6px; height: 6px; cursor: sw-resize; }
.resize-se { bottom: 0; right: 0; width: 6px; height: 6px; cursor: se-resize; }

/* Context Menu */
#context-menu {
  position: absolute;
  z-index: 9999;
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  padding: 4px 0;
  min-width: 160px;
  display: none;
  font-size: 0.8rem;
}
.context-item {
  padding: 6px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-color);
}
.context-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent-color);
}
.dark .context-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.context-separator {
  height: 1px;
  background: var(--win-border);
  margin: 4px 0;
}

/* ==========================================================================
   APP SPECIFIC STYLES
   ========================================================================== */

/* File Explorer */
.explorer-layout {
  display: flex;
  height: 100%;
}
.explorer-sidebar {
  width: 160px;
  border-right: 1px solid var(--win-border);
  background: var(--win-header-bg);
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-color);
}
.sidebar-link:hover {
  background: rgba(0, 0, 0, 0.05);
}
.dark .sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
}
.sidebar-link.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-color);
}
.explorer-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.explorer-toolbar {
  height: 36px;
  border-bottom: 1px solid var(--win-border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  background: var(--win-header-bg);
}
.toolbar-btn {
  background: transparent;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.toolbar-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}
.dark .toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.toolbar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.explorer-address-bar {
  flex: 1;
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  border-radius: 4px;
  font-size: 0.75rem;
  padding: 2px 8px;
  outline: none;
  color: var(--text-color);
}
.explorer-grid {
  flex: 1;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  grid-auto-rows: 90px;
  gap: 12px;
  overflow-y: auto;
  align-content: start;
}
.explorer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
}
.explorer-item:hover {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(59, 130, 246, 0.15);
}
.explorer-item.selected {
  background: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
}
.explorer-item i {
  font-size: 2.2rem;
  margin-bottom: 4px;
}
.explorer-item span {
  font-size: 0.7rem;
  font-weight: 500;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.explorer-item.folder i { color: #f59e0b; }
.explorer-item.file i { color: #3b82f6; }
.explorer-statusbar {
  height: 24px;
  border-top: 1px solid var(--win-border);
  background: var(--win-header-bg);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  padding: 0 12px;
  opacity: 0.8;
}

/* Notepad */
.notepad-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.notepad-menu {
  height: 26px;
  background: var(--win-header-bg);
  border-bottom: 1px solid var(--win-border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 16px;
  font-size: 0.75rem;
}
.notepad-menu-item {
  cursor: pointer;
  position: relative;
}
.notepad-dropdown {
  position: absolute;
  top: 20px;
  left: 0;
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-radius: 4px;
  z-index: 10;
  display: none;
  min-width: 100px;
}
.notepad-dropdown div {
  padding: 6px 12px;
  cursor: pointer;
}
.notepad-dropdown div:hover {
  background: rgba(0, 0, 0, 0.05);
}
.dark .notepad-dropdown div:hover {
  background: rgba(255, 255, 255, 0.08);
}
.notepad-text {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 10px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  background: var(--win-bg);
  color: var(--text-color);
}

/* Browser */
.browser-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.browser-navbar {
  height: 38px;
  background: var(--win-header-bg);
  border-bottom: 1px solid var(--win-border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
}
.browser-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px 6px;
  border-radius: 4px;
}
.browser-nav-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}
.dark .browser-nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.browser-url-input {
  flex: 1;
  border: 1px solid var(--win-border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.75rem;
  outline: none;
  background: var(--win-bg);
  color: var(--text-color);
}
.browser-viewport {
  flex: 1;
  background: #ffffff;
  position: relative;
}
.browser-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.browser-mock {
  padding: 24px;
  font-size: 0.85rem;
  color: #333333;
  overflow-y: auto;
  height: 100%;
  background: #ffffff;
}

/* Calculator */
.calc-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  gap: 8px;
}
.calc-display {
  height: 56px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--win-border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  padding: 0 12px;
}
.calc-expr {
  font-size: 0.7rem;
  opacity: 0.6;
  font-family: monospace;
}
.calc-value {
  font-size: 1.6rem;
  font-weight: 500;
  font-family: monospace;
}
.calc-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.calc-btn {
  border: 1px solid var(--win-border);
  border-radius: 4px;
  background: var(--win-header-bg);
  color: var(--text-color);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}
.calc-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}
.dark .calc-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.calc-btn.accent {
  background: var(--accent-color);
  color: #ffffff;
  border-color: transparent;
}
.calc-btn.accent:hover {
  background: var(--accent-hover);
}

/* Paint */
.paint-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.paint-toolbar {
  height: 40px;
  background: var(--win-header-bg);
  border-bottom: 1px solid var(--win-border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 12px;
}
.paint-canvas-container {
  flex: 1;
  overflow: auto;
  background: #f0f0f0;
  position: relative;
}
.paint-canvas {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: block;
  margin: 10px auto;
  cursor: crosshair;
}
.paint-tool {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.paint-tool.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-color);
  color: var(--accent-color);
}
.paint-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
}
.paint-color.active {
  border-color: #000;
  transform: scale(1.15);
}
.dark .paint-color.active {
  border-color: #fff;
}

/* Terminal */
.term-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0c0c0c;
  color: #00ff00;
  font-family: 'Consolas', 'Courier New', monospace;
  padding: 8px;
  font-size: 0.8rem;
}
.term-output {
  flex: 1;
  overflow-y: auto;
}
.term-line {
  margin-bottom: 4px;
  white-space: pre-wrap;
  line-height: 1.4;
}
.term-input-line {
  display: flex;
  align-items: center;
  margin-top: 4px;
}
.term-prompt {
  color: #3b82f6;
  margin-right: 8px;
}
.term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #00ff00;
  font-family: inherit;
  font-size: inherit;
}
.term-matrix {
  position: absolute;
  inset: 0;
  background: #000000;
  z-index: 10;
  overflow: hidden;
  display: none;
}

/* Calendar */
.cal-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
  gap: 12px;
}
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.cal-day-label {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.6;
  padding: 6px 0;
}
.cal-day {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  position: relative;
}
.cal-day:hover {
  background: rgba(0, 0, 0, 0.05);
}
.dark .cal-day:hover {
  background: rgba(255, 255, 255, 0.08);
}
.cal-day.today {
  background: var(--accent-color);
  color: #ffffff;
  font-weight: 700;
}
.cal-day.selected {
  border: 2px solid var(--accent-color);
}
.cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  background: #ef4444;
  border-radius: 50%;
}
.cal-day.today.has-event::after {
  background: #ffffff;
}
.cal-agenda {
  flex: 1;
  border-top: 1px solid var(--win-border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: 6px;
}
.agenda-title {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.agenda-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agenda-item {
  background: var(--win-header-bg);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Messenger */
.msg-layout {
  display: flex;
  height: 100%;
}
.msg-sidebar {
  width: 180px;
  border-right: 1px solid var(--win-border);
  background: var(--win-header-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.msg-contact {
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-left: 3px solid transparent;
}
.msg-contact:hover {
  background: rgba(0, 0, 0, 0.04);
}
.dark .msg-contact:hover {
  background: rgba(255, 255, 255, 0.05);
}
.msg-contact.active {
  background: rgba(59, 130, 246, 0.08);
  border-left-color: var(--accent-color);
}
.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
}
.msg-contact-info {
  flex: 1;
  min-width: 0;
}
.msg-contact-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-contact-status,
.msg-header-status {
  font-size: 0.65rem;
  line-height: 1.2;
}
.msg-contact-status.online,
.msg-header-status.online {
  color: #10b981;
}
.msg-contact-status.checking,
.msg-header-status.checking {
  color: #f59e0b;
}
.msg-contact-status.offline,
.msg-header-status.offline {
  color: #ef4444;
}
.msg-contact-preview {
  font-size: 0.65rem;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.msg-header {
  height: 40px;
  border-bottom: 1px solid var(--win-border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  gap: 8px;
}
.msg-history {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  line-height: 1.4;
}
.msg-bubble.user {
  background: var(--accent-color);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}
.msg-bubble.partner {
  background: var(--win-header-bg);
  color: var(--text-color);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  border: 1px solid var(--win-border);
}
.msg-input-area {
  height: 48px;
  border-top: 1px solid var(--win-border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
}
.msg-input {
  flex: 1;
  border: 1px solid var(--win-border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.75rem;
  outline: none;
  background: var(--win-bg);
  color: var(--text-color);
}
.msg-send-btn {
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Settings */
.settings-layout {
  display: flex;
  height: 100%;
}
.settings-sidebar {
  width: 140px;
  border-right: 1px solid var(--win-border);
  background: var(--win-header-bg);
  padding: 10px 4px;
  flex-shrink: 0;
}
.settings-tab-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-color);
  font-weight: 500;
}
.settings-tab-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}
.dark .settings-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}
.settings-tab-btn.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-color);
}
.settings-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}
.settings-group {
  margin-bottom: 16px;
}
.settings-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--win-border);
}
.settings-row-label {
  font-size: 0.75rem;
}
.settings-row-desc {
  font-size: 0.65rem;
  opacity: 0.6;
}
.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.wallpaper-preview {
  height: 48px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  background-size: cover;
  background-position: center;
}
.wallpaper-preview.active {
  border-color: var(--accent-color);
}

/* Toggle Switch Control */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  transition: .25s;
  border-radius: 20px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent-color);
}
input:checked + .slider:before {
  transform: translateX(18px);
}

/* ==========================================================================
   GAMES LAYOUTS
   ========================================================================== */

/* Game Snake Container styling */
.game-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #0f172a;
}
.game-stats {
  height: 36px;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.game-board-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 10;
  gap: 12px;
}
.game-overlay h2 {
  font-size: 1.8rem;
}
.game-overlay button {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

/* 2048 Game Styling */
.g2048-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #faf8ef;
  color: #776e65;
  padding: 12px;
  gap: 8px;
}
.dark .g2048-layout {
  background: #1e293b;
  color: #f1f5f9;
}
.g2048-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.g2048-title {
  font-size: 1.6rem;
  font-weight: 700;
}
.g2048-scores {
  display: flex;
  gap: 6px;
}
.g2048-score-box {
  background: #bbada0;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
  min-width: 60px;
}
.g2048-score-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.8;
}
.g2048-score-val {
  font-size: 0.95rem;
  font-weight: 700;
}
.g2048-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.g2048-restart {
  background: #8f7a66;
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}
.g2048-board {
  flex: 1;
  background: #bbada0;
  border-radius: 6px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 6px;
  position: relative;
}
.dark .g2048-board {
  background: #334155;
}
.g2048-cell {
  background: rgba(238, 228, 218, 0.35);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #776e65;
  transition: transform 0.1s;
}
.dark .g2048-cell {
  background: rgba(255, 255, 255, 0.05);
}

/* 2048 Tile Colors */
.tile-2    { background: #eee4da; }
.tile-4    { background: #ede0c8; }
.tile-8    { background: #f2b179; color: #f9f6f2; }
.tile-16   { background: #f59563; color: #f9f6f2; }
.tile-32   { background: #f67c5f; color: #f9f6f2; }
.tile-64   { background: #f65e3b; color: #f9f6f2; }
.tile-128  { background: #edcf72; color: #f9f6f2; font-size: 1.1rem; }
.tile-256  { background: #edcc61; color: #f9f6f2; font-size: 1.1rem; }
.tile-512  { background: #edc850; color: #f9f6f2; font-size: 1.1rem; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 0.9rem; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 0.9rem; }

/* Tetris Game Styling */
.tetris-layout {
  display: flex;
  height: 100%;
  background: #111827;
  color: #ffffff;
}
.tetris-board-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.tetris-canvas {
  background: #030712;
  border: 2px solid #374151;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.tetris-sidebar {
  width: 110px;
  background: #1f2937;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-left: 1px solid #374151;
}
.tetris-sidebar-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tetris-sidebar-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  color: #9ca3af;
  font-weight: 700;
}
.tetris-sidebar-val {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: monospace;
}
.tetris-preview-canvas {
  background: #030712;
  border: 1px solid #374151;
  width: 80px;
  height: 80px;
}

/* Animations */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
