/* ============================================
   CSS VARIABLES & BASE STYLES
   ============================================ */
:root {
  --bg-dark: #0b0b0b;
  --bg-light: #ffffff;
  --text-light: #ffffff;
  --text-dark: #000000;
  --primary: #80d0ff;
  
  /* Z-index scale */
  --z-base: 10;
  --z-dropdown: 1000;
  --z-modal: 2000;
  --z-toast: 9999;
  
  /* Common colors as variables */
  --color-error: #f44336;
  --color-success: #4caf50;
  --color-warning: #ff9800;
  --color-info: #4ea8ff;
  
  /* Badge colors */
  --badge-bg: #ff4444;
  --badge-text: #ffffff;
  --unread-bg: #2196f3;
}

* {
  box-sizing: border-box;
  font-family: 'Nunito', sans-serif;
  user-select: none;
}

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-light);
}

/* ============================================
   BOOT & LOGIN SCREEN
   ============================================ */
#boot, #loading, #desktop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#boot {
  display: flex;
  background: var(--bg-dark);
}

#boot h1 {
  color: var(--primary);
  font-weight: 700;
  font-size: 2.4rem;
  margin-bottom: 1em;
}

#loginForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 280px;
}

#loginForm input,
#loginForm button {
  padding: 10px;
  font-size: 16px;
  border-radius: 6px;
  border: none;
  outline-offset: 2px;
  outline-color: var(--primary);
}

#loginForm input {
  background: #222;
  color: var(--text-light);
}

#loginForm button {
  background: var(--primary);
  color: black;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.3s ease;
}

#loginForm button:hover {
  background: #58b5ff;
}

#loginError {
  color: var(--color-error);
  margin-top: 6px;
  font-size: 0.9rem;
  min-height: 1.2em;
  text-align: center;
}

/* Login form labels (hidden visually but accessible) */
.login-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   LOADING SCREEN
   ============================================ */
#loading {
  display: flex;
  background: var(--bg-dark);
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.infinity-spinner {
  width: 100px;
  height: 100px;
  background: url('Icons/Infinity%20Bureau%20Icon%20Final%20Bigger.png') center/contain no-repeat;
  animation: spinPause 4s infinite;
  margin-bottom: 1em;
}

@keyframes spinPause {
  0%, 40%, 100% { transform: rotate(0deg); }
  20%, 60%, 80% { transform: rotate(360deg); }
}

#loading p {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.25rem;
  user-select: none;
}

/* ============================================
   DESKTOP
   ============================================ */
#desktop {
  display: flex;
  flex-direction: column;
  background: url('InfinityOS%20Background.png') center/cover no-repeat;
  height: 100%;
  color: var(--text-light);
  padding-top: 40px;
  padding-bottom: 70px;
  min-height: calc(100vh - 110px);
}

#desktopIcons {
  display: flex;
  gap: 50px;
  padding: 30px;
  flex-wrap: wrap;
  flex-grow: 1;
  align-content: flex-start;
  user-select: none;
}

/* ============================================
   DESKTOP ICONS
   ============================================ */
.icon {
  display: flex;
  flex-direction: column;
  align-items: left;
  cursor: pointer;
  width: 100px;
  color: var(--text-light);
  transition: color 0.3s ease;
  position: relative;
}

.icon:hover {
  color: var(--primary);
}

.icon img {
  width: 90px;
  height: 90px;
  user-select: none;
}

.icon span {
  margin-top: 8px;
  font-weight: 600;
  font-size: 1rem;
}

/* ============================================
   TOP BAR (Ubuntu-style)
   ============================================ */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 40px;
  background: rgba(20, 30, 50, 0.92);
  color: var(--primary);
  display: flex;
  align-items: center;
  z-index: var(--z-dropdown);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.top-bar-left,
.top-bar-center,
.top-bar-right {
  display: flex;
  align-items: center;
  height: 100%;
}

.top-bar-left {
  flex: 1;
  padding-left: 18px;
}

.top-bar-center {
  flex: 2;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1em;
}

.top-bar-right {
  flex: 1;
  justify-content: flex-end;
  gap: 18px;
  padding-right: 18px;
}

.top-bar-menu {
  font-size: 1.3em;
  cursor: pointer;
}

/* ============================================
   BOTTOM DOCK (Ubuntu-style)
   ============================================ */
.bottom-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(20, 30, 50, 0.92);
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  display: flex;
  gap: 18px;
  padding: 8px 18px;
  z-index: var(--z-dropdown);
}

.dock-btn {
  background: none;
  border: none;
  outline: none;
  border-radius: 12px;
  padding: 6px;
  cursor: pointer;
  transition: background 0.18s, box-shadow 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dock-btn img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.dock-btn:hover,
.dock-btn:focus {
  background: var(--primary);
  box-shadow: 0 2px 12px rgba(128,208,255,0.18);
}

/* ============================================
   CLOCK
   ============================================ */
#clock {
  font-weight: 700;
}

/* ============================================
   WINDOWS
   ============================================ */
.window {
  width: 700px;
  height: 500px;
  background: var(--bg-light);
  color: var(--text-dark);
  position: absolute;
  top: 80px;
  left: 100px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  display: none;
  flex-direction: column;
  box-shadow: 0 6px 15px rgba(0,0,0,0.3);
  user-select: text;
  z-index: var(--z-base);
  resize: both;
  overflow: hidden;
  contain: content;
}

#mailWindow {
  width: 900px;
  height: 550px;
  margin-left: 240px;
}

#mailWindow.maximized {
  margin-left: 0;
}

#mailContent {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Window Header */
.window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: #fff;
  padding: 10px;
  cursor: grab;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  user-select: none;
}

.window-header:active {
  cursor: grabbing;
}

/* Window Controls */
.window-controls {
  display: flex;
  gap: 6px;
}

.window-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1.2em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
  outline: none;
}

.window-btn:hover,
.window-btn:focus {
  background: #fff;
  color: var(--primary);
}

.window-btn.close-btn:hover,
.window-btn.close-btn:focus {
  background: var(--color-error);
  color: #fff;
}

/* Window Content */
.window-content {
  padding: 12px;
  flex-grow: 1;
  overflow: auto;
  background: var(--bg-light);
  color: var(--text-dark);
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

/* Resize Handle */
.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, var(--primary) 50%);
  border-radius: 0 0 6px 0;
}

/* Close Button */
.close-btn {
  cursor: pointer;
  font-weight: bold;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0 8px;
  user-select: none;
}

/* ============================================
   BADGES & INDICATORS
   ============================================ */
.badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid var(--bg-dark);
}

.unread-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--unread-bg);
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.new-file-badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  vertical-align: middle;
  margin-right: 4px;
  flex-shrink: 0;
}

.taskbar-btn-wrapper {
  position: relative;
  display: inline-block;
}

/* ============================================
   SPLIT VIEW PANELS
   ============================================ */
.window-split {
  display: flex;
  flex-direction: row;
}

.split-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 200px;
  border-right: 1px solid #ddd;
}

.split-pane:last-child {
  border-right: none;
}

.split-header {
  padding: 8px 12px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
  font-weight: 700;
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
}

.split-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex: 1;
}

.split-item {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 13px;
}

.split-item:hover {
  background-color: #f0f0f0;
}

.split-item.active {
  background-color: #e0e0e0;
  border-left: 3px solid var(--primary);
  padding-left: 9px;
}

.split-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.split-content-area {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

/* ============================================
   SORT BUTTONS
   ============================================ */
.sort-buttons {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
  flex-wrap: wrap;
}

.sort-btn {
  padding: 4px 10px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background-color 0.2s;
  color: #333;
}

.sort-btn:hover {
  background-color: #f0f0f0;
}

.sort-btn.active {
  background: var(--primary);
  color: black;
  border-color: var(--primary);
}

/* ============================================
   FOLDER NAVIGATION
   ============================================ */
.breadcrumb {
  padding: 8px 12px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
  font-size: 13px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.breadcrumb-item {
  cursor: pointer;
  color: var(--primary);
  transition: color 0.2s;
}

.breadcrumb-item:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: #999;
}

.folder-item {
  padding: 10px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-item:hover {
  background-color: #e8f4ff;
}

.folder-icon {
  font-size: 18px;
}

/* ============================================
   FILE VIEW STYLES
   ============================================ */
.view-toggle {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.view-toggle button {
  padding: 4px 8px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background-color 0.2s;
}

.view-toggle button:hover {
  background-color: #f0f0f0;
}

.view-toggle button.active {
  background: var(--primary);
  color: black;
  border-color: var(--primary);
}

/* Icon Grid View */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.file-icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  text-align: center;
}

.file-icon-item:hover {
  background-color: #e8f4ff;
}

.file-icon-item-icon {
  font-size: 48px;
  line-height: 1;
}

.file-icon-item-name {
  font-size: 12px;
  font-weight: 600;
  word-break: break-word;
  color: #333;
  max-width: 100%;
}

/* List View */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.file-list-item {
  padding: 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.file-list-item:hover {
  background-color: #f0f0f0;
}

.file-list-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.file-list-name {
  flex: 1;
}

.files-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ============================================
   MAIL SIDEBAR
   ============================================ */
.mail-sidebar {
  position: fixed;
  left: 0;
  top: 40px;
  width: 240px;
  height: calc(100vh - 40px);
  background: #f9f9f9;
  border-right: 1px solid #ddd;
  z-index: 1000;
  overflow-y: auto;
}

.mail-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #ddd;
  font-weight: 700;
  font-size: 16px;
  color: #333;
}

.mail-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.mail-sidebar-item:hover {
  background-color: #e9e9e9;
}

.mail-sidebar-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.mail-sidebar-item span {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

/* ============================================
   EMAIL ITEM STYLES
   ============================================ */
.email-item {
  padding: 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.email-item:hover {
  background-color: #f5f5f5;
}

.email-item.active {
  background-color: #e3f2fd;
  border-left: 3px solid var(--unread-bg);
}

.email-item.unread {
  background-color: #f0f8ff;
  font-weight: 600;
}

.email-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.email-content {
  flex: 1;
  min-width: 0;
}

.email-subject {
  font-weight: 700;
  font-size: 13px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-date {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.mail-content-header {
  padding: 16px;
  border-bottom: 1px solid #ddd;
  background: #f9f9f9;
}

.mail-content-header-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mail-content-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 13px;
  line-height: 1.6;
  color: #333;
}

/* ============================================
   APP LAUNCHER / MENU
   ============================================ */
.app-launcher {
  position: fixed;
  top: 44px;
  left: 18px;
  background: rgba(20,30,50,0.98);
  color: var(--primary);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  z-index: var(--z-modal);
  min-width: 220px;
}

.app-launcher-content {
  padding: 18px 18px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-launcher-content button {
  background: rgba(255,255,255,0.08);
  color: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 1em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.app-launcher-content button:hover {
  background: var(--primary);
  color: #fff;
}

/* ============================================
   USER MENU
   ============================================ */
.user-menu {
  position: fixed;
  top: 44px;
  right: 18px;
  background: rgba(20,30,50,0.98);
  color: var(--primary);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  z-index: var(--z-modal);
  min-width: 180px;
}

.user-menu-content {
  padding: 16px 16px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-menu-content button {
  background: rgba(255,255,255,0.08);
  color: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.15s;
}

.user-menu-content button:hover {
  background: var(--primary);
  color: #fff;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notifications-center {
  position: fixed;
  top: 44px;
  right: 50%;
  transform: translateX(50%);
  background: rgba(20,30,50,0.98);
  color: var(--primary);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  z-index: var(--z-modal);
  min-width: 320px;
  max-width: 90vw;
  max-height: 60vh;
  overflow-y: auto;
}

.notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  padding: 12px 18px 8px 18px;
  border-bottom: 1px solid var(--primary);
}

#notificationsList {
  padding: 12px 18px;
}

/* Toast Notifications */
.notifications-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast-notification {
  background: rgba(20, 30, 50, 0.95);
  color: #e8f1ff;
  border-left: 3px solid var(--color-info);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  min-width: 280px;
  max-width: 360px;
  pointer-events: auto;
  animation: slideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-notification.success {
  border-left-color: var(--color-success);
}

.toast-notification.error {
  border-left-color: var(--color-error);
}

.toast-notification.warning {
  border-left-color: var(--color-warning);
}

.toast-notification.info {
  border-left-color: var(--color-info);
}

.toast-title {
  font-weight: 700;
  font-size: 0.95em;
  color: #fff;
}

.toast-body {
  font-size: 0.85em;
  color: #b0c4d9;
  line-height: 1.4;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-notification.removing {
  animation: slideIn 0.3s ease-in reverse forwards;
}

/* ============================================
   DESKTOP CONTEXT MENU
   ============================================ */
.desktop-context-menu {
  background: #fff;
  color: #222;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  min-width: 180px;
  font-size: 1em;
  padding: 4px 0;
  z-index: var(--z-modal);
}

.desktop-context-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.desktop-context-menu li {
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.12s;
}

.desktop-context-menu li:hover:not(.disabled) {
  background: var(--primary);
  color: #fff;
}

/* ============================================
   DARK/LIGHT THEME
   ============================================ */
body.light {
  background-color: var(--bg-light);
  color: var(--text-dark);
}

body.light #desktop {
  background: url('TIB Logo v2.5 Final Big Desktop.png') center/cover no-repeat;
  color: var(--text-dark);
}

body.light .window {
  background: var(--bg-light);
  color: var(--text-dark);
  border-color: var(--primary);
}

body.light .window-header {
  background: var(--primary);
  color: black;
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
body.high-contrast {
  background: #000 !important;
  color: #fff !important;
}

.high-contrast .window,
.high-contrast .taskbar,
.high-contrast .start-menu {
  background: #111 !important;
  color: #fff !important;
  border-color: #fff !important;
}

.high-contrast .badge,
.high-contrast .new-file-badge,
.high-contrast .files-badge {
  background: #fff !important;
  color: #000 !important;
  border: 1px solid #000 !important;
}

/* ============================================
   FOCUS / KEYBOARD NAVIGATION
   ============================================ */
button:focus,
.taskbar button:focus,
.start-menu button:focus,
a:focus {
  outline: 2px solid #0078d7;
  outline-offset: 2px;
  background: #e0f0ff;
}

/* ============================================
   EMAIL LIST AVATARS (Mail Content)
   ============================================ */
#mailContent .split-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  transition: background-color 0.2s, border-color 0.2s;
}

#mailContent .split-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

#mailContent .split-item:hover {
  background-color: #f0f8ff;
  border-color: var(--primary);
}

#mailContent .split-item.active {
  background-color: #e0f0ff;
  border-left-color: var(--primary);
}

/* Email action buttons */
#mailContent button[title*="Star"],
#mailContent button[title*="Archive"],
#mailContent button[title*="Delete"] {
  background: #f0f0f0;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

#mailContent button[title*="Star"] {
  background: none;
  font-size: 18px;
  padding: 4px 8px;
}

#mailContent button[title*="Star"]:hover {
  background: rgba(255, 215, 0, 0.1);
}

#mailContent button[title*="Archive"]:hover,
#mailContent button[title*="Delete"]:hover {
  background: #e0e0e0;
}

/* Disabled buttons for restricted users */
#mailContent button[disabled] {
  background: #e0e0e0;
  color: #999;
  cursor: not-allowed;
  opacity: 0.6;
}

#mailContent button[disabled]:hover {
  background: #e0e0e0;
  cursor: not-allowed;
}

/* ============================================
   ADMIN PANEL STYLES
   ============================================ */
.admin-panel {
  width: 800px;
  height: 600px;
}

.admin-content {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #f5f5f5;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 12px;
  background: #eee;
  border-bottom: 1px solid #ddd;
}

.admin-tab {
  padding: 8px 16px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  color: #333;
}

.admin-tab:hover {
  background: #e8f4ff;
}

.admin-tab.active {
  background: var(--primary);
  color: black;
  border-color: var(--primary);
}

.admin-tab-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.admin-section-header h3 {
  margin: 0;
  color: #333;
}

.admin-btn {
  padding: 8px 16px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  color: #333;
}

.admin-btn:hover {
  background: #f0f0f0;
}

.admin-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: black;
}

.admin-btn.primary:hover {
  background: #58b5ff;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.admin-list-item-info {
  flex: 1;
}

.admin-list-item-name {
  font-weight: 700;
  color: #333;
}

.admin-list-item-meta {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

.admin-list-item-actions {
  display: flex;
  gap: 8px;
}

.admin-form {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 16px;
  margin-top: 16px;
}

.admin-form h4 {
  margin: 0 0 16px 0;
  color: #333;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
  font-size: 13px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.admin-export {
  padding: 16px;
  background: #fff9e6;
  border-top: 1px solid #ddd;
  margin-top: auto;
}

.admin-export h3 {
  margin: 0 0 8px 0;
  color: #333;
}

.admin-export p {
  margin: 0 0 12px 0;
  color: #666;
  font-size: 13px;
}

/* ============================================
   PUZZLE WINDOW STYLES
   ============================================ */
.puzzle-content {
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.puzzle-input-group {
  display: flex;
  gap: 10px;
}

.puzzle-input-group input {
  flex: 1;
}

#puzzleAnswer {
  width: 100%;
}

#puzzleResult {
  min-height: 20px;
}

#puzzleResult.correct {
  color: var(--color-success);
}

#puzzleResult.incorrect {
  color: var(--color-error);
}

/* ============================================
   USER PROFILE WINDOW
   ============================================ */
#userProfileWindow .window-content {
  display: flex;
  flex-direction: column;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-username {
  font-weight: 700;
  font-size: 1.2em;
}

.profile-meta {
  color: #888;
  font-size: 1em;
}

/* ============================================
   SETTINGS WINDOW
   ============================================ */
#settingsWindow .window-content h3 {
  margin: 16px 0 8px 0;
}

#settingsWindow .window-content h3:first-child {
  margin-top: 0;
}

.settings-btn {
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.settings-btn.restore {
  background: var(--color-success);
}

/* ============================================
   NOTIFICATIONS ICON
   ============================================ */
.notifications-icon {
  cursor: pointer;
  position: relative;
  margin-left: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notifications-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--unread-bg);
  color: var(--badge-text);
  border-radius: 50%;
  font-size: 0.65em;
  padding: 2px 5px;
  font-weight: 700;
}

/* ============================================
   AVATAR CONTAINER
   ============================================ */
#avatarContainer {
  display: inline-block;
  vertical-align: middle;
  margin-left: 18px;
}

#avatarContainer img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  cursor: pointer;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
  .window {
    width: 95vw;
    height: 80vh;
    left: 2.5vw;
    top: 60px;
  }
  
  #mailWindow {
    width: 95vw;
    margin-left: 0;
  }
  
  .bottom-dock {
    width: 90vw;
    justify-content: center;
  }
}

/* ============================================
   THE BOARD — NOTICE BOARD
   ============================================ */
#boardWindow {
  width: 860px;
  height: 580px;
}

.board-layout {
  display: flex;
  height: 100%;
  background: #0f1117;
  color: #c8d0dc;
  font-family: 'Nunito', sans-serif;
  overflow: hidden;
}

.board-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: #0a0c12;
  border-right: 1px solid rgba(128,208,255,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-sidebar-header {
  padding: 14px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(128,208,255,0.5);
  border-bottom: 1px solid rgba(128,208,255,0.08);
}

.board-category-btn {
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  color: #8a94a6;
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-category-btn:hover {
  background: rgba(128,208,255,0.05);
  color: #c8d0dc;
}

.board-category-btn.active {
  background: rgba(128,208,255,0.08);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 700;
}

.board-category-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.board-category-dot.gateway   { background: #4caf50; }
.board-category-dot.division  { background: #ff9800; }
.board-category-dot.warden    { background: #4ea8ff; }
.board-category-dot.general   { background: #888; }

.board-list {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid rgba(128,208,255,0.08);
}

.board-list-item {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.board-list-item:hover {
  background: rgba(128,208,255,0.05);
}

.board-list-item.active {
  background: rgba(128,208,255,0.08);
  border-left: 3px solid var(--primary);
  padding-left: 13px;
}

.board-list-item-pin {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.65rem;
}

.board-list-item-category {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.board-list-item-category.gateway  { color: #4caf50; }
.board-list-item-category.division { color: #ff9800; }
.board-list-item-category.warden   { color: #4ea8ff; }
.board-list-item-category.general  { color: #888; }

.board-list-item-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #c8d0dc;
  line-height: 1.3;
  margin-bottom: 5px;
}

.board-list-item-meta {
  font-size: 0.7rem;
  color: #555f6e;
}

.board-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-content-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: #0c0e14;
}

.board-content-category {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.board-content-category.gateway  { color: #4caf50; }
.board-content-category.division { color: #ff9800; }
.board-content-category.warden   { color: #4ea8ff; }
.board-content-category.general  { color: #888; }

.board-content-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e0e8f0;
  margin-bottom: 6px;
  line-height: 1.3;
}

.board-content-meta {
  font-size: 0.72rem;
  color: #555f6e;
}

.board-content-body {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.75;
  color: #9aa4b2;
  white-space: pre-wrap;
  word-wrap: break-word;
  user-select: text;
}

.board-list::-webkit-scrollbar,
.board-content-body::-webkit-scrollbar {
  width: 4px;
}
.board-list::-webkit-scrollbar-thumb,
.board-content-body::-webkit-scrollbar-thumb {
  background: rgba(128,208,255,0.15);
  border-radius: 2px;
}

/* ============================================
   ADMIN SECURITY LOCK
   ============================================ */
.admin-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,12,18,0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 0 0 6px 6px;
}

.admin-lock-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.admin-lock-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #c8d0dc;
  margin-bottom: 8px;
}

.admin-lock-subtitle {
  font-size: 0.75rem;
  color: #555f6e;
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.6;
}

.admin-lock-input {
  padding: 10px 14px;
  background: #0f1117;
  border: 1px solid rgba(128,208,255,0.2);
  border-radius: 4px;
  color: #c8d0dc;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  width: 240px;
  margin-bottom: 12px;
  outline: none;
  text-align: center;
  letter-spacing: 0.1em;
}

.admin-lock-input:focus {
  border-color: var(--primary);
}

.admin-lock-btn {
  padding: 9px 28px;
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 4px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.admin-lock-btn:hover { opacity: 0.85; }

.admin-lock-error {
  font-size: 0.72rem;
  color: var(--color-error);
  margin-top: 10px;
  min-height: 1em;
}
