/* clock.css - Code Maven Clock Stylesheet */

/* Design Tokens & Variables */
:root {
  --bg-app: #08080c;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-timer-black: #000000;
  
  --color-orange: #ff7a00;
  --color-orange-glow: rgba(255, 122, 0, 0.35);
  --color-orange-subtle: rgba(255, 122, 0, 0.15);
  --color-orange-hover: #ff9533;
  
  --color-text-primary: #f3f4f6;
  --color-text-secondary: #9ca3af;
  --color-text-muted: #4b5563;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-focus: rgba(255, 122, 0, 0.5);
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  
  --shadow-glow-orange: 0 0 25px var(--color-orange-glow);
  --shadow-glow-subtle: 0 0 15px rgba(255, 255, 255, 0.02);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--color-text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% -20%, rgba(255, 122, 0, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 120%, rgba(30, 30, 45, 0.5) 0%, transparent 50%);
}

.app-wrapper {
  width: 100%;
  max-width: 500px;
  min-height: 680px;
  margin: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(13, 13, 17, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  padding: 30px;
  position: relative;
  z-index: 1;
}

/* Header & Tabs */
.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.logo-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, var(--color-text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tab-navigation {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  padding: 4px;
  border-radius: 14px;
  width: 100%;
}

.nav-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.nav-tab:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.nav-tab.active {
  color: var(--color-text-primary);
  background: var(--bg-card-hover);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-glow-subtle);
}

/* Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 10px 0;
}

.tab-view {
  width: 100%;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.tab-view.hidden-view {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Clock Tab Views */
.clock-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 40px 20px;
  text-align: center;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.01);
  overflow: hidden;
}

/* Digital Time Layout */
.clock-display-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  z-index: 2;
}

.digital-time {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 400;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.digital-ampm {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-orange);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.clock-meta {
  z-index: 2;
}

.date-display {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.timezone-display {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Pulse ring effect for local clock */
.clock-pulse-ring {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.02);
  animation: pulseOuter 4s infinite ease-in-out;
  pointer-events: none;
  z-index: 1;
}

@keyframes pulseOuter {
  0% {
    transform: scale(0.95);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.6;
    border-color: rgba(255, 122, 0, 0.05);
  }
  100% {
    transform: scale(0.95);
    opacity: 0.3;
  }
}

/* Timer Tab - STRICT BLACK BACKGROUND REQUIREMENT */
.timer-container-black {
  background-color: var(--bg-timer-black) !important;
  border-radius: 20px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

/* SVG ring overlay styling */
.svg-timer-wrapper {
  position: relative;
  width: 280px;
  height: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.progress-ring {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-ring-bg {
  stroke: #121216; /* very dark track */
}

.progress-ring-fg {
  transition: stroke-dashoffset 0.1s linear, stroke var(--transition-smooth);
  filter: drop-shadow(0 0 6px var(--color-orange-glow));
}

.timer-text-overlay {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  height: 100%;
}

.timer-digits {
  font-family: var(--font-mono);
  font-size: 3.2rem;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
  margin-top: 10px;
}

.timer-status-sub {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 4px;
}

/* Preset Buttons Grid */
.timer-control-group {
  width: 100%;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-subtitle {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-preset:hover {
  background: var(--color-orange-subtle);
  border-color: var(--color-orange);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

.btn-preset:active {
  transform: translateY(1px);
}

/* Custom time input fields */
.custom-timer-inputs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.input-field-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 70px;
}

.custom-timer-inputs input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  text-align: center;
  outline: none;
  transition: var(--transition-smooth);
}

.custom-timer-inputs input:focus {
  border-color: var(--color-orange-focus);
  background: rgba(255, 122, 0, 0.03);
  box-shadow: 0 0 10px rgba(255, 122, 0, 0.1);
}

/* Hide raw spinner arrows but allow standard numerical behavior */
.custom-timer-inputs input::-webkit-outer-spin-button,
.custom-timer-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.custom-timer-inputs input[type=number] {
  -moz-appearance: textfield;
}

.input-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

.colon-separator {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--color-text-secondary);
  margin-top: -16px;
}

.btn-action-set {
  align-self: stretch;
  background: transparent;
  border: 1px solid var(--color-orange);
  color: var(--color-orange);
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-smooth);
  height: 44px;
  margin-top: -16px;
}

.btn-action-set:hover {
  background: var(--color-orange);
  color: #000;
  box-shadow: var(--shadow-glow-orange);
}

/* Control Buttons Row (Start/Pause, Reset, Clear) */
.action-controls-group {
  margin-top: 24px;
}

.action-btn-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn-action {
  flex: 1;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-play {
  background: var(--color-orange);
  color: #000000;
  border: 1px solid var(--color-orange);
}

.btn-play:hover:not(:disabled) {
  background: var(--color-orange-hover);
  box-shadow: var(--shadow-glow-orange);
}

/* Dynamic State Classes for JS */
.btn-pause-state {
  background: transparent !important;
  color: var(--color-orange) !important;
  border: 1px solid var(--color-orange) !important;
}

.btn-pause-state:hover {
  background: var(--color-orange-subtle) !important;
}

.btn-reset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

.btn-reset:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-text-primary);
}

.btn-clear {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-secondary);
}

.btn-clear:hover {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.btn:disabled,
.btn-action:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  background: rgba(255, 255, 255, 0.02) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text-muted) !important;
}

/* Alarm alert animation */
.alarm-ringing {
  animation: ringFlash 1s infinite alternate;
}

@keyframes ringFlash {
  from {
    box-shadow: 0 0 15px rgba(255, 122, 0, 0.2);
    border-color: var(--color-border);
  }
  to {
    box-shadow: 0 0 35px rgba(239, 68, 68, 0.6);
    border-color: #ef4444;
  }
}

.alarm-ringing .progress-ring-fg {
  stroke: #ef4444 !important;
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.8)) !important;
}

.alarm-ringing .timer-digits {
  color: #ef4444 !important;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.5) !important;
}

/* Footer Section */
.app-footer {
  text-align: center;
  margin-top: 24px;
}

.app-footer p {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

/* Media Queries for Responsiveness */
@media (max-width: 480px) {
  .app-wrapper {
    margin: 10px;
    padding: 20px;
    min-height: auto;
  }
  
  .digital-time {
    font-size: 2.8rem;
  }
  
  .svg-timer-wrapper {
    width: 240px;
    height: 240px;
  }
  
  .progress-ring {
    width: 240px;
    height: 240px;
  }
  
  .timer-digits {
    font-size: 2.6rem;
  }
  
  .btn-grid {
    gap: 4px;
  }
  
  .btn-preset {
    font-size: 0.75rem;
  }
}
