/* ==========================================================================
   DRMS - MK Rain → iRains Data Converter
   Theme inspired by SynopX Meteorological Suite (IMD Patna)
   Author: Lal Kamal (MC Patna)
   ========================================================================== */

:root {
  --primary: #0ea5e9;
  --secondary: #6366f1;
  --accent: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-dark: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --table-head-bg: rgba(15, 23, 42, 0.85);
  --table-border: rgba(255, 255, 255, 0.08);
  --table-row-alt: rgba(255, 255, 255, 0.02);
  --table-hover: rgba(14, 165, 233, 0.1);
  --wn-bg: rgba(245, 158, 11, 0.15);
  --wn-border: rgba(245, 158, 11, 0.35);
  --wn-text: #fde68a;
  --bd-bg: rgba(239, 68, 68, 0.15);
  --bd-border: rgba(239, 68, 68, 0.35);
  --bd-text: #fca5a5;
  --fx-bg: rgba(100, 116, 139, 0.2);
  --fx-text: #cbd5e1;
}

/* Light Theme Overrides */
body.light-theme {
  --bg-dark: #f0f4f8;
  --card-bg: rgba(255, 255, 255, 0.9);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.1);
  --text-main: #0f172a;
  --text-muted: #475569;
  --table-head-bg: rgba(226, 232, 240, 0.95);
  --table-border: rgba(0, 0, 0, 0.08);
  --table-row-alt: rgba(0, 0, 0, 0.02);
  --table-hover: rgba(14, 165, 233, 0.12);
  --wn-bg: #fef3c7;
  --wn-border: #fcd34d;
  --wn-text: #92400e;
  --bd-bg: #fee2e2;
  --bd-border: #fca5a5;
  --bd-text: #991b1b;
  --fx-bg: #e2e8f0;
  --fx-text: #475569;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Outfit", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* --------------------------------------------------------------------------
   Background Animations & Orbs (Identical to SynopX Reference)
   -------------------------------------------------------------------------- */
.bg-animation {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  background: linear-gradient(45deg, #0f172a, #1e1b4b, #020617, #172554);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body.light-theme .bg-animation {
  background: linear-gradient(45deg, #f0f4f8, #d9e2ec, #bcccdc);
  background-size: 400% 400%;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(85px);
  z-index: -1;
  pointer-events: none;
  animation: floatOrb 12s infinite ease-in-out alternate;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: rgba(14, 165, 233, 0.22);
  top: -120px;
  left: -120px;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: rgba(99, 102, 241, 0.2);
  bottom: -150px;
  right: -100px;
  animation-delay: -5s;
}

.orb-3 {
  width: 380px;
  height: 380px;
  background: rgba(244, 63, 94, 0.14);
  top: 45%;
  left: 55%;
  transform: translate(-50%, -50%);
  animation-duration: 18s;
}

@keyframes floatOrb {
  0% { transform: translateY(0px) scale(1); }
  100% { transform: translateY(-35px) scale(1.12); }
}

body.light-theme .orb-1 { background: rgba(14, 165, 233, 0.12); }
body.light-theme .orb-2 { background: rgba(99, 102, 241, 0.1); }
body.light-theme .orb-3 { background: rgba(244, 63, 94, 0.08); }

/* --------------------------------------------------------------------------
   Glassmorphic Panels & Cards
   -------------------------------------------------------------------------- */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.core-glass-panel {
  background: rgba(30, 41, 59, 0.65);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border-radius: 20px;
}

body.light-theme .core-glass-panel {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08) !important;
}

/* --------------------------------------------------------------------------
   Typography & Glow Titles
   -------------------------------------------------------------------------- */
.main-title {
  background: linear-gradient(to right, #38bdf8, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s infinite linear;
  background-size: 200% auto;
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* --------------------------------------------------------------------------
   Modern Tab Controls
   -------------------------------------------------------------------------- */
.tabs-container {
  display: flex;
  gap: 8px;
  padding: 6px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}

body.light-theme .tabs-container {
  background: rgba(226, 232, 240, 0.7);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

body.light-theme .tab-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.tab-btn[aria-selected="true"] {
  color: #ffffff;
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
}

/* --------------------------------------------------------------------------
   Form Elements & Buttons
   -------------------------------------------------------------------------- */
.form-input, .form-textarea {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

body.light-theme .form-input, body.light-theme .form-textarea {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.form-input:focus, .form-textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--glass-border);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}
body.light-theme .btn-secondary {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}
body.light-theme .btn-secondary:hover {
  background: #e2e8f0;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ffffff;
}
body.light-theme .btn-danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* --------------------------------------------------------------------------
   Table & Scrollable Containers
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 350px);
  min-height: 380px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(12px);
}

body.light-theme .table-wrap {
  background: rgba(255, 255, 255, 0.85);
}

.custom-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}

.custom-table th {
  position: sticky;
  top: 0;
  background: var(--table-head-bg);
  backdrop-filter: blur(10px);
  color: var(--text-main);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 2px solid var(--glass-border);
  border-right: 1px solid var(--table-border);
  white-space: nowrap;
  z-index: 10;
}

.custom-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--table-border);
  border-right: 1px solid var(--table-border);
  white-space: nowrap;
  color: var(--text-main);
}

.custom-table tr:nth-child(even) td {
  background: var(--table-row-alt);
}

.custom-table tr:hover td {
  background: var(--table-hover);
}

.custom-table td.row-num {
  color: var(--text-muted);
  text-align: right;
  width: 52px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.15) !important;
}

body.light-theme .custom-table td.row-num {
  background: rgba(0, 0, 0, 0.04) !important;
}

.custom-table td.hdr-row {
  font-weight: 700;
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.1) !important;
}

.table-input {
  width: 100%;
  min-width: 90px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 6px;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  text-align: right;
  transition: all 0.2s ease;
}

.table-input:hover {
  background: rgba(255, 255, 255, 0.06);
}

.table-input:focus {
  background: rgba(15, 23, 42, 0.9);
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
  outline: none;
}

body.light-theme .table-input:focus {
  background: #ffffff;
}

/* Row Status Highlights */
tr.w td {
  background: var(--wn-bg) !important;
  color: var(--wn-text) !important;
  border-bottom-color: var(--wn-border) !important;
}

tr.b td {
  background: var(--bd-bg) !important;
  color: var(--bd-text) !important;
  border-bottom-color: var(--bd-border) !important;
}

tr.f td {
  background: var(--fx-bg) !important;
  color: var(--fx-text) !important;
}

/* --------------------------------------------------------------------------
   Custom Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.45);
}

/* --------------------------------------------------------------------------
   Status Bar & Notifications
   -------------------------------------------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-muted);
}
body.light-theme .status-pill {
  background: #ffffff;
}
.status-pill b {
  color: var(--text-main);
}
.status-pill .bad {
  color: #f87171;
  font-weight: 600;
}
.status-pill .good {
  color: #34d399;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Advanced Footer (Neon Pulse by Lal Kamal)
   -------------------------------------------------------------------------- */
.advanced-footer {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.75) 0%, rgba(30, 41, 59, 0.85) 100%);
  color: var(--text-main);
  padding: 22px 20px;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  width: 100%;
  box-sizing: border-box;
  margin: 2.5rem auto 1rem auto;
}

body.light-theme .advanced-footer {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(241, 245, 249, 0.95) 100%);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.footer-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.analysis-section {
  margin-bottom: 10px;
}

.analysis-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.analysis-content {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--text-main);
}

.highlight-name {
  color: #ffffff;
  font-weight: 800;
  font-size: 1.3rem;
  text-shadow:
    0 0 5px #0ea5e9,
    0 0 10px #0ea5e9,
    0 0 20px #0ea5e9,
    0 0 35px #0284c7;
  margin-left: 6px;
  display: inline-block;
  animation: neon-pulse 1.8s infinite alternate;
}

body.light-theme .highlight-name {
  color: #0284c7;
  text-shadow: 0 0 8px rgba(14, 165, 233, 0.4);
}

@keyframes neon-pulse {
  from {
    text-shadow: 0 0 4px #0ea5e9, 0 0 10px #0ea5e9, 0 0 18px #0284c7;
  }
  to {
    text-shadow: 0 0 8px #38bdf8, 0 0 20px #0ea5e9, 0 0 32px #0284c7;
  }
}

.data-source-bar {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--glass-border);
  padding-top: 10px;
  margin-top: 8px;
  width: 100%;
}

.source-highlight {
  color: #38bdf8;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Multi-Day Excel Converter Dropzone & Table Enhancements
   -------------------------------------------------------------------------- */
.dropzone-active {
  border-color: #38bdf8 !important;
  background: rgba(14, 165, 233, 0.12) !important;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.35);
}

.table-wrap-multiday {
  overflow: auto;
  max-height: calc(100vh - 340px);
  min-height: 400px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(14px);
}

body.light-theme .table-wrap-multiday {
  background: rgba(255, 255, 255, 0.9);
}

/* Sticky left columns for wide date table */
.sticky-col-1 {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--card-bg) !important;
  border-right: 1px solid var(--table-border) !important;
}

.sticky-col-2 {
  position: sticky;
  left: 120px;
  z-index: 5;
  background: var(--card-bg) !important;
  border-right: 2px solid var(--glass-border) !important;
}

th.sticky-col-1, th.sticky-col-2 {
  z-index: 20 !important;
  background: var(--table-head-bg) !important;
}

.cell-rain-pos {
  color: #38bdf8;
  font-weight: 700;
}

.cell-fixed {
  color: #fbbf24;
  font-weight: 700;
}

