
/* ntes-theme.css | Dual Dark + Light Theme */

/* ---------- Base Variables (Dark Mode Default) ---------- */
:root {
  /* Colors */
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-border: #334155;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-heading: #2563eb;     /* Blue-600 */
  --color-link: #60a5fa;
  --color-link-hover: #93c5fd;
  --color-error: #dc2626;       /* Red-600 */
  --color-success: #15803d;     /* Green-700 */

  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 16px rgba(0, 0, 0, 0.35);

  /* Spacing */
  --radius-sm: 4px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --gap: 32px;

  /* Typography */
  --font-base: 16px;
  --font-family: "Inter", "Roboto", Arial, sans-serif;
}

/* ---------- Light Mode Overrides ---------- */
body.light-mode {
  --color-bg: #f8fafc;          /* Gray-50 */
  --color-surface: #ffffff;     /* White */
  --color-border: #e2e8f0;      /* Gray-200 */
  --color-text: #1e293b;        /* Slate-800 */
  --color-text-muted: #64748b;  /* Slate-500 */
  --color-heading: #1d4ed8;     /* Blue-700 */
  --color-link: #2563eb;
  --color-link-hover: #1e40af;
  --color-error: #b91c1c;       /* Red-700 */
  --color-success: #15803d;     /* Green-700 */

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 6px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 16px rgba(0, 0, 0, 0.12);
}

/* ---------- Global Reset and Typography ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--font-base);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  transition: background 0.3s ease, color 0.3s ease;
}

#theme-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--color-text);
  transition: color 0.3s ease;
}

#theme-toggle:hover {
  color: var(--color-heading);
}

/* ---------- Layout ---------- */
.content {
  margin-top: 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  width: 100%;
}

.box {
  min-width: 50%;
  max-width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: var(--color-text);
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, color 0.3s ease;
}

.box:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ---------- Typography ---------- */
h2 {
  font-size: clamp(1.25rem, 2vw + 1rem, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
  color: var(--color-heading);
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.7rem, 0.6vw + 0.7rem, 1.1rem);
  margin-bottom: 2rem;
}

th {
  background: var(--color-surface);
  font-weight: 600;
  color: var(--color-text);
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  transition: background 0.2s ease, color 0.2s ease;
}

tr:nth-child(even) {
  background: var(--color-bg);
}

tr:hover {
  background: var(--color-surface);
}

th:nth-child(6),
td:nth-child(6) {
  font-size: 85%;
}

/* ---------- Train Number and Type Highlights ---------- */
.train_no {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px;
  text-align: center;
  border-radius: var(--radius-sm);
}

.DMU,
.MEMU {
  background: mediumpurple;
  color: #fff;
}

.SUPERFAST {
  background: var(--color-success);
  color: #fff;
}

.SHATABDI {
  background: #9d174d;
  color: #fff;
}

.JAN {
  background: #f182af;
  color: #fff;
}

.MAIL{
  background: black;
  color: #fff;
}

/* ---------- Utilities ---------- */
span.fade {
  color: var(--color-text-muted);
  display: inline-block;
  width: 4.5em;
  text-align: right;
}

th.from,
td.from {
  font-size: 60%;
  color: var(--color-text-muted);
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-link-hover);
}

.loading {
  text-align: center;
  padding: 20px;
  color: var(--color-text-muted);
  font-style: italic;
}

.error {
  text-align: center;
  padding: 20px;
  color: var(--color-error);
  font-weight: 500;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 20px 0;
}

/* ---------- Rounded Buttons (w3 classes) ---------- */
.w3-round,
.w3-round-medium {
  border-radius: var(--radius-sm);
}

.w3-red,
.w3-hover-red:hover {
  color: #fff !important;
  background-color: #f44336 !important;
}

/* ---------- Responsive Styles ---------- */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
  }

  .container .box:nth-child(2) {
    order: -1;
  }
}

@media (max-width: 768px) {
  .content {
    grid-template-columns: 1fr;
  }

  .content .box:nth-child(2) { order: 1; }
  .content .box:nth-child(1) { order: 2; }
  .content .box:nth-child(3) { order: 3; }

  .box {
    min-width: auto;
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
  }

  table {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  th, td{
      padding: 5px;
  }
  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }
}

/* ---------- Desktop Order ---------- */
.content .box:nth-child(1) { order: 1; }
.content .box:nth-child(2) { order: 2; }
.content .box:nth-child(3) { order: 3; }
