@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-gradient: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --primary-blue: #2563eb;
  --primary-blue-light: #eff6ff;
  --on-green: #10b981;
  --on-green-light: #ecfdf5;
  --on-green-border: rgba(16, 185, 129, 0.2);
  --off-red: #f97316;
  --off-red-light: #fff7ed;
  --off-red-border: rgba(249, 115, 22, 0.2);
  
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
  --card-border: 1px solid rgba(255, 255, 255, 0.7);
  --warning-bg: #fffbeb;
  --warning-border: rgba(245, 158, 11, 0.3);
  --warning-text: #b45309;

  --font-family: 'Outfit', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and General styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  padding: 1.25rem 1rem 3rem 1rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Typography and Brand */
header {
  text-align: center;
  padding: 0.5rem 0;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.brand-icon {
  width: 32px;
  height: 32px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.025em;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Card base */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: var(--card-border);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px -10px rgba(37, 99, 235, 0.12);
}

/* Clock Card */
.clock-card {
  text-align: center;
  padding: 1.25rem 1.5rem;
}

.clock-label {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.clock-time {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary-blue);
  line-height: 1;
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.clock-time .colon {
  animation: blink 1.5s infinite;
  padding: 0 0.05em;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Time Selectors */
.inputs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-label-icon {
  font-size: 1.1rem;
}

/* Custom time select appearance */
.time-select-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.time-select {
  flex: 1;
  height: 56px;
  padding: 0 1rem;
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font-family);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid rgba(37, 99, 235, 0.1);
  border-radius: 16px;
  outline: none;
  transition: var(--transition);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
  text-align-last: center;
}

.time-select:focus {
  border-color: var(--primary-blue);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.time-select-separator {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-blue);
}

/* Summary Card (Configuración) - Crucial Visual Element */
.summary-card {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  color: #ffffff;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: none;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.summary-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
  margin-bottom: 1rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.summary-item-label {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.summary-item-val {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.summary-item.on .summary-item-label { color: #4ade80; }
.summary-item.off .summary-item-label { color: #f97316; }

/* Status Cards (Detail Cards) */
.detail-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.detail-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-radius: 20px;
  border-left-width: 6px;
}

.detail-card.on {
  background: var(--on-green-light);
  border-left-color: var(--on-green);
  border-top: 1px solid var(--on-green-border);
  border-right: 1px solid var(--on-green-border);
  border-bottom: 1px solid var(--on-green-border);
}

.detail-card.off {
  background: var(--off-red-light);
  border-left-color: var(--off-red);
  border-top: 1px solid var(--off-red-border);
  border-right: 1px solid var(--off-red-border);
  border-bottom: 1px solid var(--off-red-border);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.05);
  padding-bottom: 0.5rem;
}

.detail-title {
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.detail-card.on .detail-title { color: #047857; }
.detail-card.off .detail-title { color: #c2410c; }

.detail-time-target {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.detail-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.detail-exact {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.detail-exact strong {
  color: var(--text-main);
  font-weight: 600;
}

.detail-timer-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.detail-timer-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.detail-card.on .detail-timer-value { color: #065f46; }
.detail-card.off .detail-timer-value { color: #9a3412; }

.detail-remote-instruction {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.detail-remote-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.detail-deviation-msg {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
}

.detail-card.on .detail-deviation-msg {
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.detail-card.off .detail-deviation-msg {
  color: #9a3412;
  border: 1px solid rgba(249, 115, 22, 0.15);
}

.detail-estimated-real {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.detail-estimated-real strong {
  color: var(--text-main);
}

/* Timeline Card */
.timeline-card {
  padding: 1.25rem 1.5rem;
}

.timeline-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

.timeline-visual {
  position: relative;
  height: 60px;
  margin: 1.5rem 0.5rem 0.5rem 0.5rem;
}

.timeline-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: #e2e8f0;
  transform: translateY(-50%);
  z-index: 1;
  border-radius: 2px;
}

.timeline-line-filled {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-blue) 0%, var(--on-green) 50%, var(--off-red) 100%);
  transform: translateY(-50%);
  z-index: 2;
  border-radius: 2px;
  transition: var(--transition);
}

.timeline-node {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-node.now {
  left: 0;
}

.timeline-node.off {
  left: 100%;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #cbd5e1;
  transition: var(--transition);
  box-shadow: 0 0 0 3px #ffffff;
}

.timeline-node.now .timeline-dot {
  border-color: var(--primary-blue);
  background: var(--primary-blue);
}

.timeline-node.on .timeline-dot {
  border-color: var(--on-green);
  background: #ffffff;
}

.timeline-node.on.active .timeline-dot {
  background: var(--on-green);
}

.timeline-node.off .timeline-dot {
  border-color: var(--off-red);
  background: #ffffff;
}

.timeline-node.off.active .timeline-dot {
  background: var(--off-red);
}

.timeline-label {
  position: absolute;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  left: 50%;
  transform: translateX(-50%);
}

.timeline-node .timeline-label.top {
  bottom: 20px;
}

.timeline-node .timeline-label.bottom {
  top: 20px;
}

.timeline-node.now .timeline-label {
  color: var(--primary-blue);
}
.timeline-node.on .timeline-label {
  color: #047857;
}
.timeline-node.off .timeline-label {
  color: #c2410c;
}

.timeline-duration-label {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f1f5f9;
}

.timeline-duration-label strong {
  color: var(--primary-blue);
}

/* Warnings and Alerts */
.warning-card {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
}

.warning-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* Utility to hide elements cleanly */
.hidden {
  display: none !important;
}

/* Service Worker Install Banner */
.install-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary-blue-light);
  border: 1px solid rgba(37, 99, 235, 0.15);
  padding: 0.85rem 1.25rem;
  border-radius: 16px;
  margin-bottom: 0.5rem;
}

.install-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-blue);
}

.install-btn {
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
  transition: var(--transition);
}

.install-btn:hover {
  background: #1d4ed8;
}

/* Footer info */
footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1rem;
}

footer a {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 600;
}
