/* Calculator page styles (moved from an inline <style> block in calculator.html; loaded after style.css) */
/* =========================================
     1. ROOT VARIABLES & RESET (From Provided CSS)
     ========================================= */
:root {
  /* Brand Colors */
  --color-primary: #ff4a1c;
  --color-primary-dark: #e03a12;
  --color-secondary: #efeee9;
  --color-accent: #23262b;

  /* UI Colors */
  --color-bg-body: #0d0d0f;
  --color-white: #efeee9;
  --color-text-main: #efeee9;
  --color-text-muted: #6b7178;
  --color-border: rgba(197, 201, 205, 0.15);
  --color-border-hover: rgba(255, 74, 28, 0.5);

  /* Spacing & Layout (Island System) */
  --island-margin-y: 20px;
  --island-margin-x: 20px;
  --island-max-width: 1360px;
  --island-radius: 16px;
  --island-padding: 40px;

  /* Typography */
  --font-main: "Inter", sans-serif;
  --font-icon: "Material Symbols Rounded";

  /* Shadows (Adapted for dark mode) */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 20px rgba(255, 74, 28, 0.2);

  /* Transitions */
  --trans-fast: 0.2s ease;
  --trans-med: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg-body);
  color: var(--color-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--island-margin-y);
  padding-top: var(--island-margin-y);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--trans-fast);
}

ul {
  list-style: none;
}
img,
svg {
  max-width: 100%;
  display: block;
}

.material-symbols-rounded {
  font-variation-settings:
    "FILL" 0,
    "wght" 600,
    "GRAD" 0,
    "opsz" 24;
  vertical-align: middle;
  user-select: none;
}

/* =========================================
     2. ISLAND LAYOUT SYSTEM
     ========================================= */
.island-wrapper {
  max-width: var(--island-max-width);
  margin: 0 auto var(--island-margin-y) auto;
  background-color: var(--color-accent);
  border-radius: var(--island-radius);
  padding: var(--island-padding);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  width: calc(100% - (var(--island-margin-x) * 2));
}

@media (max-width: 768px) {
  :root {
    --island-padding: 24px;
    --island-margin-x: 12px;
    --island-margin-y: 12px;
  }
  body {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

/* =========================================
     3. BUTTONS & TYPOGRAPHY
     ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--trans-med);
  border: none;
}
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
}
.btn-primary:hover {
  background-color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 74, 28, 0.3);
}

.section-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--color-secondary);
  line-height: 1.2;
  text-align: center;
}
.section-desc {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  max-width: 700px;
  margin: 0 auto 40px auto;
  text-align: center;
}

/* =========================================
     4. HEADER
     ========================================= */
.site-header {
  position: sticky;
  top: var(--island-margin-y);
  z-index: 1000;
  padding: 16px 32px;
  box-shadow: var(--shadow-md);
  overflow: visible !important;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-text {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--color-secondary);
  letter-spacing: -0.5px;
}

.main-nav {
  display: block;
}
.nav-list {
  display: flex;
  gap: 24px;
}
.nav-link {
  font-weight: 500;
  font-size: 1rem;
  position: relative;
  padding: 8px 0;
  color: var(--color-white);
  transition: color var(--trans-fast);
}
.nav-link:hover,
.nav-link.active {
  color: var(--color-white);
}
.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width var(--trans-med);
}
.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}
.contact-phone {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary);
}

/* =========================================
     5. CALCULATOR STYLES (NEW)
     ========================================= */
.calc-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  align-items: stretch;
  margin-top: 20px;
}

/* Sidebar: Product Type Selector */
.calc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--color-bg-body);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--color-border);
}

.calc-sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.type-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  background-color: var(--color-accent);
  border: 2px solid transparent;
  color: var(--color-secondary);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all var(--trans-med);
  text-align: left;
}

.type-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--color-border-hover);
}

.type-btn.active {
  background-color: rgba(255, 74, 28, 0.1);
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

.type-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  fill: var(--color-text-muted);
  transition: fill var(--trans-med);
}

.type-btn.active .type-icon {
  fill: var(--color-primary);
}

/* Main Workspace: Dimensions & Outputs */
.calc-workspace {
  background-color: var(--color-bg-body);
  border-radius: 16px;
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}

.workspace-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: 16px 16px 0 0;
}

.selected-metal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-secondary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.selected-metal-gost {
  background-color: var(--color-accent);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 600;
  border: 1px solid var(--color-border);
}

.workspace-body {
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  flex-grow: 1;
}

/* Left Side: Parameters Form */
.calc-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.calc-select,
.calc-input {
  width: 100%;
  padding: 16px 20px;
  background-color: var(--color-accent);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-secondary);
  font-size: 1.1rem;
  font-family: var(--font-main);
  font-weight: 600;
  transition: all var(--trans-fast);
  appearance: none;
  outline: none;
}

.calc-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236b7178%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 20px top 50%;
  background-size: 12px auto;
}

.calc-select:focus,
.calc-input:focus {
  border-color: var(--color-primary);
  background-color: rgba(255, 74, 28, 0.05);
  box-shadow: var(--shadow-glow);
}

.calc-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Unit Input Group with Suffix */
.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit .calc-input {
  padding-right: 60px;
}

.unit-suffix {
  position: absolute;
  right: 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-muted);
  pointer-events: none;
}

/* Bi-directional conversion indicator */
.conversion-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 10px 0;
  position: relative;
}

.conversion-flow::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--color-border);
  z-index: 1;
}

.flow-icon {
  background-color: var(--color-bg-body);
  padding: 0 16px;
  color: var(--color-primary);
  position: relative;
  z-index: 2;
  font-size: 1.5rem;
}

/* Right Side: Results Panel */
.calc-results {
  background-color: var(--color-accent);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border: 1px solid var(--color-border);
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.2);
}

.result-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--color-border);
}

.result-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.result-label {
  font-size: 1rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.result-value-wrapper {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.result-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-unit {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-secondary);
}

/* Specifications small table inside results */
.specs-mini-table {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.spec-key {
  color: var(--color-text-muted);
}
.spec-val {
  font-weight: 700;
  color: var(--color-secondary);
}

/* Responsive Breakpoints for Calc */
@media (max-width: 1024px) {
  .calc-wrapper {
    grid-template-columns: 1fr;
  }
  .calc-sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
  }
  .calc-sidebar-title {
    grid-column: 1 / -1; /* Forces the title to take full width */
    margin-bottom: 4px;
  }
  .type-btn {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 16px 12px;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .calc-sidebar {
    grid-template-columns: repeat(
      2,
      1fr
    ); /* 2 columns strictly for mobile */
    padding: 16px;
    gap: 8px;
  }
  /* Makes the 5th button (Katanka) span both columns for perfect UI symmetry */
  .calc-sidebar > .type-btn:nth-child(even):last-child {
    grid-column: 1 / -1;
  }
  .type-btn {
    font-size: 0.9rem;
    padding: 12px 8px;
  }
  .type-icon {
    width: 32px;
    height: 32px;
  }
  .workspace-body {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 24px 16px;
  }
  .result-value {
    font-size: 2.25rem;
  }
}
