/* ==========================================================================
   NoteLeaf - Mobile-First ColorNote Replica Stylesheet
   Website: noteleaf.technoleaves.com
   ========================================================================== */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Brand Theme Colors */
  --bg-primary: #f4f5f8;
  --bg-surface: #ffffff;
  --bg-secondary: #eef0f5;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --accent-color: #10b981; /* Leaf Green */
  --accent-hover: #059669;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

  /* ColorNote Palette Colors */
  --note-yellow: #fef08a;
  --note-yellow-dark: #ca8a04;
  --note-red: #fecaca;
  --note-red-dark: #dc2626;
  --note-orange: #ffedd5;
  --note-orange-dark: #ea580c;
  --note-green: #dcfce7;
  --note-green-dark: #16a34a;
  --note-blue: #e0f2fe;
  --note-blue-dark: #0284c7;
  --note-purple: #f3e8ff;
  --note-purple-dark: #9333ea;
  --note-pink: #fce7f3;
  --note-pink-dark: #db2777;
  --note-grey: #f1f5f9;
  --note-grey-dark: #475569;
  --note-dark: #334155;
  --note-dark-dark: #94a3b8;

  --nav-height: 60px;
  --header-height: 64px;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-secondary: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);

  --note-yellow: #423810;
  --note-yellow-dark: #fef08a;
  --note-red: #451a1a;
  --note-red-dark: #fecaca;
  --note-orange: #431f0e;
  --note-orange-dark: #ffedd5;
  --note-green: #143821;
  --note-green-dark: #dcfce7;
  --note-blue: #0f354a;
  --note-blue-dark: #e0f2fe;
  --note-purple: #341a4a;
  --note-purple-dark: #f3e8ff;
  --note-pink: #441732;
  --note-pink-dark: #fce7f3;
  --note-grey: #1e293b;
  --note-grey-dark: #cbd5e1;
  --note-dark: #020617;
  --note-dark-dark: #f1f5f9;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

/* APP LAYOUT */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-surface);
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* TOP APP BAR */
.app-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-color);
}

.brand svg {
  width: 28px;
  height: 28px;
}

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

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover, .btn-icon:active {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* SEARCH & COLOR FILTER BAR */
.search-filter-bar {
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent-color);
}

/* COLOR FILTER TABS */
.color-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.color-tabs::-webkit-scrollbar {
  display: none;
}

.color-tab {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-tab.active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* MAIN CONTENT AREA */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 80px;
}

/* GRID & LIST VIEW MODES */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.notes-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* NOTE CARD STYLES */
.note-card {
  background: var(--bg-surface);
  border-radius: 14px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.note-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.note-card-header {
  height: 10px;
  width: 100%;
}

.notes-grid.list-view .note-card {
  flex-direction: row;
  align-items: center;
  height: auto;
}

.notes-grid.list-view .note-card-header {
  width: 8px;
  height: 100%;
  min-height: 60px;
}

.note-card-body {
  padding: 12px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.note-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.note-card-snippet {
  font-size: 0.825rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.pin-badge, .lock-badge, .reminder-badge {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* CHECKLIST PREVIEW */
.checklist-preview-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.checklist-preview-item.done {
  text-decoration: line-through;
  opacity: 0.6;
}

/* FLOATING ACTION BUTTON (+) */
.fab-button {
  position: fixed;
  bottom: 75px;
  right: calc(50% - 270px + 16px);
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--accent-color);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  cursor: pointer;
  z-index: 15;
  transition: transform 0.2s, background-color 0.2s;
}

@media (max-width: 600px) {
  .fab-button {
    right: 20px;
  }
}

.fab-button:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

/* BOTTOM NAVIGATION BAR */
.bottom-nav {
  height: var(--nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 600px;
  z-index: 20;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.725rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--accent-color);
  font-weight: 600;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

/* MODAL STYLES */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-surface);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* COLOR SELECTOR BAR */
.color-picker-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.color-option.selected {
  border-color: var(--text-primary);
  transform: scale(1.15);
}

/* CHECKLIST EDITOR */
.checklist-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.checklist-item-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.checklist-item-row input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
}

/* COLOR BACKGROUND UTILITIES FOR NOTE CARDS */
.bg-yellow { background-color: var(--note-yellow); }
.bg-red { background-color: var(--note-red); }
.bg-orange { background-color: var(--note-orange); }
.bg-green { background-color: var(--note-green); }
.bg-blue { background-color: var(--note-blue); }
.bg-purple { background-color: var(--note-purple); }
.bg-pink { background-color: var(--note-pink); }
.bg-grey { background-color: var(--note-grey); }
.bg-dark { background-color: var(--note-dark); }

.bar-yellow { background-color: var(--note-yellow-dark); }
.bar-red { background-color: var(--note-red-dark); }
.bar-orange { background-color: var(--note-orange-dark); }
.bar-green { background-color: var(--note-green-dark); }
.bar-blue { background-color: var(--note-blue-dark); }
.bar-purple { background-color: var(--note-purple-dark); }
.bar-pink { background-color: var(--note-pink-dark); }
.bar-grey { background-color: var(--note-grey-dark); }
.bar-dark { background-color: var(--note-dark-dark); }

/* CALENDAR GRID */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 6px 0;
}

.calendar-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.calendar-cell.today {
  border-color: var(--accent-color);
  background: var(--bg-secondary);
}

.calendar-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}

.calendar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
