/**
 * MEPBase Tools - Professional CSS
 * Version: 3.0
 * Modern, Clean, Professional Design
 */

/* ===== CSS Variables (Light Theme) ===== */
:root {
  /* Brand Colors */
  --brand: #00856f;
  --brand-dark: #006d5b;
  --brand-soft: #ecfdf5;
  
  /* Text Colors */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  /* Background Colors */
  --bg-main: #f8fafc;
  --bg-alt: #f1f5f9;
  
  /* Card & Input */
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --input-bg: #f8fafc;
  --input-border: #cbd5e1;
  
  /* Results */
  --result-bg: #f0fdf4;
  --result-border: #86efac;
  
  /* Navigation */
  --nav-bg: #0f172a;
  
  /* Status Colors */
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --info: #2563eb;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --brand: #10b981;
  --brand-dark: #059669;
  --brand-soft: rgba(16, 185, 129, 0.15);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --bg-main: #0f172a;
  --bg-alt: #1e293b;
  
  --card-bg: #1e293b;
  --card-border: #334155;
  --input-bg: #0f172a;
  --input-border: #475569;
  
  --result-bg: rgba(16, 185, 129, 0.1);
  --result-border: #059669;
  
  --nav-bg: #020617;
}

/* ===== Base Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-main);
  background: var(--bg-main);
  min-height: 100vh;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
}

h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
h3 { font-size: 1.15rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

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

a:hover {
  color: var(--brand-dark);
}

/* ===== Layout ===== */
.page-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover {
  color: var(--brand);
}

.breadcrumbs .separator {
  color: var(--text-light);
}

.breadcrumbs .current {
  color: var(--text-main);
  font-weight: 500;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ===== Form Elements ===== */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

input::placeholder {
  color: var(--text-light);
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-main);
  font-size: 0.9rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand);
  color: white;
}

.btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 133, 111, 0.25);
}

.btn-secondary {
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--input-border);
}

.btn-secondary:hover {
  background: var(--bg-alt);
  border-color: var(--brand);
}

/* ===== Calculator Layout ===== */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}

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

.input-group {
  margin-bottom: 16px;
}

.input-row {
  display: flex;
  gap: 10px;
}

.input-row input,
.input-row select {
  flex: 1;
}

/* ===== Result Cards ===== */
.result-card {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

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

.result-item {
  background: var(--card-bg);
  padding: 14px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--card-border);
}

.result-item .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.2;
}

.result-item .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

th {
  background: var(--input-bg);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Utility Classes ===== */
.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* ===== References Section ===== */
.references {
  margin-top: 40px;
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.references h4 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.references ul {
  margin: 0;
  padding-left: 20px;
}

.references li {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

/* ===== SEO Content ===== */
.seo-content {
  margin-top: 50px;
  padding: 30px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
}

.seo-content h2 {
  margin-bottom: 16px;
}

.seo-content p {
  line-height: 1.7;
}

/* ===== Ad Slots ===== */
.ad-slot {
  padding: 16px;
  margin: 20px 0;
  text-align: center;
  background: var(--bg-alt);
  border-radius: 12px;
  min-height: 90px;
}

.ad-header_ad {
  max-width: 1400px;
  margin: 20px auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ===== Print Styles ===== */
@media print {
  .main-nav,
  .main-footer,
  .btn,
  .ad-slot,
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card {
    border: 1px solid #ddd;
    box-shadow: none;
  }
  
  .page-wrap {
    max-width: 100%;
    padding: 0;
  }
  
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #000;
  }
  
  .print-footer {
    display: block !important;
    text-align: center;
    margin-top: 30px;
    padding-top: 10px;
    border-top: 1px solid #ccc;
    font-size: 0.8rem;
    color: #666;
  }
}

.print-header,
.print-footer {
  display: none;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .page-wrap {
    padding: 16px;
  }
  
  .card {
    padding: 16px;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  .btn {
    width: 100%;
  }
}

/* ===== Last Updated Badge ===== */
.last-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--input-bg);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
}

/* ===== Status Indicators ===== */
.status-ok { color: var(--success); }
.status-warn { color: var(--warning); }
.status-error { color: var(--error); }

/* ===== Tooltip ===== */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: var(--nav-bg);
  color: white;
  font-size: 0.8rem;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 100;
}
