/* ===== COMMON.CSS ===== */
/* Consolidates: base.css + layout.css */
/* Standardized components for dashboard, modals, buttons, inputs, and layout */

/* ===== CSS VARIABLES ===== */
:root {
    --blush: #FFF8EC;
    --rose: #DCCCAC;
    --rose-dark: #C7B28A;

    --mint: #DCCCAC;
    --mint-dark: #99AD7A;

    --butter: #F4E9D7;
    --butter-dark: #DCCCAC;

    --sky: #E8F0DF;

    --lilac: #99AD7A;
    --lilac-dark: #546B41;

    --text: #546B41;
    --text-soft: #7E8F69;

    --white: #FFFFFF;

    --shadow: 0 4px 20px rgba(84,107,65,0.12);
    --shadow-lg: 0 8px 32px rgba(84,107,65,0.18);

    --radius: 24px;
    --radius-sm: 14px;
}

/* ===== GLOBAL RESETS ===== */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

body {
  font-family: 'Nunito', sans-serif; 
  background: var(--blush);
  color: var(--text); 
  height: 100vh; 
  overflow: hidden;
  user-select: none; 
  -webkit-user-select: none;
}

/* ===== DASHBOARD & LAYOUT ===== */
#app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  padding: 20px;
  box-sizing: border-box;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
  justify-content: center;
}

#header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.header-left { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
}

.header-title { 
  font-size: 22px; 
  font-weight: 900; 
}

.header-date { 
  font-size: 14px; 
  font-weight: 600; 
  color: var(--text-soft); 
}

.header-center-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center; 
  flex: 0 0 auto; 
  margin: 0 20px;
  width: max-content; 
  max-width: 30rem; 
  align-self: center; 
}

.ctrl-toggle-btn {
  background: var(--blush);
  border: 2px solid var(--rose);
  border-radius: 12px;
  padding: 0.5em 1em;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  height: auto;
  box-sizing: border-box;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ctrl-toggle-btn.active {
  background: var(--rose);
  border-color: var(--rose-dark);
  color: var(--text);
}

.ctrl-toggle-btn.inactive {
  background: var(--blush);
  border-color: var(--rose);
  color: var(--text-soft);
  opacity: 0.6;
}

.ctrl-toggle-btn:hover {
  transform: translateY(-1px);
}

.ctrl-toggle-btn:active {
  transform: translateY(1px);
}

.header-time { 
  font-size: 18px; 
  font-weight: 700; 
  color: var(--text-soft); 
}

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

.sync-dot {
  width: 8px; 
  height: 8px; 
  border-radius: 50%; 
  display: inline-block;
  margin-right: 5px; 
  background: var(--mint-dark);
  transition: background 0.3s;
}

.sync-dot.syncing { 
  background: var(--butter-dark); 
  animation: pulse 1s ease-in-out infinite; 
}

.sync-dot.error { 
  background: var(--rose-dark); 
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ===== PANELS ===== */
.panel { 
  background: var(--white); 
  border-radius: var(--radius); 
  box-shadow: var(--shadow); 
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
  transition: all 0.3s ease;
  min-width: 0; 
}

.panel-header { 
  padding: 18px 22px 12px; 
  font-size: 20px; 
  font-weight: 900; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  border-bottom: 2px dashed #F0E8F5; 
  flex-shrink: 0; 
}

.panel.collapsed {
  display: none;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 22px;
  scrollbar-width: thin;
  scrollbar-color: var(--mint-dark) transparent;
}

/* ===== TABS ===== */
.list-tabs { 
  display: flex; 
  gap: 8px; 
  padding: 12px 22px 0; 
  overflow-x: auto; 
  scrollbar-width: none; 
  flex-shrink: 0; 
  align-items: center; 
}

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

.tab-btn { 
  background: var(--blush); 
  border: 2px solid transparent; 
  border-radius: 20px; 
  padding: 6px 14px; 
  font-family: 'Nunito', sans-serif; 
  font-size: 14px; 
  font-weight: 700; 
  color: var(--text-soft); 
  cursor: pointer; 
  white-space: nowrap; 
  transition: all 0.2s; 
  flex-shrink: 0; 
  display: flex; 
  align-items: center; 
  gap: 5px; 
}

.tab-btn.active { 
  background: var(--rose); 
  color: var(--text); 
  border-color: var(--rose-dark); 
}

.tab-btn:hover:not(.active) { 
  background: var(--rose); 
  color: var(--text); 
}

.tab-btn.add-list { 
  background: transparent; 
  border: 2px dashed var(--rose-dark); 
  color: var(--rose-dark); 
}

.tab-btn.add-list:hover { 
  background: var(--rose); 
}

.tab-del { 
  background: none; 
  border: none; 
  font-size: 12px; 
  cursor: pointer; 
  opacity: 0.45; 
  padding: 0 2px; 
  line-height: 1; 
  transition: opacity 0.15s; 
}

.tab-del:hover { 
  opacity: 1; 
}

/* ===== STANDARDIZED BUTTONS ===== */

/* Primary action button (add items) */
.btn-add {
  background: var(--rose);
  border: none;
  border-radius: 14px;
  width: 44px;
  height: 44px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-add:hover {
  background: var(--rose-dark);
  transform: scale(1.08);
}

/* Icon button (emoji picker, small actions) */
.btn-icon {
  background: var(--butter);
  border: 2px solid var(--butter-dark);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  transform: scale(1.08);
}

/* Secondary icon button (delete, edit) */
.btn-icon-secondary {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}

.btn-icon-secondary:hover {
  background: var(--rose);
}

/* Circular primary icon button */
.btn-icon-circle {
  background: var(--mint);
  border: none;
  border-radius: 14px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.btn-icon-circle:hover {
  background: var(--mint-dark);
  transform: scale(1.08);
}

/* Header action button */
.hdr-btn {
  background: var(--lilac);
  border: none;
  border-radius: 12px;
  padding: 8px 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.hdr-btn:hover {
  background: #9B6BAE;
  color: #ffffff;
  transform: scale(1.03);
}

/* ===== STANDARDIZED INPUTS ===== */

.input-text {
  width: 100%;
  background: var(--blush);
  border: 2px solid var(--rose);
  border-radius: 14px;
  padding: 10px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  outline: none;
}

.input-text::placeholder {
  color: var(--text-soft);
}

.input-text:focus {
  border-color: var(--rose-dark);
}

/* Smaller input variant (used in modals, forms) */
.input-text-small {
  width: 100%;
  background: var(--blush);
  border: 2px solid var(--rose);
  border-radius: 14px;
  padding: 12px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  margin-bottom: 16px;
}

.input-text-small:focus {
  border-color: var(--rose-dark);
}

/* Input row container (for grouped inputs + buttons) */
.input-row {
  padding: 12px 22px;
  border-top: 2px dashed #F0E8F5;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Select/dropdown */
.input-select {
  background: var(--blush);
  border: 2px solid var(--rose);
  border-radius: 10px;
  padding: 6px 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(60,40,80,0.35);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  width: 360px;
}

.modal h3 {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 8px;
}

.modal p {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 18px;
  line-height: 1.5;
}

.modal input {
  width: 100%;
  background: var(--blush);
  border: 2px solid var(--rose);
  border-radius: 14px;
  padding: 12px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  margin-bottom: 16px;
}

.modal input:focus {
  border-color: var(--rose-dark);
}

.modal-btns {
  display: flex;
  gap: 10px;
}

.modal-btns button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-confirm {
  background: var(--rose);
  color: var(--text);
}

.btn-confirm:hover {
  background: var(--rose-dark);
}

.btn-confirm.reminder-dismiss.active {
  background: var(--mint-dark);
  color: var(--white);
}

.btn-cancel {
  background: var(--blush);
  color: var(--text-soft);
}

.btn-cancel:hover {
  background: #F0E0EC;
}

.modal-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--text);
}

.modal-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--rose);
  margin: 0;
}

.modal-checkbox span {
  line-height: 1.2;
}

/* ===== EMOJI PICKER ===== */
.emoji-picker {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  width: min(360px,90vw);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
}

.emoji-picker h3 {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  gap: 4px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--mint-dark) transparent;
}

.emoji-opt {
  font-size: 24px;
  text-align: center;
  cursor: pointer;
  padding: 6px;
  border-radius: 10px;
  border: none;
  background: none;
  line-height: 1;
}

.emoji-opt:hover {
  background: var(--butter);
  transform: scale(1.12);
}

/* ===== SETTINGS COMPONENTS ===== */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #F0E8F5;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-size: 15px;
  font-weight: 700;
}

.settings-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  margin-top: 2px;
  line-height: 1.5;
}

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--mint-dark);
  border-radius: 10px;
}

/* ===== TOOLTIPS ===== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--white);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid var(--white);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1001;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

[data-tooltip]:hover::before {
  opacity: 1;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 600;
}

.empty-emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== RESPONSIVE DESIGN ===== */
#config-banner {
  background: #FFF9C4;
  border-bottom: 2px solid #FFF176;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  color: #7A6A00;
  text-align: center;
  display: none;
}

#config-banner.visible {
  display: block;
}

#config-banner code {
  background: rgba(0,0,0,0.08);
  border-radius: 5px;
  padding: 1px 6px;
  font-family: monospace;
}

@media (max-width: 900px) {
  body {
    height: auto;
    overflow: auto;
    user-select: auto;
    -webkit-user-select: auto;
  }

  #app {
    height: auto;
    grid-template-rows: auto auto;
    padding: 12px;
  }

  #header {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    text-align: center;
    align-items: center;
  }

  .header-left {
    flex-direction: column;
    gap: 4px;
  }

  .header-center-controls {
    margin: 4px 0;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    height: auto;
  }

  .panel {
    height: 70vh;
    max-height: 70vh;
    min-height: 450px;
  }

  .modal,
  .emoji-picker {
    width: calc(100% - 24px);
    margin: 12px;
    padding: 20px;
  }
}