/* Base Reset & Modern Engineering Palette */
:root {
  --primary-color: #1e3a8a;       /* Deep Navy Blue */
  --primary-hover: #1e40af;       /* Royal Blue */
  --accent-blue: #0284c7;        /* Sky Accent Blue */
  --bg-main: #f1f5f9;            /* Light Slate Background */
  --card-bg: #ffffff;            /* White Container */
  --text-dark: #0f172a;          /* Dark Slate Text */
  --text-muted: #64748b;         /* Muted Gray Text */
  --border-color: #cbd5e1;       /* Border Gray */
  --panel-bg: #f8fafc;           /* Result Dashboard Slate */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-dark);
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

/* App Core Container */
.app-card {
  background: var(--card-bg);
  max-width: 860px;
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(30, 58, 138, 0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  padding: 28px;
  display: flex;
  flex-direction: column;
}

/* Header Section with Blue Accent Gradient */
.app-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
}

.logo-title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0f2fe;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #bae6fd;
}

.header-text {
  text-align: left;
}

.app-header h1 {
  font-size: 1.6rem;
  color: var(--primary-color);
  font-weight: 800;
  line-height: 1.2;
}

.app-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

/* Tab Navigation - Styled Pill Style */
.tab-navigation {
  display: flex;
  background: #e2e8f0;
  padding: 5px;
  border-radius: 10px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(30, 58, 138, 0.25);
}

/* Flex Dashboard Layout */
.app-body {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.input-panel {
  flex: 1.25;
  min-width: 0;
}

.results-dashboard {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  min-height: 300px;
}

.results-dashboard h3 {
  font-size: 1.05rem;
  margin-bottom: 14px;
  color: var(--primary-color);
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
  font-weight: 700;
}

.placeholder-msg {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 45px;
  line-height: 1.6;
}

/* Inputs & Form Elements */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.tab-content h3 {
  font-size: 1.15rem;
  color: var(--primary-color);
  margin-bottom: 16px;
  font-weight: 700;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.input-grid.double {
  grid-template-columns: repeat(2, 1fr);
}

.field {
  display: flex;
  flex-direction: column;
}

.field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.field input, 
.field select {
  padding: 10px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text-dark);
  width: 100%;
  background: #ffffff;
  transition: all 0.2s;
}

.field select {
  text-align: left;
  cursor: pointer;
  font-weight: 600;
}

.field input {
  text-align: center;
  font-weight: 600;
}

.field input:focus, 
.field select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.section-divider {
  font-size: 0.78rem;
  color: var(--accent-blue);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 16px 0 10px 0;
  border-left: 3px solid var(--accent-blue);
  padding-left: 8px;
}

/* Calculate Action Button */
.calc-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  border: none;
  padding: 13px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 12px;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.calc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(30, 58, 138, 0.3);
}

/* Results Output Table */
.results-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.results-table th, 
.results-table td {
  padding: 11px 12px;
  text-align: left;
  font-size: 0.875rem;
}

.results-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.results-table tr {
  border-bottom: 1px solid #f1f5f9;
}

/* Colored Status Badges */
.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-block;
}
.badge.primary { background: #dbeafe; color: #1e40af; }     /* Blue Badge */
.badge.secondary { background: #dcfce7; color: #166534; }   /* Green Badge */
.badge.status { background: #f1f5f9; color: #334155; }      /* Slate Badge */

/* Diagram Box */
.module-diagram {
  width: 100%;
  margin-bottom: 14px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 130px;
}

.responsive-img {
  max-width: 100%;
  max-height: 130px;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Bottom Footer */
.app-footer {
  width: 100%;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.app-footer p {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Mobile Responsiveness Rules */
@media (max-width: 680px) {
  .app-body {
    flex-direction: column;
  }
  .results-dashboard {
    width: 100%;
    min-height: auto;
  }
  .logo-title-container {
    flex-direction: column;
    text-align: center;
  }
  .header-text {
    text-align: center;
  }
  .input-grid {
    grid-template-columns: 1fr; /* Stack input fields vertically on narrow screens */
  }
}