/* =============================================
   Time Weaver – Enhanced UI
   ============================================= */

/* ── Outer wrapper ─────────────────────────── */
.tw-outer {
  min-height: 100vh;
  padding-bottom: 3rem;
}

/* ── Hero ───────────────────────────────────── */
.tw-hero-section {
  text-align: center;
  padding: 2.6rem 1rem 1.8rem;
  background: linear-gradient(160deg, #eef4fb 0%, #dce8f4 100%);
  border-bottom: 1px solid #c8daea;
  margin-bottom: 0;
}
.tw-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(44,125,160,0.12);
  color: #1f5e7a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.9rem;
  border-radius: 2rem;
  margin-bottom: 0.8rem;
}
.tw-hero-title {
  font-size: 2.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1A2A3F 0%, #2c7da0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
}
.tw-hero-sub {
  color: #3a546d;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ── Ad – mobile banner ─────────────────────── */
.tw-ad-mobile {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.5rem 1rem;
}
.tw-ad-label,
.ad-rail-label {
  font-size: 11px;
  color: #adb5bd;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ── Layout ─────────────────────────────────── */
.tw-layout {
  padding-top: 1.8rem;
}

/* ── Tool cards grid ────────────────────────── */
.tw-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.4rem;
}

/* ── Card ───────────────────────────────────── */
.tw-card {
  background: #ffffff;
  border-radius: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  position: relative;
}
.tw-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
}
.tw-card-accent {
  height: 5px;
  width: 100%;
}
.tw-accent-blue   { background: linear-gradient(90deg, #2c7da0, #56b4d3); }
.tw-accent-teal   { background: linear-gradient(90deg, #0e9f6e, #31c48d); }
.tw-accent-purple { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

.tw-card-inner {
  padding: 1.5rem 1.6rem 1.6rem;
}

/* Card title */
.tw-card-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e2f3e;
  margin-bottom: 1.2rem;
}
.tw-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.tw-icon-blue   { background: #dbeeff; color: #2c7da0; }
.tw-icon-teal   { background: #d1fae5; color: #0e9f6e; }
.tw-icon-purple { background: #ede9fe; color: #7c3aed; }

/* ── Mode toggle ────────────────────────────── */
.tw-mode-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: 2rem;
  padding: 3px;
  margin-bottom: 1.1rem;
  gap: 3px;
}
.tw-mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.45rem 0.5rem;
  border-radius: 1.6rem;
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}
.tw-mode-btn.active {
  background: #ffffff;
  color: #2c7da0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.tw-mode-btn:hover:not(.active) { background: #e2e8f0; color: #334155; }

/* ── Input groups ───────────────────────────── */
.tw-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.tw-input-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.02em;
}
.tw-input-group input,
.tw-input-group select,
.tw-clock-tz-select {
  padding: 0.72rem 1rem;
  border-radius: 0.9rem;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.87rem;
  color: #1e293b;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  outline: none;
  width: 100%;
}
.tw-input-group input:focus,
.tw-input-group select:focus,
.tw-clock-tz-select:focus {
  border-color: #2c7da0;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(44,125,160,0.15);
}

/* ── Buttons ────────────────────────────────── */
.tw-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: linear-gradient(135deg, #2c7da0, #1f5e7a);
  color: #ffffff;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.15s, box-shadow 0.18s;
  box-shadow: 0 3px 10px rgba(44,125,160,0.35);
  margin-top: 0.2rem;
}
.tw-btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 5px 14px rgba(44,125,160,0.4); }
.tw-btn-primary:active { transform: scale(0.97); }
.tw-btn-teal {
  background: linear-gradient(135deg, #0e9f6e, #057a55);
  box-shadow: 0 3px 10px rgba(14,159,110,0.35);
}
.tw-btn-teal:hover { box-shadow: 0 5px 14px rgba(14,159,110,0.4); }
.tw-btn-full { width: 100%; }

.tw-btn-secondary {
  background: #64748b;
  color: #fff;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tw-btn-secondary:hover { background: #475569; }

/* ── Result boxes ───────────────────────────── */
.tw-result-box {
  background: #f0f6fb;
  border: 1.5px solid #d0e4ef;
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  margin-top: 0.9rem;
  font-size: 0.9rem;
  word-break: break-word;
  color: #1e2f3e;
  min-height: 60px;
}
.tw-result-placeholder { color: #94a3b8; font-style: italic; font-size: 0.85rem; }
.tw-result-error { color: #c0392b; font-size: 0.85rem; }
.tw-result-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.tw-result-value {
  font-family: 'Fira Mono', 'Courier New', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #155f7c;
}
.tw-result-sub { font-size: 0.75rem; color: #94a3b8; margin-top: 0.3rem; }
.tw-badge {
  display: inline-block;
  background: rgba(44,125,160,0.12);
  color: #1f5e7a;
  border-radius: 0.5rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
}

/* ── Custom timezone ────────────────────────── */
.tw-custom-tz-section {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 0.9rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
}
.tw-custom-tz-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}
.tw-tz-icon { color: #94a3b8; font-size: 0.75rem; }
.tw-chevron { margin-left: auto; font-size: 0.7rem; color: #94a3b8; transition: transform 0.2s; }
.tw-custom-tz-input {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.tw-custom-tz-input.show { display: flex; }
.tw-custom-tz-input input {
  padding: 0.6rem 0.85rem;
  border-radius: 0.7rem;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  font-size: 0.82rem;
  outline: none;
  width: 100%;
}
.tw-custom-tz-input input:focus { border-color: #2c7da0; box-shadow: 0 0 0 3px rgba(44,125,160,0.15); }
.tw-info-text { font-size: 0.72rem; color: #64748b; margin-top: 0.35rem; line-height: 1.4; }

/* ── Difference result ──────────────────────── */
.tw-diff-result-box { padding: 1rem; }
.tw-diff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.tw-diff-tile {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.9rem;
  padding: 0.7rem 0.5rem;
  text-align: center;
}
.tw-diff-number {
  font-family: 'Fira Mono', 'Courier New', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0e7490;
  line-height: 1.1;
}
.tw-diff-label {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}
.tw-diff-summary {
  background: #e0f2fe;
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0c4a6e;
  text-align: center;
}
.tw-diff-dir { font-size: 0.75rem; color: #64748b; font-weight: 500; }

/* ── World clock controls ───────────────────── */
.tw-clock-controls {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.tw-clock-tz-select {
  flex: 1;
  min-width: 140px;
}
.tw-view-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: 0.9rem;
  padding: 3px;
  gap: 3px;
  flex-shrink: 0;
}
.tw-toggle-btn {
  background: transparent;
  border: none;
  padding: 0.42rem 0.85rem;
  border-radius: 0.65rem;
  font-size: 0.77rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.tw-toggle-btn.active {
  background: #ffffff;
  color: #7c3aed;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.tw-toggle-btn:hover:not(.active) { background: #e2e8f0; color: #334155; }

/* Canvas / Digital display */
.tw-watch-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 230px;
  padding: 0.5rem 0;
}
#analogCanvas {
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15), inset 0 0 0 2px rgba(255,255,255,0.8);
  display: block;
  max-width: 100%;
  height: auto;
}
.tw-digital-clock {
  font-family: 'Fira Mono', 'Courier New', monospace;
  font-size: 2.6rem;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  padding: 1rem 1.4rem;
  border-radius: 1.2rem;
  color: #7dd3fc;
  letter-spacing: 4px;
  width: 100%;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.05);
}
.tw-tz-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2c7da0;
  margin-top: 0.9rem;
}
.tw-live-dot {
  color: #22c55e;
  animation: tw-pulse 1.4s ease-in-out infinite;
}
@keyframes tw-pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Note line ──────────────────────────────── */
.tw-note {
  font-size: 0.71rem;
  color: #94a3b8;
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.tw-note-icon { color: #2c7da0; }
.tw-spin-slow { animation: tw-spin 3s linear infinite; }
@keyframes tw-spin { to { transform: rotate(360deg); } }

/* ── Info / How-to section ──────────────────── */
.tw-info-section {
  margin-top: 1.8rem;
  background: #ffffff;
  border-radius: 1.4rem;
  padding: 1.6rem 1.8rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border: 1.5px solid #e8f0f7;
}
.tw-info-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e2f3e;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tw-info-title i { color: #2c7da0; }
.tw-info-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.tw-info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}
.tw-info-icon {
  width: 36px;
  height: 36px;
  border-radius: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.tw-info-item strong { font-size: 0.88rem; color: #1e2f3e; display: block; margin-bottom: 0.2rem; }
.tw-info-item p { font-size: 0.82rem; color: #64748b; margin: 0; line-height: 1.55; }
.tw-info-item code {
  background: #f1f5f9;
  padding: 0.05rem 0.35rem;
  border-radius: 0.3rem;
  font-size: 0.78rem;
  color: #0c4a6e;
}

/* ── Ad rail (desktop sidebar) ──────────────── */
.ad-sticky { position: sticky; top: 90px; }
.ad-rail { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }

/* ── Dark mode ──────────────────────────────── */
[data-theme="dark"] .tw-hero-section {
  background: linear-gradient(160deg, #1e293b, #0f172a);
  border-bottom-color: #334155;
}
[data-theme="dark"] .tw-hero-badge { background: rgba(125,211,252,0.12); color: #7dd3fc; }
[data-theme="dark"] .tw-hero-title { background: linear-gradient(135deg,#7dd3fc,#38bdf8); -webkit-background-clip:text; background-clip:text; color:transparent; }
[data-theme="dark"] .tw-hero-sub { color: #94a3b8; }
[data-theme="dark"] .tw-ad-mobile { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .tw-card { background: #1e293b; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
[data-theme="dark"] .tw-card:hover { box-shadow: 0 12px 32px rgba(0,0,0,0.4); }
[data-theme="dark"] .tw-card-title { color: #e2e8f0; }
[data-theme="dark"] .tw-icon-blue   { background: rgba(44,125,160,0.2); color: #56b4d3; }
[data-theme="dark"] .tw-icon-teal   { background: rgba(14,159,110,0.2); color: #34d399; }
[data-theme="dark"] .tw-icon-purple { background: rgba(124,58,237,0.2); color: #a78bfa; }
[data-theme="dark"] .tw-mode-toggle,
[data-theme="dark"] .tw-view-toggle { background: #0f172a; }
[data-theme="dark"] .tw-mode-btn.active,
[data-theme="dark"] .tw-toggle-btn.active { background: #1e293b; }
[data-theme="dark"] .tw-mode-btn:hover:not(.active),
[data-theme="dark"] .tw-toggle-btn:hover:not(.active) { background: #334155; }
[data-theme="dark"] .tw-input-group label { color: #94a3b8; }
[data-theme="dark"] .tw-input-group input,
[data-theme="dark"] .tw-input-group select,
[data-theme="dark"] .tw-clock-tz-select { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .tw-input-group input:focus,
[data-theme="dark"] .tw-input-group select:focus,
[data-theme="dark"] .tw-clock-tz-select:focus { background: #1e293b; border-color: #2c7da0; }
[data-theme="dark"] .tw-result-box { background: #0f172a; border-color: #334155; color: #cbd5e1; }
[data-theme="dark"] .tw-result-value { color: #7dd3fc; }
[data-theme="dark"] .tw-custom-tz-section { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .tw-custom-tz-header { color: #94a3b8; }
[data-theme="dark"] .tw-custom-tz-input input { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .tw-diff-tile { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .tw-diff-number { color: #38bdf8; }
[data-theme="dark"] .tw-diff-label,
[data-theme="dark"] .tw-note { color: #475569; }
[data-theme="dark"] .tw-diff-summary { background: #0c4a6e; color: #bae6fd; }
[data-theme="dark"] .tw-info-section { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .tw-info-title { color: #e2e8f0; }
[data-theme="dark"] .tw-info-item strong { color: #e2e8f0; }
[data-theme="dark"] .tw-info-item p { color: #64748b; }
[data-theme="dark"] .tw-info-item code { background: #0f172a; color: #7dd3fc; }
[data-theme="dark"] .tw-tz-status { color: #7dd3fc; }
[data-theme="dark"] .tw-badge { background: rgba(125,211,252,0.12); color: #7dd3fc; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 991.98px) {
  .tw-hero-title { font-size: 2rem; }
  .tw-grid-3 { grid-template-columns: 1fr; }
  .tw-digital-clock { font-size: 2rem; letter-spacing: 3px; }
}
@media (max-width: 575.98px) {
  .tw-hero-section { padding: 2rem 1rem 1.4rem; }
  .tw-hero-title { font-size: 1.7rem; }
  .tw-hero-sub { font-size: 0.83rem; }
  .tw-card-inner { padding: 1.2rem 1.1rem 1.3rem; }
  .tw-diff-grid { grid-template-columns: repeat(3,1fr); gap: 0.4rem; }
  .tw-diff-number { font-size: 1rem; }
  .tw-digital-clock { font-size: 1.7rem; letter-spacing: 2px; }
  .tw-info-section { padding: 1.2rem; }
}
