/* =========================================
   Time Converter - Glassmorphism Styles
========================================= */

/* --- Main Layout & Ad Spaces --- */
.page-wrapper {
  width: 90%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 6fr 1fr; /* Forces the 12.5% / 75% / 12.5% ratio */
  gap: 2rem;
  padding: 50px 0 4rem 0; /* 100px clears the fixed global header */
  flex: 1;
}

.ad-space-left,
.ad-space-right {
  width: 100%;
  min-height: 600px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px dashed var(--glass-border, rgba(255, 255, 255, 0.7));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #475569);
  font-size: 0.8rem;
}

.main-content {
  width: 100%;
  min-width: 0; /* CRITICAL FIX: Prevents the inner timeline from breaking the grid width */
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* --- Glassmorphism Components --- */
.glass-panel {
  background: var(--glass-bg, rgba(255, 255, 255, 0.55));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.7));
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--glass-shadow, 0 8px 32px 0 rgba(0, 85, 255, 0.15));
}

/* --- Background Shapes --- */
.background-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}
.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.6;
}
.shape-1 {
  width: 400px;
  height: 400px;
  background: #00a2ff;
  top: -100px;
  left: -100px;
}
.shape-2 {
  width: 500px;
  height: 500px;
  background: #0033cc;
  bottom: -150px;
  right: -100px;
}
.shape-3 {
  width: 300px;
  height: 300px;
  background: #7dd3fc;
  top: 40%;
  left: 30%;
}

/* --- General Typography & Controls --- */
h1 {
  margin-bottom: 1.5rem;
  color: var(--text-dark, #1e293b);
  font-size: 1.8rem;
}
h2 {
  font-size: 1.4rem;
  color: var(--text-dark, #1e293b);
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--glass-border);
  padding-bottom: 0.5rem;
}

.controls {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.input-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-dark, #1e293b);
}
.input-group input {
  padding: 0.75rem;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.7));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-dark, #1e293b);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  height: 45px;
  transition: border-color 0.2s ease;
}
.input-group input:focus {
  border-color: var(--accent, #0055ff);
}

.generate-btn {
  background: var(--accent, #0055ff);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  height: 45px;
  padding: 0 1.5rem;
  transition:
    background 0.2s,
    transform 0.1s;
}
.generate-btn:hover {
  background: var(--accent-hover, #0033cc);
}
.generate-btn:active {
  transform: scale(0.98);
}

/* --- Search Dropdown --- */
.search-container {
  position: relative;
}
#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  max-height: 250px;
  overflow-y: auto;
  display: none;
  z-index: 100;
  box-shadow: 0 8px 32px 0 rgba(0, 85, 255, 0.15);
  margin-top: 0.25rem;
}
.search-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 0.95rem;
  color: var(--text-dark);
}
.search-item:hover {
  background: rgba(0, 85, 255, 0.08);
  color: var(--accent);
}

/* --- Format Toggle Switch --- */
.format-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0 1rem;
  height: 45px;
}
.format-toggle span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.format-toggle span.active {
  color: var(--accent);
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  border-radius: 24px;
  transition: 0.2s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}
input:checked + .slider {
  background-color: var(--accent);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* --- Timeline Layout --- */
.tz-row {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
}
.tz-remove {
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ef4444;
  padding-right: 1rem;
  transition: transform 0.1s;
}
.tz-remove:hover {
  transform: scale(1.1);
}
.tz-info {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--glass-border);
  padding-right: 1rem;
}
.tz-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-dark);
}
.tz-current {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.timeline-container {
  display: flex;
  flex-grow: 1;
  overflow-x: auto;
  padding-left: 1rem;
  gap: 4px;
}
.timeline-container::-webkit-scrollbar {
  height: 6px;
}
.timeline-container::-webkit-scrollbar-thumb {
  background: rgba(0, 85, 255, 0.3);
  border-radius: 4px;
}

.hour-block {
  min-width: 45px;
  height: 45px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.5);
}
.hour-block:hover {
  background: rgba(0, 85, 255, 0.1);
}
.hour-block.business-hour {
  background: rgba(0, 255, 136, 0.1);
  border: 1px dashed rgba(0, 255, 136, 0.3);
}
.hour-block.active-sync {
  background: var(--accent);
  color: white;
}
.hour-block .ampm {
  font-size: 0.65rem;
  opacity: 0.8;
}

/* --- Live Clocks Card Grid --- */
#card-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.zone-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  transition: transform 0.2s;
}
.zone-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 85, 255, 0.1);
}
.zone-city {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
}
.zone-diff {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(0, 85, 255, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}
.zone-time {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}
.zone-date {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.card-actions button {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.card-actions button:hover {
  background: var(--accent);
  color: white;
}

/* --- Global Reference Lists --- */
.reference-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.ref-heading {
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 1rem;
}
.ref-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
}
.ref-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-dark);
}
.ref-time {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}

/* --- Mobile Breakpoints --- */
@media (max-width: 1024px) {
  .page-wrapper {
    width: 95%;
    grid-template-columns: 1fr;
  }
  .ad-space-left,
  .ad-space-right {
    display: none;
  }
  .reference-container {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 768px) {
  .reference-container {
    grid-template-columns: 1fr;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .input-group,
  .generate-btn {
    width: 100%;
    max-width: none;
  }
  .tz-row {
    flex-direction: column;
    align-items: stretch;
    position: relative;
  }
  .tz-info {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }
  .tz-remove {
    position: absolute;
    right: 1rem;
    top: 1rem;
  }
}
