/* ===========================
   India Gov Calendar — Premium Theme (Cleaned / Unified)
   Drop-in replacement for calendar-style.css
   =========================== */

/* Load font FIRST */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---------- Design Tokens (easy to tweak) ---------- */
:root {
  --igc-bg: #ffffff;
  --igc-surface: #ffffff;
  --igc-border: #e6e6e6;
  --igc-muted: #6b7280;
  --igc-text: #1f2937;

  --igc-link: #1b6ac9;
  --igc-link-hover: #0f56a9;

  --igc-shadow: 0 2px 6px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);

  /* GH = red family (lighter tint to match tag hue) */
  --igc-gh-bg: #fde8e8;   /* lighter than #fde2e1 */
  --igc-gh-border: #f5b5b5;
  --igc-gh-text: #9f1d1d;

  /* RH = green family (lighter tint to match tag hue) */
  --igc-rh-bg: #e6f7ed;
  --igc-rh-border: #a8e0bf;
  --igc-rh-text: #166f3c;

  /* TN = amber */
  --igc-tn-bg: #fff6d9;
  --igc-tn-border: #f3c878;
  --igc-tn-text: #8a5b00;

  /* Weekends align with GH red */
  --igc-wknd-bg: var(--igc-gh-bg);

  --igc-today: #ff9a2b;   /* today outline + tag */
  --igc-focus: #2563eb;

  --igc-radius-lg: 16px;
  --igc-radius-md: 12px;
  --igc-radius-sm: 10px;

  --igc-gap: 12px;
  --igc-pad: 14px;

  --igc-title-size: 22px;
  --igc-daynum-size: 19px;
  --igc-daytitle-size: 14px;
  --igc-daydesc-size: 12.5px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --igc-bg: #0b0f14;
    --igc-surface: #121821;
    --igc-border: #1f2a37;
    --igc-muted: #9aa3af;
    --igc-text: #e5e7eb;

    --igc-shadow: 0 2px 10px rgba(0,0,0,.35);

    /* Dark-mode GH red */
    --igc-gh-bg: #2b0f11;
    --igc-gh-border: #6e2a2a;
    --igc-gh-text: #ffb3b3;

    /* Dark-mode RH green */
    --igc-rh-bg: #0f2a1c;
    --igc-rh-border: #2f6f49;
    --igc-rh-text: #b7f0c8;

    --igc-tn-bg: #2b2412;
    --igc-tn-border: #8a6b2a;
    --igc-tn-text: #ffd98b;

    --igc-today: #ffb258;
    --igc-link: #7db6ff;
    --igc-link-hover: #a4cbff;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Global sizing + grid overflow guards ---------- */
*, *::before, *::after { box-sizing: border-box; }
.igc-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.igc-grid > .day-card { min-width: 0; }
.day-title { overflow-wrap: anywhere; word-break: break-word; }

/* ---------- Wrapper ---------- */
.igc-calendar-wrap {
  border: 1px solid var(--igc-border);
  border-radius: var(--igc-radius-lg);
  padding: var(--igc-pad);
  background:
    radial-gradient(1200px 600px at 100% -20%, rgba(27,106,201,.06), transparent 40%),
    radial-gradient(900px 400px at -10% 120%, rgba(46,124,81,.06), transparent 45%),
    var(--igc-surface);
  box-shadow: var(--igc-shadow);
  color: var(--igc-text);
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Header ---------- */
.igc-calendar-header {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr !important;
  align-items: center;
  margin-bottom: 14px;
}
.igc-nav-left   { justify-self: start;  text-align: left; }
.igc-month-title{ justify-self: center; text-align: center; font-weight: 700; font-size: var(--igc-title-size); letter-spacing: .2px; }
.igc-nav-right  { justify-self: end;    text-align: right; }

.igc-nav-link, .igc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1;
  transition: all .15s ease;
}
.igc-btn--primary { background: #1b6ac9; color: #fff; border-color: #1b6ac9; }
.igc-btn--primary:hover { background: #15579f; border-color: #15579f; }
.igc-btn--ghost { background: #f9fafb; border-color: #d1d5db; color: #374151; }
.igc-btn--ghost:hover { background: #f3f4f6; }

/* ---------- Legends ---------- */
.igc-legends {
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
  flex-wrap: wrap;
}
.pill {
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(0,0,0,.05) inset;
}
.pill-gh { background: var(--igc-gh-bg); color: var(--igc-gh-text); border-color: var(--igc-gh-border); }
.pill-rh { background: var(--igc-rh-bg); color: var(--igc-rh-text); border-color: var(--igc-rh-border); }
.pill-tn { background: var(--igc-tn-bg); color: var(--igc-tn-text); border-color: var(--igc-tn-border); }
.pill-neutral { background:#f4f4f4; color:#555; border-color:#ddd; }
@media (prefers-color-scheme: dark) {
  .pill-neutral { background:#1a222d; color:#aeb7c2; border-color:#2b3645; }
}

/* Custom Event pill */
.pill-ce {
  background:#f0f4ff;
  color:#1e3a8a;
  border:1px solid #a5b4fc;
  display:flex;
  align-items:center;
  gap:6px;
}
.pill-ce .pill-logo { width:16px; height:16px; object-fit:contain; }

/* ---------- Weekday header ---------- */
.igc-weekdays {
  display:grid; grid-template-columns: repeat(7,1fr);
  gap: var(--igc-gap); margin: 4px 0 8px;
}
.igc-weekdays > div {
  text-align:center; font-size:13px; font-weight:600; text-transform:uppercase;
  letter-spacing:.5px; color: var(--igc-muted); padding: 4px 0;
}

/* ---------- Grid ---------- */
.igc-grid { display:grid; grid-template-columns: repeat(7,1fr); gap: var(--igc-gap); }

/* ---------- Day cards ---------- */
.day-card {
  position:relative;
  min-height: 98px;
  padding: 10px;
  border-radius: var(--igc-radius-md);
  border: 1px solid var(--igc-border);
  background: var(--igc-bg);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease, background .18s ease;
}
.day-card.elevated { box-shadow: 0 1px 0 rgba(0,0,0,.04) inset, var(--igc-shadow); }
.day-card.blank { background: transparent; border: none; box-shadow: none; }

.day-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}
.day-card:focus-within { outline: 3px solid var(--igc-focus); outline-offset: 2px; }

.day-num { font-weight: 800; font-size: var(--igc-daynum-size); color: var(--igc-text); position: relative; z-index: 1; }
.day-card.today .day-num { margin-top: 16px; } /* room for Today badge */

.day-title {
  margin-top: 6px;
  font-size: var(--igc-daytitle-size);
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1.3;
  color: #1e293b;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Types */
.day-card.gh { background: var(--igc-gh-bg); border-color: var(--igc-gh-border); color: var(--igc-gh-text); }
.day-card.rh { background: var(--igc-rh-bg); border-color: var(--igc-rh-border); color: var(--igc-rh-text); }
.day-card.tn { background: var(--igc-tn-bg); border: 2px dashed var(--igc-tn-border); color: var(--igc-tn-text); }

/* Weekends match GH */
.day-card.wknd { background: var(--igc-gh-bg); border-color: var(--igc-gh-border); color: var(--igc-gh-text); }

/* Today ring */
.day-card.today { box-shadow: 0 0 0 2px var(--igc-today) inset, var(--igc-shadow); border-color: var(--igc-today); --today-accent: var(--igc-today); }

/* Parliament logo */
.parliament-logo {
  position:absolute; right:8px; top:8px;
  width:22px; height:22px; object-fit:contain;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.2));
  z-index: 2;
}

/* ---------- Upcoming cards (under nav) ---------- */
.igc-upcoming-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin: 10px 0 16px;
  align-items: start;
}
.igc-up-left  { justify-self: start; }
.igc-up-center{ }
.igc-up-right { justify-self: end; }

.igc-upcoming-grid .up-card {
  padding: 10px 12px;
  border-radius: var(--igc-radius-sm);
  font-size: 14px;
  line-height: 1.4;
  border: 1px solid #e5e9f5;
  box-shadow: var(--igc-shadow);
  max-width: 320px;
}
.up-card.up-gh { background: var(--igc-gh-bg); border-color: var(--igc-gh-border); color: var(--igc-gh-text); }
.up-card.up-rh { background: var(--igc-rh-bg); border-color: var(--igc-rh-border); color: var(--igc-rh-text); }

/* Let text wrap fully (no ellipsis) */
.up-card .up-line1,
.up-card .up-line2 { white-space: normal; overflow: visible; text-overflow: clip; }

/* ---------- Responsive (non-conflicting) ---------- */
@media (max-width: 720px) {
  :root { --igc-gap: 10px; --igc-pad: 12px; }
  .igc-month-title { font-size: 20px; }
  .day-card { min-height: 92px; padding: 9px; }
}
@media (max-width: 480px) {
  :root { --igc-gap: 8px; --igc-pad: 10px; --igc-daynum-size: 16px; }
  .day-card { min-height: 86px; padding: 8px; }
  .day-title { -webkit-line-clamp: 2; }
}

/* ---------- Print ---------- */
@media print {
  .igc-calendar-wrap { box-shadow: none; background:#fff; }
  .igc-nav-left, .igc-nav-right, .igc-upcoming-grid { display:none !important; }
  .igc-grid { gap: 6px; }
  .day-card { break-inside: avoid; }
}

/* State */
.day-card.is-active { transform: translateY(0); box-shadow: 0 0 0 2px var(--igc-focus) inset; }

/* ---------- Micro Tags (tiny corner labels) ---------- */
.micro-tag {
  position: absolute;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 3px;
  z-index: 3;
  line-height: 1.2;
  white-space: nowrap;
}

/* GH tag style (solid red, white text) */
.micro-tag.micro-gh {
  background: #b30000;
  color: #fff;
  border: 1px solid #b30000;
}

/* RH tag (solid green) */
.micro-tag.micro-rh {
  background: #28a745;
  color: #fff;
  border: 1px solid #28a745;
}

/* Optional combined style (kept just in case) */
.micro-tag.micro-dual {
  background: #111;
  color: #fff;
}

/* Position helpers for desktop */
.micro-tag.micro-top    { top: 5px;    right: 5px; }   /* top-right (GH) */
.micro-tag.micro-bottom { bottom: 5px; right: 5px; }   /* bottom-right (RH) */

/* Weekend overlays for special cases */
.day-card.wknd-has-rh { box-shadow: inset 3px 0 0 rgba(22,101,52,0.85), var(--igc-shadow); }
.day-card.gh-wknd     { box-shadow: inset 3px 0 0 rgba(127,29,29,0.9), var(--igc-shadow); }

/* TODAY micro-tag (center-top) */
.micro-tag.micro-today {
  top: 4px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  background: var(--today-accent, var(--igc-today));
  color: #fff;
  border: 1px solid var(--today-accent, var(--igc-today));
}

/* ===========================
   Mobile (≤ 560px) — unified rules
   =========================== */
/* ===========================
   Mobile (≤ 560px) — title shown + bottom micro-tags (non-stretch)
   =========================== */
@media (max-width: 560px) {
  /* Layout + spacing */
  :root {
    --igc-gap: 10px;
    --igc-pad: 12px;
    --igc-daynum-size: 16px;
    --igc-day-height-mobile: 84px; /* tweak if needed */
  }

  .igc-calendar-header { grid-template-columns: 1fr !important; row-gap: 8px; }
  .igc-nav-left, .igc-nav-right, .igc-month-title { text-align: center; justify-self: center; }
  .igc-upcoming-grid { grid-template-columns: 1fr; row-gap: 8px; }
  .igc-up-left, .igc-up-right { justify-self: center; }

  /* Uniform card height + extra bottom padding for tags */
  .day-card {
    height: var(--igc-day-height-mobile);
    min-height: 0;
    padding: 8px 8px 24px;   /* room for bottom micro-tag(s) */
    overflow: hidden;        /* keep grid tidy */
  }

  .day-card .day-num { margin-bottom: 2px; }
  .day-card.today .day-num { margin-top: 14px; } /* room for Today at top-center */

  /* Title: keep visible, compact to one line */
  .day-title {
    font-size: 12px;
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ----- Micro-tags (non-stretch, bottom aligned) ----- */
  /* Base: a single tag sits bottom-center */
  .micro-tag {
    position: absolute;
    bottom: 6px;
    top: auto;              /* ensure no top constraint is active */
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    display: inline-flex;   /* prevents stretching */
    align-items: center;
    height: auto;           /* explicit: don't stretch */
    max-width: calc(100% - 14px);
    font-size: 11px;
    line-height: 1;         /* compact */
    padding: 3px 6px;
    border-radius: 4px;
  }

  /* If BOTH GH and RH exist: split to corners (still bottom) */
  .day-card .micro-tag.micro-gh {
    left: 8px;
    right: auto;
    transform: none;
  }
  .day-card .micro-tag.micro-rh {
    right: 8px;
    left: auto;
    transform: none;
  }

  /* Today stays at center-top, minimal size, never stretches */
  .micro-tag.micro-today {
    top: 4px;
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border: 1px solid var(--today-accent, var(--igc-today));
    background: var(--today-accent, var(--igc-today));
    font-size: 11px;
    line-height: 1;
    padding: 2px 6px;
  }

  /* Parliament logo a touch smaller on mobile */
  .parliament-logo { width: 20px; height: 20px; }
}
/* =========================================
   MOBILE FIX (≤ 560px): keep title small, tags bottom, no stretch
   Put this at the very end of your CSS file
   ========================================= */
@media (max-width: 560px) {
  /* Title stays visible but compact */
  .day-title {
    font-size: 12px;
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Base mobile tag: inline size, never stretch vertically */
  .micro-tag {
    position: absolute;
    display: inline-flex;
    align-items: center;
    height: auto;                 /* prevent stretching */
    line-height: 1;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    max-width: calc(100% - 16px);
    white-space: nowrap;
  }

  /* Neutralize desktop corner helpers (SPECIFICITY FIX) */
  .micro-tag.micro-top,
  .micro-tag.micro-bottom {
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
  }

  /* Default: single tag sits bottom-center */
  .day-card .micro-tag:not(.micro-today) {
    bottom: 6px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }

  /* If BOTH GH & RH exist: split them */
  /* GH → bottom-left */
  .day-card .micro-tag.micro-gh:not(.micro-today) {
    bottom: 6px !important;
    left: 8px !important;
    right: auto !important;
    transform: none !important;
  }
  /* RH → bottom-right */
  .day-card .micro-tag.micro-rh:not(.micro-today) {
    bottom: 6px !important;
    right: 8px !important;
    left: auto !important;
    transform: none !important;
  }

  /* Today stays top-center, small, non-stretchy */
  .micro-tag.micro-today {
    top: 4px !important;
    bottom: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1;
  }
}
/* ===========================
   Mobile adjustment: move Parliament logo to bottom
   =========================== */
@media (max-width: 560px) {
  .parliament-logo {
    top: auto !important;          /* remove top placement */
    bottom: 6px !important;        /* push to bottom */
    right: 50% !important;         /* center horizontally */
    left: auto !important;
    transform: translateX(50%);    /* adjust centering */
    width: 20px;
    height: 20px;
  }
}
/* ===========================
   Mobile simplification for TODAY
   =========================== */
@media (max-width: 560px) {
  /* Hide Today label on mobile */
  .micro-tag.micro-today {
    display: none !important;
  }

  /* Reset Today day-number margin (same as others) */
  .day-card.today .day-num {
    margin-top: 0 !important;  /* same baseline as normal days */
  }
}
@media (max-width: 560px) {
  :root {
    --igc-gap: 6px;   /* tighter spacing */
  }
}

@media (max-width: 420px) {
  :root {
    --igc-gap: 4px;   /* ultra-compact for very small screens */
  }
}
@media (max-width: 560px) {
  /* If both GH and RH are present, hide the GH micro-tag */
  .day-card .micro-tag.micro-gh:has(+ .micro-tag.micro-rh) {
    display: none !important;
  }
}
@media (max-width: 560px) {
  .day-title {
    font-size: 10px;
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;        /* force single line */
    overflow: hidden;           /* clip overflow text */
    text-overflow: ellipsis;    /* add ... */
  }
}
/* Legends container: left group vs right pill */
.igc-legends {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 12px;
  gap: 8px;
}

.igc-legends-left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-weekend {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  font-weight: 500;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
  .pill-weekend {
    background: #1a222d;
    color: #aeb7c2;
    border-color: #2b3645;
  }
}
/* Trivia page wrapper */
.igc-trivia-wrap { margin-top: 10px; }

/* Header */
.igc-trivia-title { margin: 0 0 6px; font-weight: 800; }
.igc-trivia-sub { color: var(--igc-muted, #6b7280); margin-bottom: 10px; }

/* Pills row (reuse existing .pill styles) */
.igc-trivia-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill-weekend { background:#f3f4f6; color:#374151; border:1px solid #d1d5db; }
@media (prefers-color-scheme: dark) {
  .pill-weekend { background:#1a222d; color:#aeb7c2; border-color:#2b3645; }
}

/* Sections */
.igc-trivia-section { margin: 16px 0; }
.igc-trivia-h3 { margin: 0 0 8px; font-size: 18px; }

/* Lists */
.igc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.igc-list li { display: grid; grid-template-columns: 120px 1fr auto; gap: 8px; padding: 8px 10px; border: 1px solid var(--igc-border, #e6e6e6); border-radius: 10px; background: var(--igc-bg, #fff); }
.igc-date { font-weight: 700; }
.igc-wtag { font-size: 12px; color: var(--igc-muted, #6b7280); }

@media (max-width: 560px) {
  .igc-list li { grid-template-columns: 1fr; }
  .igc-wtag { justify-self: start; }
}

/* Month summary table */
.igc-month-table { display: grid; gap: 6px; }
.igc-row { display: grid; grid-template-columns: 1.4fr repeat(5, .9fr); gap: 6px; padding: 8px 10px; border: 1px solid var(--igc-border, #e6e6e6); border-radius: 10px; background: var(--igc-bg, #fff); }
.igc-row.igc-head { font-weight: 700; background: rgba(0,0,0,.02); }
@media (prefers-color-scheme: dark) { .igc-row.igc-head { background: rgba(255,255,255,.04); } }
@media (max-width: 560px) { .igc-row { grid-template-columns: 1.2fr repeat(5, .8fr); } }

.igc-empty { color: var(--igc-muted, #6b7280); }
