/* ============================================================================
   Rayminder — design system (v0.3 visual overhaul)
   Layered on top of Bootstrap 5. Theme-aware (light/dark), soft elevation,
   refined type + spacing, animated interactions. Works with existing markup.
   ========================================================================= */

:root {
  --ray-bg: #f5f7fb;
  --ray-surface: #ffffff;
  --ray-surface-2: #f8fafc;
  --ray-border: #e6e9f0;
  --ray-text: #1f2733;
  --ray-muted: #6b7688;
  --ray-primary: #3b6ef6;
  --ray-primary-600: #2f5be0;
  --ray-primary-050: #eaf0ff;
  --ray-success: #1f9d6b;
  --ray-warning: #d98a04;
  --ray-danger: #e5484d;
  --ray-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --ray-shadow-lg: 0 12px 40px rgba(16,24,40,.16);
  --ray-radius: 14px;
  --ray-radius-sm: 10px;
}

:root[data-theme="dark"], html.ray-dark {
  --ray-bg: #0f1420;
  --ray-surface: #171d2b;
  --ray-surface-2: #1e2536;
  --ray-border: #2a3346;
  --ray-text: #e6eaf2;
  --ray-muted: #97a1b5;
  --ray-primary: #5b86ff;
  --ray-primary-600: #6f95ff;
  --ray-primary-050: #1b2540;
  --ray-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --ray-shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}

body {
  -webkit-tap-highlight-color: transparent;
  background: var(--ray-bg) !important;
  color: var(--ray-text);
  font-feature-settings: "cv02","cv03","cv04","cv11";
}

/* ---- Top bar ------------------------------------------------------------- */
.navbar.bg-primary {
  background: linear-gradient(90deg, var(--ray-primary-600), var(--ray-primary)) !important;
  box-shadow: 0 2px 16px rgba(59,110,246,.25);
}
.navbar-brand { font-weight: 700; letter-spacing: -0.01em; }
.navbar .form-control { border: none; border-radius: 999px; }

/* ---- Surfaces / cards --------------------------------------------------- */
.tab-content.bg-white,
#search-results-wrap .list-group,
.modal-content {
  background: var(--ray-surface) !important;
  color: var(--ray-text);
  border-color: var(--ray-border) !important;
  border-radius: var(--ray-radius) !important;
  box-shadow: var(--ray-shadow);
}
.modal-content { box-shadow: var(--ray-shadow-lg); }

/* ---- Tabs --------------------------------------------------------------- */
.nav-tabs { border-bottom-color: var(--ray-border); gap: .15rem; }
.nav-tabs .nav-link {
  color: var(--ray-muted); border: none; border-radius: 10px 10px 0 0;
  padding: .55rem .9rem; font-weight: 600; font-size: .95rem;
  transition: background .15s ease, color .15s ease;
}
.nav-tabs .nav-link:hover { color: var(--ray-text); background: var(--ray-surface-2); }
.nav-tabs .nav-link.active {
  color: var(--ray-primary); background: var(--ray-surface) !important;
  border: none; box-shadow: inset 0 -2.5px 0 var(--ray-primary);
}

/* ---- List rows ---------------------------------------------------------- */
.list-group { border-radius: var(--ray-radius-sm); overflow: hidden; }
.list-group-item {
  background: var(--ray-surface); color: var(--ray-text);
  border-color: var(--ray-border);
  padding: .8rem .9rem; transition: background .12s ease, transform .12s ease;
}
.list-group-item:hover { background: var(--ray-surface-2); }
.item-clickable:hover .fw-medium { color: var(--ray-primary); }
.list-group-item .btn-group .btn { line-height: 1; }

/* Section headings inside Today */
#tab-today h2.h6 { font-weight: 700; letter-spacing: .01em; text-transform: uppercase; font-size: .72rem; opacity: .85; }

/* ---- Buttons ------------------------------------------------------------ */
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--ray-primary); border-color: var(--ray-primary); }
.btn-primary:hover { background: var(--ray-primary-600); border-color: var(--ray-primary-600); }
.btn-outline-primary { color: var(--ray-primary); border-color: var(--ray-primary); }
.btn-group-sm > .btn, .btn-sm { border-radius: 8px; }

/* ---- Badges / priority -------------------------------------------------- */
.badge { font-weight: 600; border-radius: 7px; letter-spacing: .01em; }
.text-bg-danger { background: var(--ray-danger) !important; }
.text-bg-warning { background: var(--ray-warning) !important; color: #fff !important; }

/* ---- Overview stat tiles (new) ----------------------------------------- */
.ray-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin: .25rem 0 1rem; }
@media (max-width: 640px) { .ray-stats { grid-template-columns: repeat(2, 1fr); } }
.ray-stat {
  background: var(--ray-surface); border: 1px solid var(--ray-border);
  border-radius: var(--ray-radius-sm); padding: .8rem .9rem; box-shadow: var(--ray-shadow);
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, border-color .15s ease;
}
.ray-stat:hover { transform: translateY(-2px); box-shadow: var(--ray-shadow-lg); border-color: var(--ray-primary); }
.ray-stat .num { font-size: 1.7rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.ray-stat .lbl { font-size: .74rem; color: var(--ray-muted); text-transform: uppercase; letter-spacing: .03em; margin-top: .25rem; }
.ray-stat.accent-danger .num { color: var(--ray-danger); }
.ray-stat.accent-warning .num { color: var(--ray-warning); }
.ray-stat.accent-primary .num { color: var(--ray-primary); }
.ray-stat.accent-success .num { color: var(--ray-success); }

/* ---- Voice button ------------------------------------------------------- */
.voice-btn {
  width: 132px; height: 132px; border-radius: 50%; border: none;
  background: radial-gradient(circle at 35% 30%, #6f95ff, var(--ray-primary) 60%, var(--ray-primary-600));
  color: #fff; box-shadow: 0 10px 30px rgba(59,110,246,.4);
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.voice-btn:hover { transform: translateY(-2px) scale(1.02); }
.voice-btn:active { transform: scale(0.95); }
.voice-btn:disabled { background: #9aa4b5; box-shadow: none; cursor: not-allowed; }
.voice-icon { font-size: 3.3rem; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.voice-btn.listening { animation: ray-pulse 1.3s infinite; }
@keyframes ray-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(59,110,246,.5); }
  70%  { box-shadow: 0 0 0 26px rgba(59,110,246,0); }
  100% { box-shadow: 0 0 0 0 rgba(59,110,246,0); }
}
.voice-btn.processing { opacity: .7; animation: ray-spin 1s linear infinite; }
@keyframes ray-spin { to { transform: rotate(360deg); } }
.voice-btn-sm { width: 118px; height: 118px; }
.voice-btn-sm .voice-icon { font-size: 2.9rem; }

/* ---- Misc --------------------------------------------------------------- */
.proj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; box-shadow: 0 0 0 2px var(--ray-surface); }
#alert { border-radius: var(--ray-radius-sm); border: none; box-shadow: var(--ray-shadow); position: sticky; top: .5rem; z-index: 1080; }
.form-control, .form-select { border-radius: 10px; border-color: var(--ray-border); background: var(--ray-surface); color: var(--ray-text); }
.form-control:focus, .form-select:focus { border-color: var(--ray-primary); box-shadow: 0 0 0 3px var(--ray-primary-050); }
.modal-header, .modal-footer { border-color: var(--ray-border); }
.text-secondary, .text-muted { color: var(--ray-muted) !important; }

/* Fade-in for rendered lists */
.list-group-item { animation: ray-fade .18s ease both; }
@keyframes ray-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

main { padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
