/* ============================================================================
   MATERIAL DESIGN 2 — Component styles
   Built on the tokens in colors_and_type.css. Class prefix: .mdc-
   ============================================================================ */

/* ---------- Material Icons (inline SVG, sized in em) ---------- */
/* Icons render as inline SVG via assets/md-icons.js — no webfont dependency,
   so glyphs survive every export pipeline. font-size controls icon size. */
.material-icons, .mi {
  font-size: 24px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex: none;
}
.material-icons svg, .mi svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
  display: block;
}

/* ---------- Ripple / state layer ---------- */
.mdc-ripple {
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.mdc-ripple::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--md-dur-short) var(--md-ease-standard);
  pointer-events: none;
}
.mdc-ripple:hover::before  { opacity: var(--md-state-hover); }
.mdc-ripple:focus-visible::before { opacity: var(--md-state-focus); }

/* Radial ink ripple that spreads from the touch point (spawned by md-ripple.js).
   Holds a constant tone while expanding, then fades out as a whole — so the
   wave is one uniform darker color, never lighter-center / darker-edge. */
.mdc-ripple__ink {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.24;
  transform: scale(0);
  pointer-events: none;
  animation: mdc-ripple-spread 560ms var(--md-ease-standard) forwards;
}
@keyframes mdc-ripple-spread {
  0%   { transform: scale(0);   opacity: 0.24; }
  55%  { transform: scale(1);   opacity: 0.24; }
  100% { transform: scale(1);   opacity: 0; }
}

/* ============================  BUTTONS  ============================ */
.mdc-btn {
  font-family: var(--md-font);
  font-weight: 500; font-size: 14px; letter-spacing: 1.25px; line-height: 36px;
  text-transform: uppercase;
  height: 36px; min-width: 64px; padding: 0 16px;
  border: none; border-radius: var(--md-shape-small);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; user-select: none; background: transparent;
  transition: box-shadow var(--md-dur-mobile) var(--md-ease-standard),
              background-color var(--md-dur-short) var(--md-ease-standard);
}
.mdc-btn .material-icons { font-size: 18px; }

/* Text button */
.mdc-btn--text { color: var(--md-primary); padding: 0 8px; }

/* Outlined button */
.mdc-btn--outlined {
  color: var(--md-primary);
  border: 1px solid var(--md-outline);
  padding: 0 15px;
}

/* Contained (raised) button */
.mdc-btn--contained {
  color: var(--md-on-primary);
  background: var(--md-primary);
  box-shadow: var(--md-elev-02);
}
.mdc-btn--contained:hover  { box-shadow: var(--md-elev-04); }
.mdc-btn--contained:active { box-shadow: var(--md-elev-08); }

.mdc-btn:disabled,
.mdc-btn[disabled] {
  color: var(--md-on-surface-disabled);
  background: transparent; box-shadow: none; cursor: default; pointer-events: none;
}
.mdc-btn--contained:disabled {
  background: rgba(0,0,0,0.12);
}

/* FAB */
.mdc-fab {
  width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--md-secondary); color: var(--md-on-secondary);
  box-shadow: var(--md-elev-06);
  display: inline-flex; align-items: center; justify-content: center;
  transition: box-shadow var(--md-dur-mobile) var(--md-ease-standard);
}
.mdc-fab:hover  { box-shadow: var(--md-elev-08); }
.mdc-fab:active { box-shadow: var(--md-elev-12); }
.mdc-fab--mini  { width: 40px; height: 40px; }
.mdc-fab--extended {
  width: auto; height: 48px; border-radius: 24px; padding: 0 20px; gap: 12px;
  font-family: var(--md-font); font-weight: 500; font-size: 14px;
  letter-spacing: 1.25px; text-transform: uppercase;
}

/* Icon button */
.mdc-icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: none; background: transparent;
  color: var(--md-on-surface-medium); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ============================  CARDS  ============================ */
.mdc-card {
  background: var(--md-surface);
  border-radius: var(--md-shape-medium);
  box-shadow: var(--md-elev-01);
  overflow: hidden;
  color: var(--md-on-surface-high);
}
.mdc-card--outlined { box-shadow: none; border: 1px solid var(--md-divider); }

/* ============================  CHIPS  ============================ */
.mdc-chip {
  height: 32px; padding: 0 12px; border-radius: 16px;
  background: rgba(0,0,0,0.08); color: var(--md-on-surface-high);
  font-family: var(--md-font); font-size: 14px; letter-spacing: 0.25px;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: none;
}
.mdc-chip--outlined { background: transparent; border: 1px solid var(--md-divider); }
.mdc-chip--selected { background: rgba(98,0,238,0.12); color: var(--md-primary); }
.mdc-chip .material-icons { font-size: 18px; }

/* ============================  TEXT FIELDS  ============================ */
.mdc-field { position: relative; display: inline-flex; flex-direction: column; min-width: 240px; }

/* Filled */
.mdc-field--filled {
  background: rgba(0,0,0,0.06);
  border-radius: 4px 4px 0 0;
  border-bottom: 1px solid var(--md-outline);
  padding: 20px 12px 6px;
}
.mdc-field--filled:focus-within { border-bottom: 2px solid var(--md-primary); padding-bottom: 5px; }
.mdc-field--filled label {
  position: absolute; left: 12px; top: 18px;
  color: var(--md-on-surface-medium); font-family: var(--md-font); font-size: 16px;
  pointer-events: none; transform-origin: left;
  transition: all var(--md-dur-enter) var(--md-ease-standard);
}
.mdc-field--filled:focus-within label,
.mdc-field--filled.is-filled label,
.mdc-field--filled:has(input:not(:placeholder-shown)) label,
.mdc-field--filled:has(textarea:not(:placeholder-shown)) label { top: 6px; font-size: 12px; }
.mdc-field--filled:focus-within label { color: var(--md-primary); }

/* Outlined */
.mdc-field--outlined {
  border: 1px solid var(--md-outline);
  border-radius: 4px;
  padding: 14px 12px;
}
.mdc-field--outlined:focus-within { border: 2px solid var(--md-primary); padding: 13px 11px; }
.mdc-field--outlined label {
  position: absolute; left: 10px; top: 14px; padding: 0 4px;
  background: var(--md-surface); color: var(--md-on-surface-medium); font-family: var(--md-font); font-size: 16px; pointer-events: none;
  transition: all var(--md-dur-enter) var(--md-ease-standard);
}
.mdc-field--outlined:focus-within label,
.mdc-field--outlined.is-filled label,
.mdc-field--outlined:has(input:not(:placeholder-shown)) label,
.mdc-field--outlined:has(textarea:not(:placeholder-shown)) label { top: -8px; font-size: 12px; }
.mdc-field--outlined:focus-within label { color: var(--md-primary); }

.mdc-field input, .mdc-field textarea {
  border: none; background: transparent; outline: none;
  font-family: var(--md-font); font-size: 16px; color: var(--md-on-surface-high);
  width: 100%;
}
/* Hide the placeholder text itself — it only exists so :placeholder-shown can
   detect the empty state. The resting label visually sits in its place. */
.mdc-field input::placeholder, .mdc-field textarea::placeholder { color: transparent; }
.mdc-field .mdc-field__help {
  font-size: 12px; letter-spacing: 0.4px; color: var(--md-on-surface-medium);
  padding: 4px 12px 0;
}

/* ============================  SELECTION CONTROLS  ============================ */
.mdc-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.mdc-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.mdc-switch__track {
  width: 36px; height: 14px; border-radius: 7px;
  background: rgba(0,0,0,0.38);
  transition: background var(--md-dur-short) var(--md-ease-standard);
}
.mdc-switch__thumb {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: #FAFAFA;
  box-shadow: var(--md-elev-02);
  transition: transform var(--md-dur-short) var(--md-ease-standard), background var(--md-dur-short);
}
.mdc-switch input:checked ~ .mdc-switch__track { background: rgba(98,0,238,0.5); }
.mdc-switch input:checked ~ .mdc-switch__thumb { transform: translateY(-50%) translateX(16px); background: var(--md-primary); }

.mdc-check, .mdc-radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-family: var(--md-font); font-size: 16px; color: var(--md-on-surface-high); }
.mdc-check input, .mdc-radio input { accent-color: var(--md-primary); width: 18px; height: 18px; }

/* ---- Selection-control circular ripple host (40dp state layer) ---- */
/* Wrap a checkbox/radio input in <span class="mdc-ctrl">…</span> to give it a
   centred 40dp circular ripple + hover state layer, matching the MD2 spec. */
.mdc-ctrl {
  position: relative; flex: none;
  width: 40px; height: 40px; margin: -11px -7px -11px -11px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden;
}
.mdc-ctrl input { accent-color: var(--md-primary); width: 18px; height: 18px; margin: 0; cursor: pointer; }
.mdc-ctrl::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: currentColor; opacity: 0; pointer-events: none;
  transition: opacity var(--md-dur-short) var(--md-ease-standard);
}
.mdc-check:hover .mdc-ctrl::before,
.mdc-radio:hover .mdc-ctrl::before { opacity: var(--md-state-hover); }

/* Switch ripple state layer — centred on the thumb, travels with it */
.mdc-switch__ripple {
  position: absolute; left: 0; top: 50%; width: 40px; height: 40px;
  margin: -20px 0 0 -10px; border-radius: 50%; overflow: hidden;
  pointer-events: none;
  transition: transform var(--md-dur-short) var(--md-ease-standard);
}
.mdc-switch input:checked ~ .mdc-switch__ripple { transform: translateX(16px); }
.mdc-switch:hover .mdc-switch__ripple::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--md-primary); opacity: var(--md-state-hover);
}

/* ============================  APP BAR  ============================ */
.mdc-appbar {
  height: 64px; padding: 0 16px;
  background: var(--md-primary); color: var(--md-on-primary);
  display: flex; align-items: center; gap: 20px;
  box-shadow: var(--md-elev-04);
}
.mdc-appbar__title { font-family: var(--md-font); font-weight: 500; font-size: 20px; letter-spacing: 0.15px; }

/* ============================  LIST  ============================ */
.mdc-list { padding: 8px 0; }
.mdc-list__item {
  height: 48px; padding: 0 16px; display: flex; align-items: center; gap: 32px;
  font-family: var(--md-font); font-size: 16px; color: var(--md-on-surface-high); cursor: pointer;
}
.mdc-list__item--2line { height: 72px; }
.mdc-list__item .material-icons { color: var(--md-on-surface-medium); }

/* ============================  DIVIDER  ============================ */
.mdc-divider { height: 1px; background: var(--md-divider); border: none; }

/* ============================  SNACKBAR  ============================ */
.mdc-snackbar {
  min-width: 344px; max-width: 672px; min-height: 48px;
  background: #323232; color: rgba(255,255,255,0.87);
  border-radius: 4px; box-shadow: var(--md-elev-06);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px 6px 16px;
  font-family: var(--md-font); font-size: 14px; letter-spacing: 0.25px;
}
.mdc-snackbar .mdc-btn--text { color: var(--md-secondary); }

/* ============================  LINEAR / CIRCULAR PROGRESS  ============================ */
.mdc-linear { height: 4px; width: 100%; background: rgba(98,0,238,0.24); overflow: hidden; border-radius: 2px; position: relative; }
.mdc-linear__bar { position: absolute; height: 100%; background: var(--md-primary); border-radius: 2px; }

/* Indeterminate — a single bar sweeping continuously across the track. */
.mdc-linear--indeterminate .mdc-linear__bar {
  width: 40%;
  animation: mdc-linear-indeterminate 1.6s infinite var(--md-ease-standard);
}
@keyframes mdc-linear-indeterminate {
  0%   { left: -40%; }
  100% { left: 100%; }
}
@keyframes mdc-spin { to { transform: rotate(360deg); } }

/* ============================  SLIDER  ============================ */
.mdc-slider { position: relative; height: 2px; background: rgba(98,0,238,0.24); border-radius: 2px; cursor: pointer; touch-action: none; }
.mdc-slider__track { position: absolute; height: 100%; background: var(--md-primary); border-radius: 2px; pointer-events: none; }
.mdc-slider__thumb {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  background: var(--md-primary); transform: translate(-50%, -50%);
}
/* 40dp circular state layer centred on the thumb */
.mdc-slider__ripple {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px;
  margin: -20px 0 0 -20px; border-radius: 50%; overflow: hidden; pointer-events: none;
}
.mdc-slider:hover .mdc-slider__ripple::before,
.mdc-slider.is-active .mdc-slider__ripple::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--md-primary); opacity: var(--md-state-hover);
}

/* ============================  TABS  ============================ */
.mdc-tabs { display: flex; box-shadow: inset 0 -1px 0 var(--md-divider); }
.mdc-tab {
  height: 48px; padding: 0 16px; min-width: 90px;
  font-family: var(--md-font); font-weight: 500; font-size: 14px; letter-spacing: 1.25px;
  text-transform: uppercase; color: var(--md-on-surface-medium);
  background: transparent; border: none; cursor: pointer; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.mdc-tab--active { color: var(--md-primary); }
.mdc-tab--active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--md-primary);
}

/* ============================  DIALOG  ============================ */
.mdc-dialog {
  background: var(--md-surface); border-radius: 4px; box-shadow: var(--md-elev-24);
  min-width: 280px; max-width: 560px; padding: 0;
}
.mdc-dialog__title { font-family: var(--md-font); font-weight: 500; font-size: 20px; letter-spacing: 0.15px; padding: 20px 24px 0; color: var(--md-on-surface-high); }
.mdc-dialog__content { font-family: var(--md-font); font-size: 16px; line-height: 24px; letter-spacing: 0.5px; color: var(--md-on-surface-medium); padding: 20px 24px; }
.mdc-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px; }

/* ============================  MENU  ============================ */
.mdc-menu {
  background: var(--md-surface); border-radius: 4px; box-shadow: var(--md-elev-08);
  padding: 8px 0; min-width: 112px; max-width: 280px;
}
.mdc-menu__item {
  height: 48px; padding: 0 16px; display: flex; align-items: center; gap: 12px;
  font-family: var(--md-font); font-size: 16px; color: var(--md-on-surface-high); cursor: pointer;
}
