/* ==========================================================================
   ESS - Estratificación de Suelo SEV (repositorIA)
   Theme: Modern Geophysics & Electrical Engineering UI
   ========================================================================== */

:root {
  --bg-primary: #0b111e;
  --bg-secondary: #131d2e;
  --bg-card: rgba(19, 29, 46, 0.85);
  --bg-glass: rgba(15, 23, 38, 0.75);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #00d2ff;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #00d2ff;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;
  
  --gradient-brand: linear-gradient(135deg, #00d2ff 0%, #3b82f6 100%);
  --gradient-amber: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --gradient-emerald: linear-gradient(135deg, #10b981 0%, #059669 100%);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-neon: 0 0 15px rgba(0, 210, 255, 0.3);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  height: 64px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--gradient-brand);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-neon);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.brand-badge {
  font-size: 0.7rem;
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-cyan);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  border: 1px solid rgba(0, 210, 255, 0.3);
  margin-left: 0.5rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Main Layout Grid */
.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 1.25rem;
  padding: 1.25rem;
  overflow-y: auto;
}

@media (max-width: 1100px) {
  .app-main {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.panel-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-right {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title i {
  color: var(--accent-cyan);
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-control {
  background: rgba(11, 17, 30, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  transition: 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

/* Data Table */
.table-container {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(11, 17, 30, 0.6);
}

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

.data-table th {
  background: rgba(19, 29, 46, 0.95);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.data-table input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  padding: 0.2rem 0.35rem;
  font-size: 0.8rem;
  border-radius: 4px;
}

.data-table input:focus {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--accent-cyan);
  outline: none;
}

.btn-del-row {
  background: transparent;
  border: none;
  color: var(--accent-rose);
  cursor: pointer;
  padding: 0.2rem;
  opacity: 0.6;
}

.btn-del-row:hover {
  opacity: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: 0.15s ease;
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 210, 255, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: var(--shadow-neon);
  transform: translateY(-1px);
}

.btn-amber {
  background: var(--gradient-amber);
  color: #fff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-amber:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--gradient-emerald);
  color: #fff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

.btn-block {
  width: 100%;
}

/* Metrics & Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: rgba(11, 17, 30, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 0.2rem;
}

/* Charts Containers */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  flex: 1;
}

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

.chart-box {
  background: rgba(11, 17, 30, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  min-height: 380px;
}

.chart-canvas-wrap {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 320px;
}

/* Soil Profile Visualizer */
.soil-profile-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.soil-layers-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 280px;
  background: #090e17;
}

.soil-layer-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
  position: relative;
  transition: 0.2s ease;
}

.soil-layer-block:hover {
  filter: brightness(1.15);
}

.layer-tag {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.layer-depth {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  margin-top: 0.15rem;
}

.layer-rho {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.layer-thick {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  margin-top: 0.1rem;
}

.layer-data {
  font-size: 0.75rem;
  color: #fff;
  text-align: right;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Soil Colors Palette */
.soil-color-1 { background: linear-gradient(90deg, #d97706, #b45309); }
.soil-color-2 { background: linear-gradient(90deg, #059669, #047857); }
.soil-color-3 { background: linear-gradient(90deg, #2563eb, #1d4ed8); }
.soil-color-4 { background: linear-gradient(90deg, #7c3aed, #6d28d9); }
.soil-color-5 { background: linear-gradient(90deg, #db2777, #be185d); }

/* Results Table */
.results-table-wrap {
  margin-top: 0.5rem;
}

.table-results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: center;
}

.table-results th {
  background: rgba(19, 29, 46, 0.9);
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.table-results td {
  padding: 0.45rem;
  border: 1px solid var(--border-color);
}

/* ETAP Export Modal & Box */
.etap-box {
  background: #090e17;
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  white-space: pre-wrap;
  user-select: all;
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* Badges & Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pill-cyan {
  background: rgba(0, 210, 255, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(0, 210, 255, 0.35);
}

.pill-amber {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.pill-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.pill-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Footer */
.app-footer {
  height: 40px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-copy strong {
  color: var(--accent-cyan);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  display: inline-block;
  margin-right: 0.4rem;
}
