/* Dashboard styles — warm Remindery theme */

/* ── Layout ── */
.dashboard-page {
  min-height: calc(100vh - 65px);
  padding: 60px 32px 80px;
}

.dash-container {
  max-width: 900px;
  margin: 0 auto;
}

/* ── Header ── */
.dash-header {
  text-align: center;
  margin-bottom: 48px;
}

.dash-title {
  font-family: 'Cormorant Garant', Georgia, serif;
  font-size: 56px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.dash-subtitle {
  font-size: 18px;
  color: var(--muted);
}

/* ── Sections ── */
.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.section-title {
  font-family: 'Cormorant Garant', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

/* ── Add Form ── */
.add-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input,
.form-group select {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: white;
  font-size: 15px;
  color: var(--fg);
  font-family: var(--font-body);
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  align-self: flex-start;
}

.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
  background: white;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover { background: var(--accent-light); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px;
}

.btn-ghost:hover { background: rgba(0,0,0,0.05); color: var(--fg); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Contact List ── */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: all 0.2s;
}

.contact-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--shadow);
}

.contact-card.card-sent {
  opacity: 0.6;
}

.contact-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.contact-emoji {
  font-size: 32px;
  line-height: 1;
}

.contact-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.contact-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.occasion-label {
  text-transform: capitalize;
}

.contact-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Badges ── */
.due-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.due-today { background: #FEF3C7; color: #92400E; }
.due-soon  { background: var(--accent-light); color: var(--accent-dark); }
.due-past  { background: #F3F4F6; color: #6B7280; }
.due-later { background: #F3F4F6; color: var(--muted); }

/* ── History ── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.history-emoji { font-size: 24px; }

.history-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.history-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.history-meta .occasion-label { text-transform: capitalize; }

.sent-badge {
  margin-left: auto;
  padding: 4px 12px;
  background: #D1FAE5;
  color: #065F46;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.pending-badge {
  margin-left: auto;
  padding: 4px 12px;
  background: #FEF3C7;
  color: #92400E;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Empty States ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

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

.empty-state p {
  font-size: 15px;
}

/* ── Card Picker Modal ── */
.card-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 31, 26, 0.5);
  backdrop-filter: blur(4px);
}

.card-modal-panel {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 32px;
  width: min(640px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 64px rgba(42, 31, 26, 0.2);
}

.card-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.card-modal-title {
  font-family: 'Cormorant Garant', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.card-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-family: var(--font-body);
}

.card-option:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.card-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.card-option-image {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.card-option-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-option-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: var(--surface);
}

.card-option-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}

.card-option-tag {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
}

.card-picker-row {
  display: flex;
  align-items: center;
  gap: 0;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .dashboard-page { padding: 40px 16px 60px; }
  .dash-section { padding: 24px 20px; }
  .dash-title { font-size: 40px; }
  .form-row { grid-template-columns: 1fr; }
  .contact-card { flex-direction: column; align-items: flex-start; }
  .contact-right { width: 100%; justify-content: space-between; }
  .contact-actions { flex-wrap: wrap; }
}
/* ── Import Modal ── */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.import-btn {
  font-size: 13px;
}

.import-modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.import-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 31, 26, 0.5);
  backdrop-filter: blur(4px);
}

.import-modal-panel {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 32px;
  width: min(680px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 64px rgba(42, 31, 26, 0.2);
}

.import-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.import-modal-title {
  font-family: 'Cormorant Garant', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}

.import-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.import-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.import-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.import-drop-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}

.import-drop-text {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.import-file-name {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 12px;
}

.import-preview-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
  margin-top: 20px;
}

.import-errors-summary {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

.import-errors-summary.has-errors {
  background: #FEF3C7;
  color: #92400E;
}

.import-preview-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
}

.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.import-preview-table th {
  background: var(--surface);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}

.import-preview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}

.import-preview-table tr:last-child td { border-bottom: none; }

.import-preview-table tr.row-error td { background: #FEF3C7; }

.error-chip {
  display: inline-block;
  background: #FEE2E2;
  color: #991B1B;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin: 2px;
}

.import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.import-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.import-result-errors {
  max-height: 200px;
  overflow-y: auto;
  background: #FEF3C7;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

/* ── Card Modal Tabs ── */
.card-modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  margin-top: -8px;
}

.card-tab {
  padding: 8px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.card-tab:hover { color: var(--fg); }

.card-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel { width: 100%; }

/* ── AI Generation Panel ── */
.ai-gen-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-gen-prompt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-gen-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}

.ai-gen-remaining {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
}

.ai-gen-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg);
  resize: vertical;
  background: white;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.ai-gen-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.ai-gen-btn { width: 100%; }

.ai-gen-error {
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
}

/* ── AI Results Grid ── */
.ai-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 4px;
}

.ai-result-slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.ai-result-slot:hover { border-color: var(--accent); transform: translateY(-2px); }
.ai-result-slot.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* Shimmer loading placeholder */
.ai-result-slot.shimmer {
  background: linear-gradient(90deg, #f0e8de 25%, #e8ddd0 50%, #f0e8de 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  cursor: default;
  border-color: var(--border);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.ai-slot-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px;
  background: rgba(42, 31, 26, 0.65);
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.ai-result-slot:hover .ai-slot-overlay { opacity: 1; }

/* ── Drift Detection Panel ── */
.drift-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drift-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  transition: border-color 0.2s;
}

.drift-card.drift-heavy {
  border-color: #D4845A;
  background: #FFF7F2;
}

.drift-card.drift-mild {
  border-color: #E8B87A;
  background: #FFFBF4;
}

.drift-left {
  flex: 1;
  min-width: 0;
}

.drift-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--fg);
  margin-bottom: 4px;
}

.drift-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.drift-type {
  text-transform: capitalize;
  background: var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--muted);
}

.drift-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.drift-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.drift-badge-heavy {
  background: #FDEBD9;
  color: #B45A1A;
}

.drift-badge-mild {
  background: #FEF3D8;
  color: #8A6000;
}

@media (max-width: 600px) {
  .drift-card { flex-direction: column; align-items: flex-start; gap: 12px; }
  .drift-right { width: 100%; justify-content: flex-end; }
}

/* ── Trial / Plan pills ── */
.dash-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.trial-pill {
  display: inline-flex;
  align-items: center;
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1px solid var(--accent);
  border-radius: 30px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 4px;
  transition: background .15s;
}
.trial-pill:hover { background: var(--accent); color: #fff; }

.plan-pill {
  display: inline-flex;
  align-items: center;
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
  border-radius: 30px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 4px;
}

/* ── Import "How to export" helper ── */
.import-desc { font-size: 14px; color: var(--muted); margin-bottom: 16px; line-height: 1.6; }
.import-how-btn {
  background: none; border: none; color: var(--accent); font-size: 13px;
  font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline dotted;
}
.import-how-btn:hover { color: var(--accent-dark); }
.how-export-popover {
  display: flex;
  gap: 24px;
  background: var(--surface, #f8f6f3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}
.how-export-col { flex: 1; }
.how-export-col ol { margin: 6px 0 0 18px; padding: 0; }
.how-export-col li { margin-bottom: 4px; }
@media (max-width: 600px) {
  .how-export-popover { flex-direction: column; gap: 12px; }
}
