/* Base styles with monospaced fonts and minimal design */
:root {
  --primary-color: #333;
  --secondary-color: #666;
  --bg-color: #f5f5f5;
  --surface-color: #ffffff;
  --border-color: #ddd;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --grid-size: 20px;
  --header-height: 60px;

  /* New accent + note sizing */
  --accent-color: #2a9d8f;
  --note-min-w: 220px;
  --note-min-h: 140px;
  --note-default-w: 280px;
  --note-default-h: 180px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Courier New', monospace;
  background-color: var(--bg-color);
  color: var(--primary-color);
  overflow: hidden;
  height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header styles */
.header {
  height: var(--header-height);
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 100;
}

.header h1 {
  font-size: 18px;
  font-weight: normal;
  letter-spacing: 1px;
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Button styles */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 20px;
  min-width: 40px;
  height: 40px;
}

/* Make the add note button stand out and distinct from zoom controls */
#add-note-btn {
  background: var(--accent-color);
  color: #fff;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  margin-right: 10px; /* separation from neighboring buttons */
}

#add-note-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-primary:hover {
  background: #555;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--secondary-color);
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  min-width: 36px;
  height: 36px;
}

.btn-secondary:hover {
  background: var(--bg-color);
  color: var(--primary-color);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger {
  background: #f44336;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
}

.btn-danger:hover {
  background: #d32f2f;
}

.btn-close {
  background: none;
  color: var(--secondary-color);
  font-size: 20px;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-close:hover {
  background: var(--bg-color);
  color: var(--primary-color);
}

/* Main corkboard grid */
.corkboard {
  flex: 1;
  background: var(--bg-color);
  position: relative;
  overflow: hidden;
  background-image: 
    linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: 0 0, 0 0;
}

.corkboard.show-grid {
  background-image: 
    linear-gradient(rgba(0,0,0,0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.1) 1px, transparent 1px);
}

/* Group selection toolbar */
.group-toolbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 8px;
  z-index: 200;
  transition: all 0.3s ease;
}

.group-toolbar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: var(--surface-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 300px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 20px 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: normal;
  letter-spacing: 1px;
}

.modal-body {
  padding: 0 20px 20px 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* Color picker modal specific styles */
.color-picker .modal-content {
  min-width: 320px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 28px);
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.color-option {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.15);
  transition: all 0.15s ease;
}

.color-option:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(51,51,51,0.15);
  transform: scale(1.06);
}

.custom-color-input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  margin-top: 4px;
  margin-bottom: 0;
}

/* Place custom color label above the input and tighten spacing */
#color-modal .modal-body label[for="custom-color"] {
  display: block;
  margin: 8px 0 6px;
  font-size: 12px;
  color: var(--secondary-color);
}

.custom-color-input:hover {
  border-color: var(--primary-color);
}

/* Utility classes */
.hidden {
  display: none !important;
}

.no-select {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Responsive design */
@media (max-width: 768px) {
  .header {
    padding: 0 12px;
  }
  
  .header h1 {
    font-size: 16px;
  }
  
  .controls {
    gap: 4px;
  }
  
  .btn-primary,
  .btn-secondary {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 32px;
    height: 32px;
  }
  
  .btn-primary {
    font-size: 16px;
  }
  
  :root {
    --grid-size: 15px;
    --header-height: 50px;
  }
}

/* Selection styles */
::selection {
  background: rgba(51, 51, 51, 0.2);
}

::-moz-selection {
  background: rgba(51, 51, 51, 0.2);
}

/* Scrollbar styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}
