/* ===== CSS Variables ===== */
:root {
  --primary-font: 'ManifoldDSA', Arial, sans-serif;
  --monospace-font: 'SpaceMono', monospace;
  --primary-color: #f8ebd7;
  --border-color: #ccc;
  --hover-bg: #f0f0f0;
  --focus-outline: #0066cc;
  
  /* Font sizes */
  --font-xs: 8px;
  --font-sm: 9px;
  --font-md: 16px;
  --font-lg: 20px;
  --font-lgr: 40px;
  --font-xl: 48px;
  --font-2xl: 60px;
  
  /* Spacing */
  --gap-xs: 2px;
  --gap-sm: 7px;
  --gap-md: 10px;
  
  /* Dimensions */
  --input-width-sm: 50px;
  --input-width-md: 70px;
  --input-width-lg: 150px;
  --img-height: 115px;
  --button-container-height: 16px;
  
  /* Timing */
  --transition-opacity: 0.2s ease;
}

/* ===== Reset & Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== Layout ===== */
body {
  font-family: var(--primary-font);
  display: grid;
  grid-template-rows: 80% 20%;
  grid-template-columns: 21% 79%;
  height: 100vh;
  overflow: hidden;
  gap: 0;
  background-color: var(--primary-color);
}

.quadrant {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  box-sizing: border-box;
  font-size: var(--font-xs);
}

/* ===== Typography ===== */
@font-face {
  font-family: 'ManifoldDSA';
  src: url('/fonts/ManifoldDSA-Regular.woff2') format('woff2'),
       url('/fonts/ManifoldDSA-Regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

.timer {
  font-family: var(--monospace-font);
  font-size: var(--font-2xl);
  margin-bottom: var(--gap-sm);
  font-weight: bolder;
}

.timer-label {
  font-size: var(--font-lgr);
}

.date-time {
  font-family: var(--monospace-font);
  font-size: var(--font-lg);
  text-align: left;
  overflow: visible; /* allow spill into adjacent area */
  line-height: 1.05;
  white-space: normal;
}

/* Ensure date/time box is anchored to the left edge of its container
   so any overflow only goes to the right (never to the left). */
#dateTime {
  /* Fill the quadrant's width so centering of the parent flex doesn't
     cause equal left/right overflow; content can still spill to the right. */
  width: 100%;
  /* Override parent .quadrant align-items: center horizontal centering */
  align-self: flex-start; /* for flex parent */
  justify-self: start;    /* for grid parent, harmless otherwise */
}

/* ===== Components ===== */

/* Timer-specific styles */
#agendaTimer .timer-label::before {
  content: "📖Agenda: ";
}

/* Button container */
.button-container {
  display: flex;
  gap: var(--gap-xs);
}

/* Buttons */
button {
  font-size: var(--font-sm);
  cursor: pointer;
  transition: opacity var(--transition-opacity);
}

button:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* Unified play/pause toggle button state styling */
.play-pause-btn.is-running {
  background: linear-gradient(135deg, #2c7a00, #4caf50);
  color: #fff;
  font-weight: 600;
}

.play-pause-btn.is-running:hover:not(:disabled) {
  filter: brightness(1.08);
}

button:hover:not(:disabled) {
  background-color: var(--hover-bg);
}

button:focus {
  outline: 4px solid var(--focus-outline);
}

/* Input fields */
.time-input {
  font-size: var(--font-md);
  width: var(--input-width-md);
  text-align: center;
}

.label-input {
  font-size: var(--font-xs);
  width: var(--input-width-lg);
  text-align: center;
}

.speaker-time-input,
.agenda-time-input {
  width: var(--input-width-sm);
}

/* ===== Utility Classes ===== */
.mt-10 {
  margin-top: var(--gap-md);
}

.text-center {
  text-align: center;
}

.h-130 {
  height: var(--img-height);
}

.h-16 {
  height: var(--button-container-height);
}

.h-14 {
  height: 14px;
}

/* ===== Special States ===== */
.resume-glow {
  background: linear-gradient(135deg, #eaff00, #fff65a);
  box-shadow: 0 0 0 2px #b1b500 inset, 0 0 10px rgba(234, 255, 0, 0.8);
  color: #000;
  font-weight: 700;
}

.resume-glow:hover {
  filter: brightness(1.05);
}

/* ===== Radio Highlight & Keyboard Focus ===== */
input[type="radio"][name="speakerTimerType"],
input[type="radio"][name="agendaTimerType"] {
  position: relative;
}

/* Highlight the label directly following a checked radio */
input[type="radio"][name="speakerTimerType"]:checked + label,
input[type="radio"][name="agendaTimerType"]:checked + label {
  background: linear-gradient(135deg, #ec1f27 0%, #ff585f 100%);
  color: #fff;
  border-radius: 6px;
  padding: 3px 6px;
  font-weight: 600;
  box-shadow: 0 0 0 2px #941116 inset;
}

/* Keyboard focus ring for radios (applied to label for visibility) */
input[type="radio"][name="speakerTimerType"]:focus + label,
input[type="radio"][name="agendaTimerType"]:focus + label {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
}

/* Smooth hover on labels */
input[type="radio"][name="speakerTimerType"] + label:hover,
input[type="radio"][name="agendaTimerType"] + label:hover {
  background-color: var(--hover-bg);
  border-radius: 6px;
}
