/* EWITH Suite - Master Stylesheet (English & Modern UI) */
:root {
  --bg-primary: #0b1120;
  --bg-secondary: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(148, 163, 184, 0.15);
  --card-border-hover: rgba(56, 189, 248, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 10% 10%, rgba(14, 165, 233, 0.14) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(16, 185, 129, 0.09) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navbar */
header {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 1.5rem;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-badge {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.brand-info h1 {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-info h1 .subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.brand-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.project-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}

.tag.highlight {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.1);
}

/* Nav Tabs */
.tabs-nav {
  max-width: 1440px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--card-border);
  scrollbar-width: thin;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.06);
}

/* Main Container */
main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  flex: 1;
  width: 100%;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Suite Tools Hub */
.suite-hero {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.8) 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.suite-hero h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
}

.suite-hero p {
  color: var(--text-muted);
  max-width: 900px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.suite-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.suite-tool-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.25s ease;
}

.suite-tool-card:hover {
  border-color: var(--card-border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.tool-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.tool-icon-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tool-icon {
  font-size: 1.75rem;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
}

.tool-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.tool-or {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.tool-tagline {
  font-size: 0.88rem;
  color: #e2e8f0;
  margin-bottom: 0.5rem;
}

.tool-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
  flex: 1;
}

.tool-metrics-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  color: #38bdf8;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.tool-action-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.tool-coming-soon {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* KPI Banner */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  border-color: var(--card-border-hover);
  transform: translateY(-2px);
}

.kpi-card .kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-card .kpi-val {
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
  margin: 0.4rem 0 0.2rem;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.kpi-card .kpi-val span.unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-card .kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.kpi-card.alert-card {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.08) 0%, rgba(30, 41, 59, 0.8) 100%);
}

.kpi-card.alert-card .kpi-val {
  color: #f87171;
}

.kpi-card.success-card {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, rgba(30, 41, 59, 0.8) 100%);
}

.kpi-card.success-card .kpi-val {
  color: #34d399;
}

/* Card Section */
.card-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title span.badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 1.25rem;
}

.chart-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: var(--radius-md);
  padding: 1rem;
  min-height: 320px;
  position: relative;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

table.data-table th {
  background: rgba(15, 23, 42, 0.9);
  padding: 0.75rem 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

table.data-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  color: var(--text-main);
}

table.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.badge-status {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Pumps Grid (Digital Twin) */
.pumps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.pump-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  position: relative;
  transition: all 0.25s ease;
}

.pump-card.on {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.pump-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.pump-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-green);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.pump-specs {
  font-size: 0.8rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
  color: var(--text-muted);
}

.pump-specs .spec-item strong {
  color: var(--text-main);
  display: block;
  font-size: 0.88rem;
}

.pump-eff-bar {
  margin-top: 0.75rem;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.pump-eff-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  border-radius: 3px;
}

/* Digital Twin Summary Bar */
.dt-summary-bar {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dt-summary-item {
  text-align: center;
}

.dt-summary-item .dt-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.dt-summary-item .dt-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

/* Optimizer Controls */
.optimizer-controls {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 200px;
}

.control-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.control-group input[type="range"] {
  accent-color: var(--accent-cyan);
}

.control-group select, .btn-action {
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-main);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-group select:hover, .btn-action:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #fff;
  font-weight: 600;
  border: none;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 0 18px rgba(6, 182, 212, 0.5);
  transform: translateY(-1px);
}

/* Comparison Boxes */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.comparison-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.comparison-box.baseline {
  border-color: rgba(239, 68, 68, 0.3);
}

.comparison-box.optimized {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, rgba(15, 23, 42, 0.6) 100%);
}

.comparison-box h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
}

.metric-row strong {
  color: #fff;
}

/* Report View */
.report-doc {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 2rem;
  line-height: 1.7;
}

.report-doc h2 {
  font-size: 1.35rem;
  color: #38bdf8;
  margin: 1.5rem 0 0.5rem;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  padding-bottom: 0.3rem;
}

.report-doc h3 {
  font-size: 1.1rem;
  color: #e2e8f0;
  margin: 1rem 0 0.3rem;
}

.report-doc p, .report-doc li {
  color: #cbd5e1;
  font-size: 0.9rem;
}

.report-doc ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

/* Footer */
footer {
  background: rgba(15, 23, 42, 0.9);
  border-top: 1px solid var(--card-border);
  padding: 1.25rem 1.5rem;
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Print Rules */
@media print {
  header, .tabs-nav, footer, .optimizer-controls, .btn-action {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .card-section, .report-doc {
    background: #fff;
    color: #000;
    border: 1px solid #ccc;
    box-shadow: none;
  }
  .tab-content {
    display: block !important;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .grid-2, .comparison-grid {
    grid-template-columns: 1fr;
  }
  .dt-summary-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
