/* ============================================
🇺🇸 UNITED STATES — Modern Glossy Gradient Flag Effect
Inspired by India's glossy smooth style
============================================ */
:root {
  --blue: #3c3b6e;   /* Old Glory Blue */
  --red: #b22234;    /* Flag Red */
  --white: #ffffff;
  --card: rgba(255, 255, 255, 0.85);
  --text: #1a1f71;
  --muted: #555;
  --accent: #b22234;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --overlay-light: rgba(255, 255, 255, 0.25);
  --overlay-dark: rgba(0, 0, 0, 0.3);
}

/* 🌍 Flag-Inspired Glossy Gradient Background */
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;

  background:
    /* Layer 1 — Smooth tricolor gradient (Blue → White → Red) */
    linear-gradient(
      180deg,
      rgba(60, 59, 110, 0.95) 0%,   /* Blue start */
      rgba(255, 255, 255, 0.95) 50%, /* Glossy white middle */
      rgba(178, 34, 52, 0.95) 100%   /* Red end */
    ),

    /* Layer 2 — Glossy highlight overlay */
    radial-gradient(
      circle at top right,
      rgba(255, 255, 255, 0.25) 0%,
      transparent 60%
    );

  background-blend-mode: overlay;
  background-attachment: fixed;
  background-size: cover;
  color: var(--text);
  transition: background 0.4s ease, color 0.3s ease;
}

/* 🌙 Dark Mode Version */
body.dark-mode {
  background:
    linear-gradient(
      180deg,
      rgba(60, 59, 110, 0.35) 0%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(178, 34, 52, 0.35) 100%
    ),
    radial-gradient(
      circle at center,
      rgba(0, 0, 0, 0.5) 0%,
      rgba(0, 0, 0, 0.75) 100%
    );

  background-blend-mode: overlay, multiply;
  color: #e6edf3;
  transition: background 0.4s ease, color 0.3s ease;
}

/* 🌟 Animated glossy reflection */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: -60%;
  width: 220%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.05) 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.05) 75%,
    rgba(255, 255, 255, 0.15) 100%
  );
  mix-blend-mode: overlay;
  animation: flag-gloss 16s infinite linear;
  pointer-events: none;
  opacity: 0.6;
  z-index: 0;
}

@keyframes flag-gloss {
  0% { transform: translateX(-10%) translateY(-10%) rotate(0deg); }
  50% { transform: translateX(10%) translateY(10%) rotate(1deg); }
  100% { transform: translateX(-10%) translateY(-10%) rotate(0deg); }
}

/* ============================================
🌍 Layout — Hero, Cards, etc.
============================================ */
.hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin: 30px auto;
  max-width: 1280px;
  padding: 0 20px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: background 0.3s, box-shadow 0.3s;
}

/* ===========================
   ⏰ Clocks
=========================== */
.main-clock {
  position: relative;
  text-align: center;
  margin-bottom: 24px;
}

.main-clock .time {
  font-size: 64px;
  font-weight: 700;
  color: var(--accent);
}

.main-clock .tz {
  font-size: 16px;
  color: var(--muted);
  margin-top: 6px;
}

.utc-small {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(60, 157, 246, 0.1);
  border-radius: 10px;
  padding: 6px 12px;
  text-align: right;
}

.utc-small .clock-time {
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
}

.utc-small .clock-tz {
  font-size: 12px;
  color: var(--muted);
}

/* ===========================
   💡 Meta Info
=========================== */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.meta {
  background: rgba(0, 0, 0, 0.05);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--muted);
}

/* ===========================
   🏙️ Cities Grid
=========================== */
.cities {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.city-card {
  background: rgba(255, 255, 255, 0.15);
  padding: 14px;
  border-radius: var(--radius);
  text-align: center;
  backdrop-filter: blur(6px);
  transition: all 0.2s ease;
}

.city-card:hover {
  transform: translateY(-3px);
}

.city-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.city-time {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

/* ===========================
   🇺🇸 Flag Icon
=========================== */
.flag-inline-title {
  height: 1em;
  width: auto;
  margin-right: 0.4em;
  vertical-align: middle;
  position: relative;
  top: -0.1em;
  border-radius: 0.2em;
  object-fit: cover;
  box-shadow: 0 0.05em 0.15em rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.flag-inline-title:hover {
  transform: scale(1.05);
}

/* ===========================
   ⏳ Converter
=========================== */
.converter-countries-wrapper {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.convert-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  margin-top: 12px;
}

.converter .row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.converter .row select,
.converter .row input {
  flex: 1 1 250px;
  min-width: 250px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
}
body.dark-mode .converter select,
body.dark-mode .converter input {
  background: #161b22;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ---------- Result Box ---------- */
.convert-result-box {
  position: relative;
  border: 3px double var(--accent);
  padding: 18px 22px;
  display: none;
}
body.dark-mode .convert-result-box {
  border: 3px double #66a3ff;
}
.convert-result-box.show {
  display: block;
  animation: fadeInBox 0.4s ease-in-out;
}
@keyframes fadeInBox {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
/* CTA Buttons */
.cta {
  background: linear-gradient(180deg, #3c3b6e, #ffffff, #b22234);  
  border: none;
  color: #000;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 10px 18px;
  cursor: pointer;
  transition: 0.2s;
}

.cta:hover {
  background: linear-gradient(180deg, #b22234, #ffffff, #3c3b6e);
  box-shadow: 0 3px 12px rgba(60, 157, 246, 0.4);
  transform: translateY(-2px);
}

/* ===========================
   🔙 Back to US Button
=========================== */
.back-home-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #3c3b6e, #ffffff, #b22234);
  
  color: #000;
  padding: 12px 24px;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.back-home-button:hover {
 background: linear-gradient(180deg, #b22234, #ffffff, #3c3b6e); 
}

.back-home-wrapper {
  text-align: center;
  margin: 40px 0;
}

/* ===========================
   🇺🇸 US States Directory
=========================== */
.usa-divisions {
  text-align: center;
}

.usa-divisions h3 {
  margin-bottom: 10px;
}

.usa-divisions p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
}

.states-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.division-link {
  display: inline-block;
  width: 80%;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #3c3b6e;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  transition: 0.3s;
  text-align: center;
}

.division-link:hover {
  background: linear-gradient(180deg, #3c3b6e, #ffffff, #b22234);
  color: #000;
  transform: translateY(-2px);
  font-weight: 600;
}

/* 🌙 =======================
      DARK MODE — Enhanced
========================== */
body.dark-mode .card {
  background: rgba(20, 25, 35, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  color: #e6edf3;
}

body.dark-mode .hero {
  background: linear-gradient(
    180deg,
    rgba(60, 59, 110, 0.25) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(178, 34, 52, 0.25) 100%
  );
  border-radius: 20px;
  padding: 24px;
}

body.dark-mode .main-clock .time {
  color: #ff4455;
  text-shadow: 0 0 12px rgba(255, 68, 85, 0.6);
}

body.dark-mode .main-clock .tz {
  color: #7da8ff;
}

body.dark-mode .utc-small {
  background: rgba(60, 59, 110, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .city-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .city-name {
  color: #7da8ff;
}

body.dark-mode .city-time {
  color: #ff4455;
}

body.dark-mode .meta {
  background: rgba(255, 255, 255, 0.05);
  color: #9bb2d1;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

body.dark-mode .converter select,
body.dark-mode .converter input {
  background: rgba(20, 25, 35, 0.8);
  color: #e6edf3;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .cta {
  background: linear-gradient(180deg, #3c3b6e, #b22234);
  color: #fff;
  box-shadow: 0 4px 12px rgba(178, 34, 52, 0.4);
}

body.dark-mode .division-link {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e6edf3;
}

body.dark-mode .division-link:hover {
  background: linear-gradient(180deg, #3c3b6e, #b22234);
  color: #fff;
}

body.dark-mode .back-home-button {
  background: #3c3b6e;
  color: #fff;
}

body.dark-mode .back-home-button:hover {
  background: #b22234;
}

/* ============================================
📱 FULL RESPONSIVE DESIGN
Adapts layout for (900px → 768px → 480px)
============================================ */

/* ---------- 💻 Tablets & Small Laptops (≤900px) ---------- */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 16px;
  }

  .card {
    padding: 20px;
  }

  .main-clock .time {
    font-size: 52px;
  }

  .utc-small {
    position: static;
    text-align: center;
    margin: 10px auto;
  }

  .cities {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .city-card {
    padding: 12px;
  }

  .converter .row {
    flex-direction: column;
  }

  .converter select,
  .converter input {
    width: 100%;
  }

  .division-link {
    width: 90%;
  }
}

/* ---------- 📱 Tablets & Large Mobiles (≤768px) ---------- */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  .hero {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .main-clock .time {
    font-size: 44px;
  }

  .main-clock .tz {
    font-size: 14px;
  }

  .card {
    padding: 18px;
  }

  .meta-row {
    flex-direction: column;
    align-items: center;
  }

  .meta {
    width: 100%;
    text-align: center;
  }

  .city-card {
    padding: 12px;
  }

  .city-name {
    font-size: 14px;
  }

  .city-time {
    font-size: 18px;
  }

  .usa-divisions h3 {
    font-size: 16px;
  }

  .division-link {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
  }

  .back-home-button {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* ---------- 📞 Small Mobiles (≤480px) ---------- */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .hero {
    margin: 20px auto;
    padding: 0 12px;
  }

  .main-clock .time {
    font-size: 36px;
  }

  .utc-small {
    margin-top: 8px;
    padding: 5px 10px;
  }

  .meta {
    font-size: 12px;
    padding: 5px 10px;
  }

  .cities {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .city-card {
    padding: 10px;
  }

  .back-home-button {
    width: 90%;
    font-size: 13px;
    padding: 9px 16px;
  }

  .division-link {
    width: 100%;
    padding: 8px;
    font-size: 13px;
  }
}

/* ==============================
📱 Converter Dropdown Responsive Fix
============================== */
.converter-countries-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center; /* center on all screens */
  margin-top: 24px;
}

.converter .row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* center on smaller screens */
  gap: 10px;
  width: 100%;
}

.converter .row select,
.converter .row input {
  flex: 1 1 220px; /* flexible width, shrinks on smaller screens */
  max-width: 400px; /* prevent huge width on large screens */
  min-width: 140px; /* prevent too narrow on mobile */
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #ccc;
  transition: all 0.2s ease;
}

/* Small Mobiles ≤480px */
@media (max-width: 480px) {
  .converter .row select,
  .converter .row input {
    flex: 1 1 100%; /* full width */
    min-width: 100%;
    margin-bottom: 8px;
    font-size: 13px;
    padding: 10px 12px;
  }
}
/* Desktop narrow widths (≤900px) */
@media (max-width: 900px) {
  .converter .row select,
  .converter .row input {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 100%;
  }
}
/* Extra Small Screens ≤320px */
@media (max-width: 320px) {
  .converter .row select,
  .converter .row input {
    font-size: 12px;
    padding: 8px 10px;
  }
}