/* Paint Application Styles */

.paint-app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--win98-window-bg);
  font-family: 'MS Sans Serif', sans-serif;
  user-select: none;
}

/* Menu Bar */
.paint-menu-bar {
  display: flex;
  background-color: var(--win98-button-face);
  border-bottom: 1px solid var(--win98-button-shadow);
  padding: 2px 0;
  position: relative;
  z-index: 1000;
}

.paint-menu-container {
  position: relative;
}

.paint-menu-item {
  padding: 4px 12px;
  cursor: pointer;
  font-size: 11px;
  user-select: none;
}

.paint-menu-item:hover,
.paint-menu-item.active {
  background-color: var(--win98-button-highlight);
}

/* Dropdown Menus */
.paint-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--win98-button-face);
  border: 2px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  min-width: 150px;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 1001;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 16px;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}

.menu-item:hover:not(.disabled) {
  background-color: var(--win98-button-highlight);
}

.menu-item.disabled {
  color: var(--win98-button-shadow);
  cursor: default;
}

.menu-label {
  flex: 1;
}

.menu-shortcut {
  margin-left: 20px;
  font-size: 10px;
  color: var(--win98-button-shadow);
}

.menu-separator {
  height: 1px;
  background-color: var(--win98-button-shadow);
  margin: 2px 8px;
}

/* Main Content Area */
.paint-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Tool Palette */
.paint-tool-palette {
  width: 120px;
  background-color: var(--win98-button-face);
  border-right: 1px solid var(--win98-button-shadow);
  display: flex;
  flex-direction: column;
  padding: 4px;
  gap: 4px;
}

.paint-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.paint-tool {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  background-color: var(--win98-button-face);
  cursor: pointer;
  font-size: 12px;
  position: relative;
}

.paint-tool:hover {
  background-color: var(--win98-button-highlight);
}

.paint-tool.active {
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
  background-color: var(--win98-button-shadow);
}

.tool-icon {
  display: block;
  line-height: 1;
}

.tool-shortcut {
  position: absolute;
  bottom: 1px;
  right: 1px;
  font-size: 6px;
  color: #666;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 0 1px;
  border-radius: 1px;
  line-height: 1;
}

/* Tool Properties */
.paint-tool-properties {
  background-color: var(--win98-button-face);
  border: 1px solid var(--win98-button-shadow);
  padding: 4px;
  margin-top: 4px;
}

.tool-property-group {
  margin-bottom: 8px;
}

.tool-property-label {
  display: block;
  font-size: 10px;
  margin-bottom: 2px;
  color: #000;
}

.tool-property-buttons {
  display: flex;
  gap: 2px;
}

.tool-property-btn {
  width: 20px;
  height: 20px;
  border: 1px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  background-color: var(--win98-button-face);
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-property-btn:hover {
  background-color: var(--win98-button-highlight);
}

.tool-property-btn.active {
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
  background-color: var(--win98-button-shadow);
}

.tool-size-slider {
  width: 80px;
  margin: 2px 0;
}

.tool-size-display {
  font-size: 10px;
  margin-left: 4px;
}

.tool-font-select {
  width: 100px;
  font-size: 10px;
  padding: 1px;
  border: 1px solid var(--win98-button-shadow);
}

/* Text Input Overlay */
.text-input-overlay {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.text-input-field {
  background: transparent;
  border: 1px dashed #000;
  outline: none;
  padding: 0;
  margin: 0;
  pointer-events: auto;
  min-width: 100px;
}

/* Canvas Area */
.paint-canvas-container {
  flex: 1;
  background-color: #808080;
  padding: 10px;
  overflow: auto;
  position: relative;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  min-height: 0;
  min-width: 0;
  box-sizing: border-box;
}

.paint-canvas {
  border: 2px solid;
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
  background-color: white;
  cursor: crosshair;
  display: block;
  outline: none;
  margin: auto;
}

.paint-canvas:focus {
  outline: 2px dotted #000;
  outline-offset: 2px;
}

/* Keyboard Navigation Focus Styles */
.paint-tool:focus {
  outline: 2px dotted #000;
  outline-offset: 1px;
}

.paint-color:focus {
  outline: 2px dotted #000;
  outline-offset: 1px;
}

.paint-menu-item:focus {
  background-color: var(--win98-button-highlight);
  outline: 1px dotted #000;
}

/* Keyboard shortcut visual feedback */
.paint-tool.keyboard-selected {
  box-shadow: 0 0 3px #0066cc;
}

.brush-size-option:focus {
  outline: 2px dotted #000;
  outline-offset: 1px;
}

.paint-canvas:active {
  cursor: crosshair;
}

/* Color Palette */
.paint-color-palette {
  display: flex;
  align-items: flex-start;
  background-color: var(--win98-button-face);
  border-top: 1px solid var(--win98-button-shadow);
  padding: 4px;
  gap: 8px;
  flex-wrap: wrap;
}

.paint-color-indicators {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.color-indicator {
  width: 20px;
  height: 20px;
  border: 1px solid #000;
  position: relative;
}

.color-indicator.foreground {
  z-index: 2;
}

.color-indicator.background {
  margin-left: -10px;
  margin-top: -10px;
  z-index: 1;
}

.paint-colors-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.paint-colors-label {
  font-size: 10px;
  color: #000;
}

.paint-colors {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
}

.paint-color {
  width: 16px;
  height: 16px;
  border: 1px solid #666;
  cursor: pointer;
}

.paint-color:hover {
  border-color: #000;
}

.paint-color.custom-color {
  border: 1px solid #999;
}

.paint-color.custom-color:hover {
  border-color: #000;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

/* Color Picker Dialog */
.color-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.color-dialog {
  background-color: var(--win98-button-face);
  border: 2px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.color-dialog-header {
  background-color: var(--win98-button-face);
  padding: 4px 8px;
  border-bottom: 1px solid var(--win98-button-shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.color-dialog-title {
  font-size: 11px;
  font-weight: bold;
}

.color-dialog-close {
  background-color: var(--win98-button-face);
  border: 1px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  width: 16px;
  height: 16px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-dialog-close:hover {
  background-color: var(--win98-button-highlight);
}

.color-dialog-content {
  padding: 12px;
  display: flex;
  gap: 16px;
  flex: 1;
}

.color-picker-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-spectrum-container {
  border: 2px solid;
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
}

.color-spectrum {
  display: block;
  cursor: crosshair;
}

.hue-slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hue-slider {
  flex: 1;
  height: 20px;
  background: linear-gradient(to right, 
    #ff0000 0%, #ffff00 16.66%, #00ff00 33.33%, 
    #00ffff 50%, #0000ff 66.66%, #ff00ff 83.33%, #ff0000 100%);
  border: 1px solid var(--win98-button-shadow);
  outline: none;
  cursor: pointer;
}

.color-values-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 120px;
}

.color-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.color-preview {
  width: 60px;
  height: 40px;
  border: 2px solid;
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
}

.color-hex {
  font-size: 10px;
  font-family: monospace;
  text-align: center;
}

.color-inputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-label {
  font-size: 10px;
  min-width: 35px;
}

.color-number-input {
  width: 50px;
  font-size: 10px;
  padding: 2px 4px;
  border: 1px solid var(--win98-button-shadow);
  background-color: white;
}

.color-value {
  font-size: 10px;
  min-width: 30px;
}

.color-dialog-buttons {
  padding: 8px 12px;
  border-top: 1px solid var(--win98-button-shadow);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.color-dialog-buttons .win98-button {
  min-width: 60px;
  padding: 4px 12px;
  font-size: 11px;
}

/* Win98 Button Styles for Dialog */
.win98-button {
  background-color: var(--win98-button-face);
  border: 1px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  cursor: pointer;
  font-family: 'MS Sans Serif', sans-serif;
  user-select: none;
}

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

.win98-button:active {
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
  background-color: var(--win98-button-shadow);
}

/* Enhanced Brush Size Selector */
.brush-size-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin: 4px 0;
}

.brush-size-option {
  width: 20px;
  height: 20px;
  border: 1px solid var(--win98-button-shadow);
  background-color: var(--win98-button-face);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brush-size-option:hover {
  background-color: var(--win98-button-highlight);
}

.brush-size-option.active {
  border: 2px solid #000;
  background-color: var(--win98-button-highlight);
}

.brush-size-preview {
  border-radius: 50%;
  border: 1px solid #666;
}

.current-size-display {
  font-size: 9px;
  text-align: center;
  margin-top: 4px;
  position: relative;
}

.brush-preview-large {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 1px solid #000;
  background-color: #000;
  z-index: 1000;
}

/* File Dialog Styles */
.file-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.file-dialog {
  background-color: var(--win98-button-face);
  border: 2px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  width: 400px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
}

.file-dialog-header {
  background-color: var(--win98-button-face);
  padding: 4px 8px;
  border-bottom: 1px solid var(--win98-button-shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-dialog-title {
  font-size: 11px;
  font-weight: bold;
}

.file-dialog-close {
  background-color: var(--win98-button-face);
  border: 1px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  width: 16px;
  height: 16px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-dialog-close:hover {
  background-color: var(--win98-button-highlight);
}

.file-dialog-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-label {
  font-size: 11px;
  font-weight: bold;
}

.file-name-input {
  padding: 4px;
  border: 1px solid var(--win98-button-shadow);
  font-size: 11px;
}

.file-format-select {
  padding: 4px;
  border: 1px solid var(--win98-button-shadow);
  font-size: 11px;
  background-color: white;
}

.file-input {
  padding: 4px;
  border: 1px solid var(--win98-button-shadow);
  font-size: 11px;
}

.file-info {
  background-color: #f0f0f0;
  padding: 8px;
  border: 1px solid var(--win98-button-shadow);
  font-size: 10px;
}

.file-info p {
  margin: 2px 0;
}

.file-dialog-buttons {
  padding: 8px 16px;
  border-top: 1px solid var(--win98-button-shadow);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.file-dialog-buttons .win98-button {
  min-width: 60px;
  padding: 4px 12px;
  font-size: 11px;
}

.file-dialog-buttons .win98-button:disabled {
  background-color: var(--win98-button-face);
  color: var(--win98-button-shadow);
  cursor: not-allowed;
}

/* Status Bar */
.paint-status-bar {
  height: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 8px;
  background-color: var(--win98-button-face);
  border-top: 1px solid var(--win98-button-shadow);
  font-size: 11px;
}

.paint-status-bar span:last-child {
  margin-left: auto;
}

.keyboard-hint {
  color: #666;
  font-style: italic;
}

/* Tool-specific cursors */
.paint-canvas.tool-pencil {
  cursor: crosshair;
}

.paint-canvas.tool-brush {
  cursor: crosshair;
}

.paint-canvas.tool-eraser {
  cursor: crosshair;
}

.paint-canvas.tool-fill {
  cursor: crosshair;
}

.paint-canvas.tool-picker {
  cursor: crosshair;
}

.paint-canvas.tool-text {
  cursor: text;
}

.paint-canvas.tool-line {
  cursor: crosshair;
}

.paint-canvas.tool-rectangle {
  cursor: crosshair;
}

.paint-canvas.tool-ellipse {
  cursor: crosshair;
}

.paint-canvas.tool-select {
  cursor: crosshair;
}

.paint-canvas.tool-magnifier {
  cursor: zoom-in;
}

/* Responsive adjustments */
@media (max-width: 800px) {
  .paint-tool-palette {
    width: 50px;
  }
  
  .paint-tool {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
  
  .paint-color {
    width: 14px;
    height: 14px;
  }
}