/* ============================================
 🇲🇻 MALDIVES PAGE — GlobalTime.io
 Flag-Inspired Theme — Red Border, Green Field, White Crescent
============================================ */

:root {
  /* ---------- Light Mode Variables ---------- */
  --bg: linear-gradient(
    180deg,
    #d7141a 0%,      /* red top */
    #007e3a 40%,     /* green center */
    #007e3a 60%,     /* green mid */
    #d7141a 100%     /* red bottom */
  );
  --crescent: #ffffff; 
  --card: rgba(255, 255, 255, 0.85);
  --text: #0d0d0d;
  --muted: #444;
  --accent: #007e3a; /* Maldives green */
  --radius: 16px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ---------- Body ---------- */
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  line-height: 1.6;
  height: 100vh;
  background: var(--bg);
  background-attachment: fixed;
  background-size: cover;
  background-repeat: no-repeat;
  overflow-x: hidden;
  position: relative;
  z-index: 0;
}

/* ---------- White Crescent Accent ---------- */
body::before {
  content: "☾";
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(10deg);
  font-size: 140px;
  color: rgba(255, 255, 255, 0.15);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  z-index: -1;
  pointer-events: none;
  opacity: 0.8;
  animation: moonGlow 5s ease-in-out infinite alternate;
}
@keyframes moonGlow {
  from { opacity: 0.4; text-shadow: 0 0 10px rgba(255,255,255,0.2); }
  to { opacity: 0.9; text-shadow: 0 0 20px rgba(255,255,255,0.5); }
}

/* ---------- Dark Mode ---------- */
body.dark-mode {
  --bg: linear-gradient(180deg, #000000 0%, #005f2b 50%, #000000 100%);
  --card: rgba(20, 20, 20, 0.9);
  --text: #f0f0f0;
  --muted: #bbb;
  --accent: #2ecc71;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
body.dark-mode::before {
  color: rgba(255, 255, 255, 0.2);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.3);
}

/* ---------- Hero Section ---------- */
.hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin: 30px auto;
  max-width: 1280px;
  padding: 0 20px;
}

/* ---------- Cards ---------- */
.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;
}

/* ---------- Main Clock ---------- */
.main-clock {
  text-align: center;
  margin-bottom: 24px;
}
.main-clock .time {
  font-size: 64px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(0, 126, 58, 0.3);
}
.main-clock .tz {
  font-size: 16px;
  color: var(--muted);
  margin-top: 6px;
}
.utc-small {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.15);
  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);
}

/* ---------- Dark Mode Clock ---------- */
body.dark-mode .main-clock .time,
body.dark-mode .utc-small .clock-time {
  color: #00ff9d;
  text-shadow: 0 0 10px rgba(0, 255, 150, 0.5);
}

/* ---------- 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);
}
body.dark-mode .meta {
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- 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.12);
  padding: 14px;
  border-radius: var(--radius);
  text-align: center;
  backdrop-filter: blur(6px);
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.city-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.22);
}

/* ---------- City Name + Flag ---------- */
.city-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.city-name span.flag {
  font-size: 1.4em;
  line-height: 1;
}

/* ---------- City Time ---------- */
.city-time {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

/* ---------- Dark Mode ---------- */
body.dark-mode .city-card {
  background: rgba(0, 0, 0, 0.35);
}
body.dark-mode .city-name {
  color: #ffdf91;
}
body.dark-mode .city-time {
  color: #ffcc33;
}

/* ---------- Flags ---------- */
.flag-inline-title {
  height: 1em;
  width: auto;
  margin-right: 0.4em;
  vertical-align: middle;
  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 #ff4b4b;
}
.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); }
}

/* ---------- Buttons ---------- */
.copy-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s;
}
.copy-btn:hover {
  background: var(--accent);
  color: #fff;
}
.cta {
  background: linear-gradient(180deg, #d7141a 0%, #ffffff 50%, #007e3a 100%);
  border: none;
  color: #000;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 10px 18px;
  cursor: pointer;
  transition: 0.3s;
}
.cta:hover {
  background: linear-gradient(180deg, #007e3a 0%, #ffffff 50%, #d7141a 100%);
  box-shadow: 0 3px 12px rgba(0, 126, 58, 0.4);
  transform: translateY(-2px);
}

/* ---------- Regions List ---------- */
.maldives-regions {
  text-align: center;
}
.states-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.division-link {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  transition: 0.3s;
  text-align: center;
}
.division-link:hover {
  background: linear-gradient(180deg, #d7141a 0%, #ffffff 50%, #007e3a 100%);
  color: #000;
  font-weight: 600;
  transform: translateY(-2px);
}
body.dark-mode .division-link {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
body.dark-mode .division-link:hover {
  color: #000;
}

/* ---------- Back Button ---------- */
.back-home-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #007e3a 0%, #ffffff 50%, #d7141a 100%);
  color: #000;
  padding: 12px 24px;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: 0.3s;
}
.back-home-button:hover {
  background: linear-gradient(180deg, #d7141a 0%, #ffffff 50%, #007e3a 100%);
  box-shadow: 0 0 12px rgba(0, 126, 58, 0.4);
  transform: translateY(-2px);
}
.back-home-wrapper {
  text-align: center;
  margin: 40px 0;
}

/* ---------- Responsive & Retina ---------- */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr 1fr; gap: 20px; }
  .main-clock .time { font-size: 56px; color: #007e3a; }
}
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; text-align: center; gap: 20px; }
  .main-clock .time { font-size: 48px; color: #d7141a; text-shadow: 0 0 8px rgba(255, 255, 255, 0.45); }
  .utc-small { position: static; margin-top: 10px; text-align: center; }
}

@media (min-width: 1600px) {
  .hero { max-width: 1600px; gap: 40px; padding: 0 40px; }
  .main-clock .time { font-size: 80px; }
  .card { padding: 32px; border-radius: 20px; }
  .city-card { padding: 18px; font-size: 16px; }
}
@media (min-width: 2400px) {
  body { font-size: 18px; }
  .main-clock .time { font-size: 96px; letter-spacing: -0.02em; text-shadow: 0 0 8px rgba(215, 20, 26, 0.3); }
  .card { padding: 36px; border-radius: 24px; }
}
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .flag-inline-title { image-rendering: crisp-edges; filter: saturate(1.08) contrast(1.05); }
  .card { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); }
  .city-card { backdrop-filter: blur(8px); background: rgba(0, 126, 58, 0.12); }
  .cta { filter: contrast(1.1) brightness(1.05); }
  .main-clock .time { color: #007e3a; text-shadow: 0 0 6px rgba(255, 255, 255, 0.45); }
}
@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi) {
  .flag-inline-title { filter: saturate(1.15) brightness(1.1); }
  .cta { filter: contrast(1.2) brightness(1.1); }
  .main-clock .time { color: #d7141a; text-shadow: 0 0 8px rgba(0, 126, 58, 0.35); }
}

@media (max-width: 480px) {

  /* Prevent overflow on very small screens */
  body, html {
    overflow-x: hidden;
  }

  .main-clock .time {
    font-size: 36px;           /* थोड़ा छोटा ताकि overflow ना हो */
    max-width: 100%;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.2;
    color: #007e3a;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
  }

  .card {
    padding: 14px;             /* 16px → 14px safe for mobile */
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;    /* Important: Prevents overflow */
  }

  .city-card {
    font-size: 14px;
    padding: 12px;             /* 14px → 12px (safer on narrow screens) */
    width: 100%;
    box-sizing: border-box;
  }

  .cta {
    font-size: 15px;
    padding: 10px 16px;        /* 20px → 16px (no overflow) */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
  }
}

