/* ==========================================================================
   Viuna Chlorination & Solar Calculator Stylesheet
   Palette: Viuna Brand Design System
   ========================================================================== */

/* Dana Variable Font */
@font-face {
  font-family: 'DanaVF';
  src: url('../fonts/DanaVF.ttf') format('truetype');
  font-weight: 10 990;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'viunaco';
  src: url('../fonts/DanaVF.ttf') format('truetype');
  font-weight: 10 990;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Approved Viuna Palette */
  --color-primary-blue: #2563A6;
  --color-deep-navy: #123B59;
  --color-dark-navy: #101D30;
  --color-light-blue: #EDF4FA;
  --color-olive-accent: #929017;
  --color-white: #FFFFFF;
  --color-main-text: #33475B;
  --color-muted-text: #66788A;
  --color-border: #DFE7EF;

  /* Semantic status colors */
  --color-success: #1b8a5a;
  --color-success-bg: #eef8f3;
  --color-success-border: #bce3cf;

  --color-warning: #c27803;
  --color-warning-bg: #fdf8ec;
  --color-warning-border: #f6e2b5;

  --color-error: #c92a2a;
  --color-error-bg: #fdf2f2;
  --color-error-border: #f8c8c8;

  /* Typography */
  --font-base: 'DanaVF', 'viunaco', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Radii */
  --radius-card: 14px;
  --radius-input: 12px;
  --radius-btn: 12px;
  --radius-badge: 10px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  background: transparent;
  width: 100%;
  min-width: 0;
}

body {
  font-family: var(--font-base);
  background: transparent;
  color: var(--color-main-text);
  direction: rtl;
  text-align: right;
  line-height: 1.6;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 0;
}

#root {
  width: 100%;
  max-width: none;
  min-width: 0;
  background: transparent;
}

input, select, button, textarea {
  font-family: inherit;
  color: inherit;
}

/* Base interactive focus */
input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: none;
  border-color: var(--color-olive-accent) !important;
  box-shadow: 0 0 0 3px rgba(146, 144, 23, 0.2) !important;
}

/* Outer app wrapper (fills 100% of iframe/container, transparent backdrop) */
.app-wrapper {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
}

/* Compact Tab Bar */
.tab-nav-container {
  display: flex;
  margin-bottom: 20px;
}

.tab-list {
  display: inline-flex;
  background: var(--color-light-blue);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  gap: 4px;
  width: 100%;
  max-width: 360px;
}

.tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  user-select: none;
  min-height: 42px;
}

.tab-btn.active {
  background: var(--color-primary-blue);
  box-shadow: 0 1px 3px rgba(37, 99, 166, 0.2);
}

.tab-icon {
  font-size: 16px;
  line-height: 1;
}

.tab-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-main-text);
}

.tab-btn.active .tab-label {
  color: var(--color-white);
}

.tab-btn:hover:not(.active) {
  background: rgba(37, 99, 166, 0.08);
}

/* Tab content area */
.tab-content {
  width: 100%;
  min-width: 0;
}

/* Sections */
.calc-section {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 18px 0 0;
  box-sizing: border-box;
}

/* Content cards */
.calc-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 22px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(16, 29, 48, 0.03);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Two-column desktop grid for fields (>=900px) */
.fields-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px 24px;
  width: 100%;
}

.field-group {
  min-width: 0;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-main-text);
  margin-bottom: 8px;
}

/* Flex and grid inputs */
.calc-input-row {
  display: flex;
  gap: 7px;
  align-items: stretch;
  width: 100%;
}

.calc-input-row > * {
  min-width: 0;
}

.calc-select {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 11px 14px;
  color: var(--color-dark-navy);
  font-size: 15px;
  font-weight: 600;
  outline: none;
  direction: rtl;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Action Button Group */
.action-btn-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn-calc {
  min-width: 200px;
  max-width: 260px;
  min-height: 46px;
  background: var(--color-primary-blue);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-btn);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.btn-calc:hover {
  background: #1c528d;
}

.btn-reset {
  min-width: 120px;
  max-width: 160px;
  min-height: 46px;
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-btn);
  padding: 12px 18px;
  color: var(--color-muted-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-reset:hover {
  background: var(--color-light-blue);
  color: var(--color-deep-navy);
  border-color: #cbd8e4;
}

/* Results layout */
.result-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
  width: 100%;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
  width: 100%;
}

.result-stat-box {
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(16, 29, 48, 0.03);
  position: relative;
  overflow: hidden;
  min-width: 0;
}

/* Equipment wrap */
.equipment-wrap {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .fields-grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .results-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .result-grid-2 {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .calc-card {
    padding: 16px;
  }
}

@media (max-width: 600px) {
  .tab-list {
    max-width: 100%;
  }
  .action-btn-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-calc, .btn-reset {
    min-width: 100%;
    max-width: 100%;
    width: 100%;
  }
  .result-grid-2 {
    gap: 8px;
  }
}
