/* Windows 98 Style CSS with Dark/Light Mode Support */

:root {
  /* Light Mode Colors */
  --bg-desktop: #008080;
  --bg-window: #c0c0c0;
  --bg-panel: #c0c0c0;
  --bg-button: #c0c0c0;
  --bg-button-hover: #dfdfdf;
  --bg-button-active: #a0a0a0;
  --bg-input: #ffffff;
  --bg-select: #ffffff;
  --bg-titlebar: linear-gradient(90deg, #0000ff 0%, #8080ff 100%);
  --bg-taskbar: #c0c0c0;
  --bg-tab-active: #c0c0c0;
  --bg-tab-inactive: #a0a0a0;
  
  --text-primary: #000000;
  --text-white: #ffffff;
  --text-disabled: #808080;
  
  --border-raised: inset 2px 2px #dfdfdf, inset -2px -2px #404040;
  --border-sunken: inset 2px 2px #404040, inset -2px -2px #dfdfdf;
  --border-window: 2px outset #c0c0c0;
  --border-button: 2px outset #c0c0c0;
  
  --shadow-window: 2px 2px 5px rgba(0, 0, 0, 0.3);
  --font-family: 'MS Sans Serif', sans-serif;
}

[data-theme="dark"] {
  /* Dark Mode Colors */
  --bg-desktop: #000040;
  --bg-window: #404040;
  --bg-panel: #404040;
  --bg-button: #404040;
  --bg-button-hover: #505050;
  --bg-button-active: #303030;
  --bg-input: #303030;
  --bg-select: #303030;
  --bg-titlebar: linear-gradient(90deg, #000080 0%, #4040c0 100%);
  --bg-taskbar: #202020;
  --bg-tab-active: #404040;
  --bg-tab-inactive: #303030;
  
  --text-primary: #ffffff;
  --text-white: #ffffff;
  --text-disabled: #808080;
  
  --border-raised: inset 2px 2px #606060, inset -2px -2px #202020;
  --border-sunken: inset 2px 2px #202020, inset -2px -2px #606060;
  --border-window: 2px outset #404040;
  --border-button: 2px outset #404040;
  
  --shadow-window: 2px 2px 10px rgba(0, 0, 0, 0.7);
}

/* Dark mode column headers */
[data-theme="dark"] .column-header {
  text-shadow: 1px 1px 0 #000000;
  /* Dark mode 3D borders */
  border-top: 1px solid #606060;
  border-left: 1px solid #606060;
  border-right: 1px solid #202020;
  border-bottom: 1px solid #202020;
  /* Dark mode box shadow */
  box-shadow: 
    inset 1px 1px 0 rgba(96, 96, 96, 0.8),
    inset -1px -1px 0 rgba(32, 32, 32, 0.8),
    0 1px 0 rgba(96, 96, 96, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: 11px;
  overflow: hidden;
  background: var(--bg-desktop);
}

/* Desktop */
.desktop {
  width: 100vw;
  height: 100vh;
  background: var(--bg-desktop);
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(255,255,255,0.05) 0%, transparent 50%);
  position: relative;
  overflow: hidden;
}

/* Main Window */
.main-window {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 60px;
  background: var(--bg-window);
  border: var(--border-window);
  box-shadow: var(--shadow-window);
  display: flex;
  flex-direction: column;
}

/* Title Bar */
.title-bar {
  background: var(--bg-titlebar);
  color: var(--text-white);
  padding: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 20px;
}

.title-bar-text {
  font-weight: bold;
  font-size: 11px;
  padding-left: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.window-icon {
  font-size: 14px;
}

.title-bar-controls {
  display: flex;
  gap: 2px;
}

.title-bar-control {
  background: var(--bg-button);
  border: var(--border-button);
  width: 18px;
  height: 14px;
  font-size: 10px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-bar-control:hover:not(:disabled) {
  background: var(--bg-button-hover);
}

.title-bar-control:active:not(:disabled) {
  border: var(--border-sunken);
  background: var(--bg-button-active);
}

.title-bar-control:disabled {
  color: var(--text-disabled);
  cursor: default;
}

/* Menu Bar */
.menu-bar {
  background: var(--bg-window);
  border-bottom: 1px solid #808080;
  display: flex;
  padding: 2px;
}

.menu-item {
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text-primary);
}

.menu-item:hover {
  background: var(--bg-button-hover);
}

/* Tab Container */
.tab-container {
  display: flex;
  background: var(--bg-window);
  border-bottom: 1px solid #808080;
}

.tab {
  padding: 6px 12px;
  background: var(--bg-tab-inactive);
  border: 2px outset var(--bg-tab-inactive);
  border-bottom: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 11px;
}

.tab.active {
  background: var(--bg-tab-active);
  border: 2px outset var(--bg-tab-active);
  border-bottom: 2px solid var(--bg-tab-active);
  margin-bottom: -1px;
}

.tab:hover:not(.active) {
  background: var(--bg-button-hover);
}

/* Tab Content */
.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
}

.tab-content.active {
  display: block;
}

/* Window Body */
.window-body {
  flex: 1;
  padding: 8px;
  background: var(--bg-window);
  color: var(--text-primary);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Status Bar */
.status-bar {
  background: var(--bg-panel);
  border: var(--border-sunken);
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-primary);
}

.status-section {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Kanban Container */
.kanban-container {
  display: flex;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.kanban-column {
  flex: 1;
  background: var(--bg-panel);
  border: var(--border-sunken);
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0 2px;
}

.column-header {
  background: var(--bg-button);
  border: var(--border-raised);
  border-bottom: 1px solid #808080;
  padding: 4px 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 10px;
  color: var(--text-primary);
  /* Win98 3D styling with highlights */
  text-shadow: 1px 1px 0 #ffffff;
  min-height: 20px;
  position: relative;
  /* 3D highlight borders */
  border-top: 1px solid #ffffff;
  border-left: 1px solid #ffffff;
  border-right: 1px solid #808080;
  border-bottom: 1px solid #808080;
  /* Subtle box shadow for depth */
  box-shadow: 
    inset 1px 1px 0 rgba(255, 255, 255, 0.8),
    inset -1px -1px 0 rgba(128, 128, 128, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.3);
}

.column-title {
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.column-count {
  background: var(--bg-input);
  border: var(--border-sunken);
  padding: 1px 4px;
  min-width: 20px;
  text-align: center;
  font-size: 10px;
  color: var(--text-primary);
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

.todo-list {
  flex: 1;
  padding: 2px;
  overflow-y: auto;
  min-height: 100px;
  background: var(--bg-input);
  border: var(--border-sunken);
  margin: 2px;
  /* Win98 Listbox styling */
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 15px,
      rgba(128, 128, 128, 0.3) 15px,
      rgba(128, 128, 128, 0.3) 16px
    );
}

/* Task Items - Win98 Listbox Item styling */
.task-item {
  background: var(--bg-input);
  border: 1px dotted transparent;
  margin: 1px 2px 2px 2px;
  padding: 4px 6px;
  cursor: move;
  font-size: 10px;
  color: var(--text-primary);
  transition: all 0.1s ease;
  position: relative;
  /* Win98 listbox item styling */
  border-radius: 0;
  line-height: 1.2;
}

.task-item:hover {
  background: var(--bg-button-hover);
  border: 1px dotted var(--text-primary);
}

.task-item:focus {
  background: #316AC5;
  color: #ffffff;
  border: 1px dotted #ffffff;
  outline: none;
}

.task-item.selected {
  background: #316AC5;
  color: #ffffff;
  border: 1px solid #316AC5;
  /* Win98 listbox selection styling */
  box-shadow: inset 1px 1px 0 #4080ff, inset -1px -1px 0 #1050a0;
}

.task-item.dragging {
  opacity: 0.8;
  transform: rotate(1deg);
  border: 1px dashed var(--text-primary);
  background: var(--bg-button-active);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.task-title {
  font-weight: bold;
  margin-bottom: 2px;
}

.task-description {
  font-size: 9px;
  color: var(--text-disabled);
  font-style: italic;
  margin-top: 1px;
}

/* Win98 listbox item selected state */
.task-item.selected .task-title {
  color: #ffffff;
  font-weight: normal;
}

.task-item.selected .task-description {
  color: #c0c0c0;
}

.task-item:focus .task-title {
  color: #ffffff;
  font-weight: normal;
}

.task-item:focus .task-description {
  color: #c0c0c0;
}

/* Hide buttons when item is selected (authentic Win98 behavior) */
.task-item.selected .win98-button {
  opacity: 0.7;
}

.task-item.selected:hover .win98-button {
  opacity: 1;
}

/* Win98 listbox focus ring */
.todo-list:focus-within {
  box-shadow: inset 1px 1px 0 #316AC5, inset -1px -1px 0 #316AC5;
}

/* Action Buttons in bottom right */
.action-buttons {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
  z-index: 100;
}

.action-buttons .win98-button {
  font-size: 11px;
  padding: 6px 12px;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Form Elements */
.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.form-row label {
  min-width: 80px;
  font-size: 11px;
  color: var(--text-primary);
}

.win98-input {
  flex: 1;
  background: var(--bg-input);
  border: var(--border-sunken);
  padding: 2px 4px;
  font-family: var(--font-family);
  font-size: 11px;
  color: var(--text-primary);
}

.win98-input:focus {
  outline: 1px dotted var(--text-primary);
  outline-offset: -3px;
}

.win98-select {
  background: var(--bg-select);
  border: var(--border-sunken);
  padding: 2px 16px 2px 4px;
  font-family: var(--font-family);
  font-size: 11px;
  color: var(--text-primary);
  /* Win98 dropdown arrow */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 0;
  background-image: 
    linear-gradient(45deg, transparent 50%, var(--text-primary) 50%),
    linear-gradient(135deg, var(--text-primary) 50%, transparent 50%);
  background-position: 
    calc(100% - 8px) calc(50% - 2px),
    calc(100% - 4px) calc(50% - 2px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.win98-select:focus {
  outline: 1px dotted var(--text-primary);
  outline-offset: -3px;
}

/* Force flat Win98 styling on all browsers */
.win98-select option {
  background: var(--bg-input);
  color: var(--text-primary);
  border: none;
  padding: 2px 4px;
}

.win98-select option:checked {
  background: #316AC5;
  color: #ffffff;
}

.form-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Buttons */
.win98-button {
  background: var(--bg-button);
  border: var(--border-button);
  padding: 4px 16px;
  font-family: var(--font-family);
  font-size: 11px;
  color: var(--text-primary);
  cursor: pointer;
  min-width: 75px;
  height: 23px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.win98-button:hover {
  background: var(--bg-button-hover);
}

.win98-button:active {
  border: var(--border-sunken);
  background: var(--bg-button-active);
}

.win98-button.primary {
  font-weight: bold;
}

.win98-button.danger {
  color: #800000;
}

.win98-button:disabled {
  color: var(--text-disabled);
  cursor: default;
  background: var(--bg-button);
}

/* Settings Sections */
.settings-section {
  background: var(--bg-panel);
  border: var(--border-sunken);
  padding: 8px;
  margin-bottom: 8px;
}

.settings-section h3 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: var(--text-primary);
}

/* Taskbar */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: var(--bg-taskbar);
  border-top: 1px solid #dfdfdf;
  display: flex;
  align-items: center;
  padding: 2px;
  z-index: 1000;
}

.start-button {
  background: var(--bg-button);
  border: var(--border-button);
  padding: 2px 6px;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 11px;
  color: var(--text-primary);
}

.start-button:hover {
  background: var(--bg-button-hover);
}

.start-button:active {
  border: var(--border-sunken);
}

.start-logo {
  font-size: 14px;
}

.taskbar-separator {
  width: 2px;
  height: 20px;
  background: linear-gradient(to right, #808080, #dfdfdf);
  margin: 0 4px;
}

.taskbar-item {
  background: var(--bg-button);
  border: var(--border-button);
  padding: 2px 8px;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-primary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taskbar-item.active {
  border: var(--border-sunken);
  background: var(--bg-button-active);
}

.taskbar-clock {
  margin-left: auto;
  background: var(--bg-panel);
  border: var(--border-sunken);
  padding: 2px 8px;
  height: 24px;
  display: flex;
  align-items: center;
  font-size: 11px;
  color: var(--text-primary);
}

/* Drag and Drop - Win98 Listbox Style */
.drag-over {
  background: rgba(49, 106, 197, 0.2) !important;
  border: 2px dashed #316AC5 !important;
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 15px,
      rgba(49, 106, 197, 0.4) 15px,
      rgba(49, 106, 197, 0.4) 16px
    ) !important;
}

/* Win98 Listbox Scrollbar Styling */
.todo-list::-webkit-scrollbar,
.window-body::-webkit-scrollbar {
  width: 17px;
  background: var(--bg-panel);
}

.todo-list::-webkit-scrollbar-track,
.window-body::-webkit-scrollbar-track {
  background: var(--bg-panel);
  border: var(--border-sunken);
}

.todo-list::-webkit-scrollbar-thumb,
.window-body::-webkit-scrollbar-thumb {
  background: var(--bg-button);
  border: var(--border-raised);
  min-height: 17px;
}

.todo-list::-webkit-scrollbar-thumb:hover,
.window-body::-webkit-scrollbar-thumb:hover {
  background: var(--bg-button-hover);
}

.todo-list::-webkit-scrollbar-corner {
  background: var(--bg-panel);
}

/* Win98 Listbox scrollbar arrows */
.todo-list::-webkit-scrollbar-button:vertical:start:decrement {
  background: var(--bg-button);
  border: var(--border-raised);
  height: 17px;
}

.todo-list::-webkit-scrollbar-button:vertical:end:increment {
  background: var(--bg-button);
  border: var(--border-raised);
  height: 17px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-window {
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 50px;
  }
  
  .kanban-container {
    flex-direction: column;
    gap: 4px;
  }
  
  .kanban-column {
    min-height: 150px;
  }
  
  .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  
  .form-row label {
    min-width: auto;
  }
  
  .form-buttons {
    flex-wrap: wrap;
  }
}

/* Base Win98 Window Styling */
.win98-window {
  background: var(--bg-window);
  border: var(--border-window);
  box-shadow: var(--shadow-window);
  display: flex;
  flex-direction: column;
  font-family: var(--font-family);
  font-size: var(--font-size);
  color: var(--text-primary);
}

/* Window Management Styles */
.main-window {
  position: relative;
  min-width: 600px;
  min-height: 400px;
  max-width: 100vw;
  max-height: calc(100vh - 32px);
}

.main-window .title-bar {
  cursor: grab;
  user-select: none;
}

.main-window .title-bar:active {
  cursor: grabbing;
}

.main-window.maximized {
  border-radius: 0 !important;
}

/* Resize Handles */
.resize-handle-n {
  position: absolute;
  top: -2px;
  left: 8px;
  right: 8px;
  height: 4px;
  cursor: n-resize;
  z-index: 1001;
}

.resize-handle-s {
  position: absolute;
  bottom: -2px;
  left: 8px;
  right: 8px;
  height: 4px;
  cursor: s-resize;
  z-index: 1001;
}

.resize-handle-e {
  position: absolute;
  top: 8px;
  right: -2px;
  bottom: 8px;
  width: 4px;
  cursor: e-resize;
  z-index: 1001;
}

.resize-handle-w {
  position: absolute;
  top: 8px;
  left: -2px;
  bottom: 8px;
  width: 4px;
  cursor: w-resize;
  z-index: 1001;
}

.resize-handle-ne {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  cursor: ne-resize;
  z-index: 1001;
}

.resize-handle-nw {
  position: absolute;
  top: -2px;
  left: -2px;
  width: 8px;
  height: 8px;
  cursor: nw-resize;
  z-index: 1001;
}

.resize-handle-se {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  cursor: se-resize;
  z-index: 1001;
}

.resize-handle-sw {
  position: absolute;
  bottom: -2px;
  left: -2px;
  width: 8px;
  height: 8px;
  cursor: sw-resize;
  z-index: 1001;
}

/* Menu System Styles */
.menu-bar {
  cursor: default;
  user-select: none;
}

.menu-item {
  position: relative;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--bg-selected);
  color: var(--text-selected);
}

.menu-dropdown {
  position: absolute;
  background: var(--bg-window);
  border: var(--border-sunken);
  box-shadow: var(--shadow-window);
  z-index: 2000;
  min-width: 180px;
  font-size: var(--font-size-small);
}

.menu-dropdown-item {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  position: relative;
}

.menu-dropdown-item:hover {
  background: var(--bg-selected);
  color: var(--text-selected);
}

.menu-dropdown-item.checked::before {
  content: '✓';
  position: absolute;
  left: 2px;
  font-weight: bold;
}

.menu-dropdown-item.checked {
  padding-left: 16px;
}

.menu-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  flex-shrink: 0;
}

.menu-text {
  flex: 1;
}

.menu-shortcut {
  margin-left: 16px;
  color: var(--text-disabled);
  font-size: 10px;
}

.menu-separator {
  height: 1px;
  background: var(--border-sunken-color);
  margin: 2px 4px;
}

/* Start Menu Styles */
.start-button:hover {
  background: var(--bg-selected) !important;
  color: var(--text-selected) !important;
}

.start-menu {
  position: absolute;
  background: var(--bg-window);
  border: var(--border-raised);
  box-shadow: var(--shadow-window);
  z-index: 2000;
  min-width: 200px;
  font-size: var(--font-size-small);
}

.start-menu-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  position: relative;
}

.start-menu-item:hover {
  background: var(--bg-selected);
  color: var(--text-selected);
}

.start-menu-item.bold {
  font-weight: bold;
  border-bottom: 1px solid var(--border-sunken-color);
  margin-bottom: 2px;
}

.start-menu-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}

.start-menu-text {
  flex: 1;
}

.submenu-arrow {
  margin-left: auto;
  font-size: 10px;
}

.start-menu-separator {
  height: 1px;
  background: var(--border-sunken-color);
  margin: 2px 8px;
}

/* Modal and Dialog Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.info-dialog {
  max-width: 500px;
  background: var(--bg-window);
}

/* Taskbar item states */
.taskbar-item.minimized {
  background: var(--bg-button);
  border: var(--border-button);
  color: var(--text-disabled);
}

.taskbar-item.minimized:hover {
  background: var(--bg-button-hover);
  color: var(--text-primary);
}

/* Animation for theme switching */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Focus styles for accessibility */
.win98-button:focus,
.win98-input:focus,
.win98-select:focus,
.tab:focus {
  outline: 1px dotted var(--text-primary);
  outline-offset: -2px;
}
