/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * Glass morphism and backdrop-filter effects are defined here — outside
 * Tailwind's optimizer — to prevent backdrop-filter from being stripped.
 */

/* ============================================================
   GLASS MORPHISM — dark mode defaults (warm brown-black palette)
   ============================================================ */

/* Lightest frosted layer — used for subtle overlays */
.glass {
  background: rgba(18, 18, 18, 0.72);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid #2a2a2a;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* Primary nav/topbar glass — used on all layout headers */
.glass-strong {
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid #2a2a2a;
  box-shadow: none;
}

/* Card-level frosted glass — used on panels, modals, cards */
.glass-card {
  background: #171717;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #2a2a2a;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* Active/selected state — sidebar items, active nav links */
.glass-active {
  background: #12351a;
  border: 1px solid transparent;
  box-shadow: none;
}

/* ============================================================
   LIGHT MODE — warm sand glass overrides
   ============================================================ */

html.light .glass {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: #e6e7ea;
  box-shadow: 0 1px 0 rgba(20, 20, 20, 0.04);
}

html.light .glass-strong {
  background: #ffffff;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: #e6e7ea;
  box-shadow: none;
}

html.light .glass-card {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: #e6e7ea;
  box-shadow: 0 1px 0 rgba(20, 20, 20, 0.04), 0 10px 28px rgba(20, 20, 20, 0.05);
}

html.light .glass-active {
  background: #f4f5f6;
  border-color: transparent;
  box-shadow: none;
}

/* ============================================================
   PAGE BACKGROUND
   Applied to <body> in each layout for depth and texture.
   ============================================================ */

/* Dark mode */
.page-bg {
  background: #0c0c0c;
  background-attachment: fixed;
}

/* Light mode */
html.light .page-bg {
  background: #ffffff;
  background-attachment: fixed;
}

/* ============================================================
   TURBO PROGRESS BAR
   Custom accent styling for Turbo Drive navigation indicator.
   ============================================================ */

.turbo-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: #27aa36;
  box-shadow: none;
  z-index: 2147483647;
  transition: width 300ms ease-out, opacity 150ms ease-in;
}

html.light .turbo-progress-bar {
  background: #1f6b2a;
  box-shadow: none;
}

/* ============================================================
   NATIVE DATE/TIME CONTROLS
   color-scheme on <html> drives dark/light calendar popups.
   Picker indicators are replaced with right-aligned SVG icons.
   ============================================================ */

html.dark {
  color-scheme: dark;
}

html.light {
  color-scheme: light;
}

html.dark input[type="date"],
html.dark input[type="datetime-local"],
html.dark input[type="time"],
html.dark input[type="month"],
html.dark input[type="week"],
html.light input[type="date"],
html.light input[type="datetime-local"],
html.light input[type="time"],
html.light input[type="month"],
html.light input[type="week"] {
  position: relative;
  padding-right: 2.75rem;
}

/* WebKit lays date text in a separate layer — keep it clear of the picker icon */
html.dark input[type="date"]::-webkit-datetime-edit-fields-wrapper,
html.dark input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper,
html.light input[type="date"]::-webkit-datetime-edit-fields-wrapper,
html.light input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper {
  max-width: calc(100% - 2.75rem);
}

/* Inline recurrence "until" date fields — fixed width, no flex shrink */
.form-date-input {
  flex-shrink: 0;
  width: 13.5rem;
  min-width: 13.5rem;
}

html.dark input[type="date"]::-webkit-calendar-picker-indicator,
html.dark input[type="datetime-local"]::-webkit-calendar-picker-indicator,
html.dark input[type="time"]::-webkit-calendar-picker-indicator,
html.dark input[type="month"]::-webkit-calendar-picker-indicator,
html.dark input[type="week"]::-webkit-calendar-picker-indicator,
html.light input[type="date"]::-webkit-calendar-picker-indicator,
html.light input[type="datetime-local"]::-webkit-calendar-picker-indicator,
html.light input[type="time"]::-webkit-calendar-picker-indicator,
html.light input[type="month"]::-webkit-calendar-picker-indicator,
html.light input[type="week"]::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.75rem;
  height: auto;
  margin: 0;
  padding: 0;
  cursor: pointer;
  opacity: 1;
  -webkit-appearance: none;
  appearance: none;
  background: center / 1.125rem 1.125rem no-repeat;
}

/* White calendar icon — matches dark mode body text */
html.dark input[type="date"]::-webkit-calendar-picker-indicator,
html.dark input[type="datetime-local"]::-webkit-calendar-picker-indicator,
html.dark input[type="month"]::-webkit-calendar-picker-indicator,
html.dark input[type="week"]::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fafafa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

html.dark input[type="time"]::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fafafa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}

/* Dark calendar/clock icons for light mode */
html.light input[type="date"]::-webkit-calendar-picker-indicator,
html.light input[type="datetime-local"]::-webkit-calendar-picker-indicator,
html.light input[type="month"]::-webkit-calendar-picker-indicator,
html.light input[type="week"]::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e293b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

html.light input[type="time"]::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e293b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}
