/* CSS Variables for Premium Aesthetic & Theme consistency */
:root {
  /* Color Palette */
  --bg-desk-start: #f4f1ea;
  --bg-desk-end: #e6e0d4;
  --grid-color: rgba(139, 126, 102, 0.08);
  
  --ui-primary: #3d3b3c;
  --ui-primary-hover: #1e1d1e;
  --ui-text: #2b292a;
  --ui-text-muted: #6e6b64;
  --ui-border: #dcd7ce;
  --ui-card-bg: #ffffff;
  
  /* Priority Sticky Note Colors (HSL for flexibility) */
  --note-high-bg: hsl(355, 100%, 93%);
  --note-high-text: hsl(355, 50%, 25%);
  --note-high-pin: hsl(355, 85%, 45%);
  --note-high-shadow: rgba(255, 179, 186, 0.4);

  --note-medium-bg: hsl(45, 100%, 90%);
  --note-medium-text: hsl(45, 60%, 25%);
  --note-medium-pin: hsl(38, 90%, 45%);
  --note-medium-shadow: rgba(255, 223, 186, 0.4);

  --note-low-bg: hsl(140, 75%, 92%);
  --note-low-text: hsl(140, 50%, 20%);
  --note-low-pin: hsl(140, 60%, 35%);
  --note-low-shadow: rgba(186, 255, 201, 0.4);

  --note-completed-bg: hsl(30, 20%, 94%);
  --note-completed-text: #8c8983;

  /* Font Stacks */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-note: 'Patrick Hand', 'Caveat', cursive, sans-serif;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
  --shadow-note: 0 8px 16px rgba(0, 0, 0, 0.08), 0 3px 6px rgba(0, 0, 0, 0.05);
  --shadow-note-hover: 0 16px 28px rgba(0, 0, 0, 0.12), 0 6px 12px rgba(0, 0, 0, 0.08);
  --shadow-pin: 0 3px 5px rgba(0,0,0,0.3);

  /* Border Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-normal: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Reset & Global Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  color: var(--ui-text);
  background-color: var(--bg-desk-end);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Desk container: Simulated desktop with background grid and gradient */
.desk-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-desk-start);
  background-image: 
    radial-gradient(var(--grid-color) 1.5px, transparent 1.5px),
    linear-gradient(to bottom, var(--bg-desk-start), var(--bg-desk-end));
  background-size: 24px 24px, 100% 100%;
  padding: 16px;
}

/* Header & Stats styling */
.board-header {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto 20px auto;
  padding: 12px 16px;
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}

.board-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--ui-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.5px;
}

.logo-pin {
  display: inline-block;
  animation: pinWiggle 2s infinite ease-in-out;
  transform-origin: bottom center;
}

@keyframes pinWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

/* Stats Dashboard */
.stats-panel {
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px;
  border-radius: 50px;
  border: 1px solid var(--ui-border);
  box-shadow: var(--shadow-sm);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 50px;
  transition: var(--transition-fast);
}

.stat-num {
  font-size: 1.25rem;
  font-weight: 700;
  font-feature-settings: "tnum";
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ui-text-muted);
}

.stat-card.pending {
  background-color: #fff;
  border: 1px solid rgba(0,0,0,0.05);
}
.stat-card.pending .stat-num {
  color: #c94a29;
}

.stat-card.completed {
  background-color: transparent;
}
.stat-card.completed .stat-num {
  color: #4a7c59;
}

/* Main Section Layout */
.board-main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  flex: 1;
}

/* Sticky Notepad Creator style */
.creator-section {
  display: flex;
  justify-content: center;
}

.note-pad {
  background: var(--ui-card-bg);
  width: 100%;
  max-width: 380px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0,0,0,0.02);
  border-bottom: 4px solid var(--ui-border);
  overflow: hidden;
  position: relative;
}

.note-pad::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(90deg, #ff9aa2, #ff9aa2 10px, #ffb7b2 10px, #ffb7b2 20px, #ffd1ec 20px, #ffd1ec 30px);
}

.pad-header {
  padding: 20px 20px 8px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px dashed var(--ui-border);
}

.pad-pin {
  font-size: 1.2rem;
}

.pad-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ui-primary);
}

.pad-body {
  padding: 16px 20px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ui-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Custom Textarea */
.form-group textarea {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-sm);
  background-color: #faf9f6;
  color: var(--ui-text);
  outline: none;
  resize: none;
  transition: var(--transition-fast);
}

.form-group textarea:focus {
  border-color: var(--ui-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(61, 59, 60, 0.1);
}

/* Date input styling */
.form-group input[type="date"] {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-sm);
  background-color: #faf9f6;
  color: var(--ui-text);
  outline: none;
  transition: var(--transition-fast);
}

.form-group input[type="date"]:focus {
  border-color: var(--ui-primary);
  background-color: #ffffff;
}

/* Custom Priority Selector Tabs */
.priority-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.priority-selector input[type="radio"] {
  display: none;
}

.prio-btn {
  display: block;
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--ui-border);
  background-color: #faf9f6;
  transition: var(--transition-fast);
  user-select: none;
}

.prio-high {
  color: var(--note-high-text);
}
.prio-medium {
  color: var(--note-medium-text);
}
.prio-low {
  color: var(--note-low-text);
}

.priority-selector input[type="radio"]:checked + .prio-high {
  background-color: var(--note-high-bg);
  border-color: hsl(355, 60%, 75%);
  box-shadow: 0 2px 8px var(--note-high-shadow);
  transform: translateY(-2px);
  font-weight: 700;
}

.priority-selector input[type="radio"]:checked + .prio-medium {
  background-color: var(--note-medium-bg);
  border-color: hsl(45, 60%, 75%);
  box-shadow: 0 2px 8px var(--note-medium-shadow);
  transform: translateY(-2px);
  font-weight: 700;
}

.priority-selector input[type="radio"]:checked + .prio-low {
  background-color: var(--note-low-bg);
  border-color: hsl(140, 50%, 75%);
  box-shadow: 0 2px 8px var(--note-low-shadow);
  transform: translateY(-2px);
  font-weight: 700;
}

.prio-btn:hover {
  background-color: #eae7df;
}

/* Note submission button */
.add-note-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--ui-primary);
  color: #fff;
  border: none;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-top: 4px;
}

.add-note-btn:hover {
  background-color: var(--ui-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.add-note-btn:active {
  transform: translateY(1px);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

/* Notes Board Sections */
.notes-board-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.section-title h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ui-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background-color: rgba(61, 59, 60, 0.1);
  color: var(--ui-primary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  font-feature-settings: "tnum";
}

/* Grid layout for sticky notes */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  min-height: 100px;
  position: relative;
}

/* Empty State graphic styling */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: rgba(255, 255, 255, 0.3);
  border: 2px dashed rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--ui-text-muted);
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.6;
}

.empty-state p {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Sticky Note Component */
.sticky-note {
  position: relative;
  min-height: 220px;
  padding: 28px 24px 20px 24px;
  box-shadow: var(--shadow-note);
  border-radius: 2px; /* Traditional sharp cornered sticky note but slightly soft */
  transition: transform var(--transition-bounce), box-shadow var(--transition-normal), opacity var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: default;
  /* Tape effect default */
  background-image: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.02) 100%);
  animation: noteScaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes noteScaleIn {
  from {
    transform: scale(0.7) rotate(0deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(var(--rot-angle, 0deg));
    opacity: 1;
  }
}

.sticky-note:hover {
  transform: translateY(-6px) scale(1.02) rotate(0deg) !important;
  box-shadow: var(--shadow-note-hover);
  z-index: 10;
}

/* Custom pushpin element */
.sticky-note::after {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--pin-color, var(--note-high-pin));
  box-shadow: var(--shadow-pin);
  z-index: 2;
}

.sticky-note::before {
  content: '';
  position: absolute;
  top: 13px;
  left: calc(50% + 2px);
  width: 3px;
  height: 8px;
  background: rgba(0, 0, 0, 0.15);
  transform: skewX(-20deg);
  z-index: 1;
}

/* Colors mapped to notes by class */
.sticky-note.high {
  background-color: var(--note-high-bg);
  color: var(--note-high-text);
  --pin-color: var(--note-high-pin);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sticky-note.medium {
  background-color: var(--note-medium-bg);
  color: var(--note-medium-text);
  --pin-color: var(--note-medium-pin);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sticky-note.low {
  background-color: var(--note-low-bg);
  color: var(--note-low-text);
  --pin-color: var(--note-low-pin);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Note Content styling */
.note-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-text {
  font-family: var(--font-note);
  font-size: 1.35rem;
  line-height: 1.3;
  word-break: break-word;
  white-space: pre-wrap;
  color: inherit;
}

/* Note Footer styling */
.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.note-date {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.8;
}

.note-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Action button inside notes */
.note-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  color: inherit;
  opacity: 0.7;
}

.note-btn:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.05);
}

.note-btn svg {
  width: 16px;
  height: 16px;
}

.note-btn.check-btn:hover {
  color: #4a7c59;
  background-color: rgba(74, 124, 89, 0.1);
}

.note-btn.delete-btn:hover {
  color: #c94a29;
  background-color: rgba(201, 74, 41, 0.1);
}

/* Completed Sticky Note Styling */
.sticky-note.completed-note {
  background-color: var(--note-completed-bg);
  color: var(--note-completed-text);
  --pin-color: #b0aba4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  opacity: 0.75;
}

.sticky-note.completed-note .note-text {
  position: relative;
  text-decoration: none;
  opacity: 0.8;
}

/* Handdrawn red strikethrough lines */
.sticky-note.completed-note .note-text::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -4px;
  right: -4px;
  height: 3px;
  background-color: rgba(220, 53, 69, 0.65); /* Hand drawn red crayon look */
  border-radius: 50% 20% 40% 10%;
  transform: rotate(-1.5deg) translateY(-50%);
  animation: strikethroughDraw 0.4s ease-out forwards;
  pointer-events: none;
}

@keyframes strikethroughDraw {
  from { width: 0; }
  to { width: calc(100% + 8px); }
}

.sticky-note.completed-note .check-btn {
  color: #4a7c59;
  opacity: 1;
}

/* Removal animation */
.sticky-note.removing {
  animation: noteScaleOut 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
  pointer-events: none;
}

@keyframes noteScaleOut {
  from {
    transform: scale(1) rotate(var(--rot-angle, 0deg));
    opacity: 1;
  }
  to {
    transform: scale(0.5) rotate(15deg);
    opacity: 0;
  }
}

/* Footer info */
.board-footer {
  text-align: center;
  padding: 24px 0 8px 0;
  color: var(--ui-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: auto;
}

/* Responsive Breakpoints - Desktop layout */
@media (min-width: 768px) {
  .desk-container {
    padding: 32px;
  }
  
  .board-header {
    margin-bottom: 32px;
  }

  .header-content {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

  .board-header h1 {
    font-size: 2.2rem;
  }

  .board-main {
    grid-template-columns: 320px 1fr;
    gap: 32px;
    align-items: start;
  }

  .creator-section {
    position: sticky;
    top: 32px;
  }

  .notes-board-section {
    grid-column: 2;
  }

  .completed-section {
    grid-column: 2;
    margin-top: 16px;
  }
}

@media (min-width: 1024px) {
  .board-main {
    grid-template-columns: 350px 1fr;
    gap: 40px;
  }
  
  .notes-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
  }
}
