/* Global Reset and Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  /* Typography */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* Full viewport */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  transition: all 0.3s ease;
  position: relative;
}

body {
  line-height: 1.5;
  /* Dark Mode Variables (Fixed) */
  --primary-bg: #000000;
  --secondary-bg: #1a1a1a;
  --primary-text: #ffffff;
  --secondary-text: #a0a0a0;
  --border-color: #333333;
  --accent-color: #0a84ff;
  --hover-bg: #1a1a1a;
  --shadow-color: rgba(255, 255, 255, 0.1);
  --input-bg: #1a1a1a;
  
  background-color: var(--primary-bg);
  color: var(--primary-text);
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

button {
  cursor: pointer;
}

/* Remove default select arrow for consistency */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Time Picker Styles */
.time-picker-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  min-height: 100vh;
  animation: fadeIn 0.5s ease-in;
}

.main-title {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--primary-text);
}

.help-button-fixed {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary-text);
  color: var(--primary-bg);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  opacity: 0.3;
}

.help-button-fixed:hover {
  background: var(--secondary-text);
  opacity: 1;
  transform: scale(1.05);
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--secondary-text);
  margin-bottom: 3rem;
  font-weight: 300;
}

.time-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
}

.time-input-group {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.time-input {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.time-input label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--secondary-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.time-input-field {
  appearance: none;
  background: var(--input-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-text);
  width: 100px;
  text-align: center;
  transition: all 0.2s ease;
  font-variant-numeric: tabular-nums;
}

.time-input-field:hover {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--shadow-color);
}

.time-input-field:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--shadow-color);
}

.time-input-field::placeholder {
  color: var(--secondary-text);
  opacity: 0.7;
}

/* Hide number input spinners */
.time-input-field::-webkit-outer-spin-button,
.time-input-field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.time-input-field[type=number] {
  -moz-appearance: textfield;
}

.time-separator {
  font-size: 2rem;
  font-weight: 300;
  color: var(--secondary-text);
  margin: 0 0.5rem;
}

.start-button {
  background: var(--primary-text);
  color: var(--primary-bg);
  border: none;
  border-radius: 16px;
  padding: 1rem 3rem;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.start-button:hover:not(:disabled) {
  background: var(--secondary-text);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--shadow-color);
}

.start-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.start-button:disabled {
  background: var(--border-color);
  color: var(--secondary-text);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Countdown Timer Styles */
.countdown-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 2rem;
  animation: fadeIn 0.5s ease-in;
}

.countdown-display {
  display: flex;
  align-items: center;
  gap: clamp(0.25rem, 1.5vw, 1.5rem);
  flex-wrap: nowrap;
  justify-content: center;
  margin-bottom: 3rem;
  width: 100%;
  overflow: hidden;
}

.time-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.25rem, 1vw, 1rem);
  min-width: clamp(80px, 15vw, 300px);
  flex-shrink: 1;
}

.time-value {
  font-size: clamp(3rem, 18vw, 20rem);
  font-weight: 200;
  line-height: 0.8;
  color: var(--primary-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.time-label {
  font-size: clamp(1rem, 3vw, 1.5rem);
  font-weight: 500;
  color: var(--secondary-text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.time-separator-large {
  font-size: clamp(2rem, 12vw, 14rem);
  font-weight: 200;
  color: var(--border-color);
  margin: 0 clamp(0.25rem, 1vw, 1rem);
  flex-shrink: 0;
}

/* When hours are not displayed, make minutes and seconds larger */
.countdown-display.no-hours .time-unit {
  min-width: clamp(120px, 25vw, 400px);
}

.countdown-display.no-hours .time-value {
  font-size: clamp(4rem, 28vw, 28rem);
}

.countdown-display.no-hours .time-separator-large {
  font-size: clamp(3rem, 20vw, 20rem);
  margin: 0 clamp(0.5rem, 2vw, 2rem);
}

/* Overtime styling - red color when time has passed */
.countdown-display.overtime .time-value {
  color: #ff6b6b;
}

.countdown-display.overtime .time-separator-large {
  color: #ff6b6b;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Toast Notification Styles */
.toast {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #ff6b6b;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Help Modal Styles */
.help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 2rem;
}

.help-modal {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
}

.help-header h2 {
  color: var(--primary-text);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.help-close {
  background: none;
  border: none;
  color: var(--secondary-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.help-close:hover {
  background: var(--border-color);
  color: var(--primary-text);
}

.help-content {
  padding: 2rem;
}

.help-section {
  margin-bottom: 2rem;
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section h3 {
  color: var(--primary-text);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.help-examples {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.help-example {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.help-example code {
  background: var(--border-color);
  color: var(--accent-color);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.875rem;
  width: 180px;
  text-align: left;
  flex-shrink: 0;
}

.help-example span {
  color: var(--secondary-text);
  font-size: 0.875rem;
  flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
  .time-input-group {
    gap: 1rem;
  }
  
  .countdown-display {
    gap: clamp(0.25rem, 1vw, 0.75rem);
  }
  
  .time-separator-large {
    margin: 0 clamp(0.1rem, 0.5vw, 0.5rem);
  }
}

@media (max-width: 768px) {
  .help-overlay {
    padding: 1rem;
  }
  
  .help-content {
    padding: 1.5rem;
  }
  
  .help-example {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .help-example code {
    width: auto;
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .time-picker-container,
  .countdown-container {
    padding: 0.5rem;
  }
  
  .time-input-group {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .time-separator {
    display: none;
  }
  
  .countdown-display {
    flex-direction: row;
    gap: clamp(0.2rem, 0.8vw, 0.5rem);
    flex-wrap: nowrap;
  }
  
  .time-unit {
    min-width: clamp(60px, 12vw, 120px);
  }
  
  .help-button-fixed {
    bottom: 1rem;
    right: 1rem;
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
  }
  
  .help-overlay {
    padding: 0.5rem;
  }
  
  .help-header {
    padding: 1rem 1.5rem;
  }
  
  .help-content {
    padding: 1rem 1.5rem;
  }
}