/* ============================================
   AI V&V Lab — Deadlines Calendar
   Soft, organic design — no hard boxes
   ============================================ */

/* --- Toolbar --- */
.dl-toolbar {
  padding-top: 8px;
  display: flex; flex-direction: column; gap: 10px;
}
.dl-toolbar__row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.dl-filters { display: flex; flex-wrap: wrap; gap: 6px; }

.dl-chip {
  padding: 6px 16px; border-radius: 100px;
  border: 1.5px solid transparent;
  background: var(--border-light);
  font-family: var(--font); font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  transition: all var(--transition); white-space: nowrap;
}
.dl-chip:hover { background: var(--primary-light); color: var(--primary); }
.dl-chip.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

.dl-search { position: relative; min-width: 180px; flex: 1; }
.dl-search input {
  width: 100%; padding: 8px 12px 8px 34px;
  border: none; border-radius: 100px;
  background: var(--border-light);
  font-family: var(--font); font-size: 0.85rem;
  outline: none; color: var(--text);
  transition: background var(--transition), box-shadow var(--transition);
}
.dl-search input:focus { background: #fff; box-shadow: 0 0 0 2px rgba(var(--primary-rgb),0.15); }
.dl-search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-light); pointer-events: none;
}

/* --- View switcher --- */
.dl-views {
  display: flex; gap: 2px; background: var(--border-light); border-radius: 10px; padding: 3px;
}
.dl-view-btn {
  padding: 6px 14px; border-radius: 8px; border: none; background: transparent;
  font-family: var(--font); font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 5px;
}
.dl-view-btn svg { width: 14px; height: 14px; }
.dl-view-btn:hover { color: var(--text); }
.dl-view-btn.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

/* --- Shared button --- */
.dl-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 100px;
  font-family: var(--font); font-size: 0.8rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border); background: var(--bg); color: var(--text);
}
.dl-btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow); }
.dl-btn svg { width: 14px; height: 14px; }
.dl-btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.dl-btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.dl-btn--sm { padding: 5px 12px; font-size: 0.75rem; }

/* --- Stats --- */
.dl-stats {
  display: flex; gap: 20px; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-secondary);
}
.dl-stat { display: flex; align-items: center; gap: 5px; }
.dl-stat strong { color: var(--text); font-weight: 700; font-size: 1.1rem; }

/* --- Main content area --- */
.dl-main {
  padding-top: 16px;
  min-height: 300px;
}

/* --- Badge --- */
.dl-badge {
  display: inline-block; padding: 2px 10px; border-radius: 100px;
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap;
}
.dl-badge--conference { background: var(--primary-light); color: var(--primary); }
.dl-badge--workshop { background: var(--accent-sand-light); color: var(--accent-sand-dark); }
.dl-badge--grant { background: #eff6ff; color: #2563eb; }
.dl-badge--journal { background: #f5f3ff; color: #7c3aed; }
.dl-badge--other { background: var(--border-light); color: var(--text-secondary); }

.dl-droc {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 100px;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.03em;
  white-space: nowrap;
}
.dl-droc--astar { background: #fef3c7; color: #92400e; }
.dl-droc--a { background: #dbeafe; color: #1e40af; }

/* --- Countdown --- */
.dl-countdown {
  font-family: 'SF Mono','Fira Code',monospace;
  font-size: 0.75rem; font-weight: 600;
  color: var(--primary); white-space: nowrap;
  padding: 2px 8px; border-radius: 6px;
  background: var(--primary-light);
}
.dl-countdown.dl-urgent { color: #dc2626; background: #fef2f2; animation: dlPulse 2s ease-in-out infinite; }
.dl-countdown.dl-passed { color: var(--text-light); background: var(--border-light); animation: none; }
@keyframes dlPulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

/* --- Checkbox --- */
.dl-check {
  width: 18px; height: 18px; border-radius: 5px;
  border: 2px solid var(--border);
  appearance: none; -webkit-appearance: none;
  cursor: pointer; transition: all var(--transition);
  flex-shrink: 0; position: relative;
  background: var(--bg);
}
.dl-check:hover { border-color: var(--primary); }
.dl-check:checked {
  background: var(--primary); border-color: var(--primary);
}
.dl-check:checked::after {
  content: '';
  position: absolute; top: 2px; left: 5px;
  width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ============================================
   VIEW: Cards (soft, borderless)
   ============================================ */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.dl-card {
  background: var(--bg);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  opacity: 0; transform: translateY(12px);
  animation: dlFadeIn 0.35s ease forwards;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.03);
}
.dl-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.07), 0 0 0 1px rgba(var(--primary-rgb),0.1);
  transform: translateY(-1px);
}
@keyframes dlFadeIn { to { opacity:1; transform:translateY(0); } }

.dl-card.dl-past { opacity: 0.45; }
.dl-card.dl-selected { box-shadow: 0 0 0 2px var(--primary), 0 4px 12px rgba(var(--primary-rgb),0.12); }

.dl-card__header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.dl-card__title {
  font-family: var(--font-heading); font-size: 1rem; font-weight: 600;
  line-height: 1.3; margin: 0 0 8px; color: var(--text);
}
.dl-card__title a { color: inherit; text-decoration: none; }
.dl-card__title a:hover { color: var(--primary); }

.dl-card__meta {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 10px;
}
.dl-card__meta span { display: inline-flex; align-items: center; gap: 4px; }
.dl-card__meta svg { width: 13px; height: 13px; opacity: 0.55; flex-shrink: 0; }

.dl-card__desc {
  font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5;
  margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.dl-card__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dl-card__action {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 100px;
  font-size: 0.7rem; font-weight: 500;
  background: var(--border-light); color: var(--text-secondary);
  text-decoration: none; cursor: pointer; border: none;
  transition: all var(--transition);
}
.dl-card__action:hover { background: var(--primary-light); color: var(--primary); }
.dl-card__action svg { width: 11px; height: 11px; }

/* ============================================
   VIEW: Timeline
   ============================================ */
.dl-timeline { position: relative; padding-left: 32px; }
.dl-timeline::before {
  content: ''; position: absolute; left: 11px; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(to bottom, var(--primary), var(--border));
  border-radius: 1px;
}

.dl-tl-month {
  position: relative; margin-bottom: 8px; padding-top: 8px;
}
.dl-tl-month__label {
  font-family: var(--font-heading); font-size: 0.75rem; font-weight: 700;
  color: var(--primary); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px; margin-left: -32px; padding-left: 32px;
  position: relative;
}
.dl-tl-month__label::before {
  content: ''; position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}

.dl-tl-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; margin-bottom: 6px;
  border-radius: 14px; background: var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all var(--transition);
  opacity: 0; transform: translateX(-10px);
  animation: dlSlideIn 0.35s ease forwards;
  position: relative;
}
.dl-tl-item::before {
  content: ''; position: absolute; left: -26px; top: 18px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); border: 2px solid #fff;
  transition: background var(--transition);
}
.dl-tl-item:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.dl-tl-item:hover::before { background: var(--primary); }
.dl-tl-item.dl-past { opacity: 0.4; }
.dl-tl-item.dl-selected { box-shadow: 0 0 0 2px var(--primary), 0 2px 8px rgba(var(--primary-rgb),0.1); }

@keyframes dlSlideIn { to { opacity:1; transform:translateX(0); } }

.dl-tl-item__body { flex: 1; min-width: 0; }
.dl-tl-item__top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap;
}
.dl-tl-item__title {
  font-family: var(--font-heading); font-size: 0.95rem; font-weight: 600; color: var(--text);
}
.dl-tl-item__title a { color: inherit; text-decoration: none; }
.dl-tl-item__title a:hover { color: var(--primary); }
.dl-tl-item__meta {
  font-size: 0.78rem; color: var(--text-secondary);
  display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 4px;
}
.dl-tl-item__meta span { display: inline-flex; align-items: center; gap: 3px; }
.dl-tl-item__meta svg { width: 12px; height: 12px; opacity: 0.5; }
.dl-tl-item__desc {
  font-size: 0.78rem; color: var(--text-light); line-height: 1.45;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dl-tl-item__actions { display: flex; gap: 6px; margin-top: 6px; }

/* ============================================
   VIEW: Calendar
   ============================================ */
.dl-cal { user-select: none; }

.dl-cal__nav {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-bottom: 16px;
}
.dl-cal__nav-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--border-light);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); color: var(--text-secondary);
}
.dl-cal__nav-btn:hover { background: var(--primary-light); color: var(--primary); }
.dl-cal__nav-btn svg { width: 16px; height: 16px; }
.dl-cal__month-label {
  font-family: var(--font-heading); font-size: 1.1rem; font-weight: 600;
  min-width: 180px; text-align: center;
}

.dl-cal__grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.dl-cal__dow {
  text-align: center; font-size: 0.7rem; font-weight: 600;
  color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 6px 0;
}
.dl-cal__cell {
  min-height: 80px; padding: 4px;
  border-radius: 10px; background: var(--bg);
  transition: background var(--transition);
  position: relative;
}
.dl-cal__cell:hover { background: var(--border-light); }
.dl-cal__cell--empty { background: transparent; }
.dl-cal__cell--today { box-shadow: inset 0 0 0 2px var(--primary); }
.dl-cal__day {
  font-size: 0.75rem; font-weight: 600; color: var(--text-secondary);
  padding: 2px 6px;
}
.dl-cal__cell--today .dl-cal__day {
  background: var(--primary); color: #fff; border-radius: 100px;
  display: inline-block;
}
.dl-cal__events { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.dl-cal__event {
  font-size: 0.65rem; font-weight: 500;
  padding: 2px 6px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; display: block;
}
.dl-cal__event:hover { filter: brightness(0.92); }
.dl-cal__event--conference { background: var(--primary-light); color: var(--primary); }
.dl-cal__event--workshop { background: var(--accent-sand-light); color: var(--accent-sand-dark); }
.dl-cal__event--grant { background: #eff6ff; color: #2563eb; }
.dl-cal__event--journal { background: #f5f3ff; color: #7c3aed; }
.dl-cal__event--other { background: var(--border-light); color: var(--text-secondary); }
.dl-cal__event--event { background: #dcfce7; color: #166534; }

/* Calendar tooltip */
.dl-cal__tooltip {
  display: none; position: absolute; z-index: 50;
  background: #fff; border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
  min-width: 220px; max-width: 280px;
  font-size: 0.8rem; line-height: 1.45; color: var(--text);
  pointer-events: none;
}
.dl-cal__tooltip.visible { display: block; pointer-events: auto; }
.dl-cal__tooltip h4 { font-family: var(--font-heading); font-size: 0.9rem; margin: 0 0 4px; }
.dl-cal__tooltip p { margin: 2px 0; color: var(--text-secondary); font-size: 0.78rem; }

/* ============================================
   Floating action bar
   ============================================ */
.dl-fab {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--primary-darker);
  color: #fff; border-radius: 100px; padding: 10px 24px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 12px 40px rgba(0,51,37,0.35);
  z-index: 100;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  font-size: 0.85rem; font-weight: 500;
  white-space: nowrap;
}
.dl-fab.visible { transform: translateX(-50%) translateY(0); }
.dl-fab__count { font-weight: 700; }
.dl-fab__sep { width: 1px; height: 20px; background: rgba(255,255,255,0.2); }
.dl-fab__btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 100px;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent; color: #fff;
  font-family: var(--font); font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none;
}
.dl-fab__btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.4); color: #fff; }
.dl-fab__btn svg { width: 14px; height: 14px; }
.dl-fab__close {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.1);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: background var(--transition);
}
.dl-fab__close:hover { background: rgba(255,255,255,0.2); }

/* ============================================
   Loading / Empty
   ============================================ */
.dl-loading { text-align: center; padding: 64px 24px; }
.dl-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: dlSpin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes dlSpin { to{transform:rotate(360deg)} }
.dl-empty {
  text-align: center; padding: 64px 24px; color: var(--text-light);
}
.dl-empty svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.35; }

/* --- Dividers --- */
.dl-divider {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.75rem; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 16px 0 10px;
}
.dl-divider::before, .dl-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ============================================
   Submit section
   ============================================ */
.dl-submit-section {
  padding: 24px 0 56px;
}
.dl-submit-card {
  overflow: hidden;
}
.dl-submit-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; cursor: pointer; user-select: none;
  background: var(--primary); border: 2px solid var(--primary);
  border-radius: 8px;
  font-family: var(--font-heading); font-size: 0.9rem; font-weight: 600;
  color: #fff; transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,103,71,0.2);
}
.dl-submit-toggle:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.dl-submit-toggle svg { width: 16px; height: 16px; transition: transform 0.3s ease; }
.dl-submit-toggle.open svg { transform: rotate(180deg); }
.dl-submit-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1);
}
.dl-submit-body.open { max-height: 800px; }
.dl-form {
  padding: 20px 24px 24px;
  margin-top: 16px;
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.03);
}
.dl-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.dl-form-full { margin-bottom: 14px; }
.dl-form label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.dl-form input, .dl-form select, .dl-form textarea {
  width: 100%; padding: 9px 12px;
  border: none; border-radius: 10px;
  background: var(--border-light);
  font-family: var(--font); font-size: 0.875rem;
  outline: none; color: var(--text);
  transition: background var(--transition), box-shadow var(--transition);
}
.dl-form input:focus, .dl-form select:focus, .dl-form textarea:focus {
  background: #fff; box-shadow: 0 0 0 2px rgba(var(--primary-rgb),0.15);
}
.dl-form textarea { resize: vertical; min-height: 64px; }
.dl-form-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.dl-form-msg { font-size: 0.85rem; line-height: 1.5; }
.dl-form-msg.success { color: var(--primary); }
.dl-form-msg.error { color: #dc2626; }

/* ============================================
   Select all row
   ============================================ */
.dl-select-all {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: var(--text-secondary);
  cursor: pointer; padding: 4px 0; margin-bottom: 8px;
}
.dl-select-all label { cursor: pointer; user-select: none; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .dl-grid { grid-template-columns: 1fr; }
  .dl-cal__grid { gap: 1px; }
  .dl-cal__cell { min-height: 56px; }
  .dl-cal__event { font-size: 0.55rem; }
  .dl-toolbar__row { flex-direction: column; align-items: stretch; }
  .dl-search { min-width: 0; }
  .dl-form-row { grid-template-columns: 1fr; }
  .dl-fab { padding: 8px 16px; gap: 8px; font-size: 0.8rem; }
}
@media (max-width: 420px) {
  .dl-card { padding: 16px; }
  .dl-main { padding-top: 12px; }
}
