/* Engineering Tools (/tools/) - Shared stylesheet for EN/ES/AR/FR/DE */
/* VISUAL REFINEMENT: Approved desktop layout, increased typography, removed icons */

:root {
  color-scheme: dark;
  --cyan: #18d7ff;
  --teal: #31e6c0;
  --green: #49d46f;
  --gold: #ffc15a;
  --blue: #3f93ff;
  --bg: #061622;
  --panel: #0a2030;
  --panel2: #0d2638;
  --text: #e9f4fa;
  --muted: #9fb6c5;
  --line: rgba(24, 215, 255, 0.2);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font: inherit;
}

header {
  height: 50px;
  background: rgba(5, 18, 29, 0.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

/* RTL support for Arabic */
[dir="rtl"] header {
  flex-direction: row-reverse;
}

.header-left {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon canvas {
  width: 38px;
  height: 38px;
  display: block;
}

.brand-text span {
  color: var(--cyan);
}

.brand-sep {
  color: #3a5a70;
  margin: 0 8px;
}

.home-link {
  font-size: 13px;
  color: #7fa0ae;
  font-weight: 500;
}

.lang-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

[dir="rtl"] .lang-selector {
  flex-direction: row-reverse;
}

.lang-btn {
  background: transparent;
  border: 1px solid #2f6683;
  border-radius: 6px;
  padding: 6px 12px;
  color: #dcebf2;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.lang-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.lang-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(10, 32, 48, 0.98);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 140px;
  z-index: 100;
  margin-top: 4px;
}

[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

.lang-menu.active {
  display: block;
}

.lang-menu a {
  display: block;
  padding: 8px 14px;
  font-size: 12px;
  color: #dcebf2;
  text-align: left;
}

[dir="rtl"] .lang-menu a {
  text-align: right;
}

.lang-menu a:hover {
  background: rgba(24, 215, 255, 0.1);
  color: var(--cyan);
}

.lang-menu a.active {
  background: #0d7fc5;
  color: white;
}

.hero {
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(6, 22, 34, 0.98), rgba(6, 22, 34, 0.78));
}

.hero-inner {
  max-width: 1880px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 31px;
  line-height: 1;
  margin: 0 0 6px;
  letter-spacing: -1px;
  font-weight: 700;
}

.hero h1 b {
  color: var(--cyan);
}

.hero p {
  font-size: 13.5px;
  color: #d8e8f0;
  margin: 0 0 12px;
  line-height: 1.4;
}

.hero-search {
  width: min(420px, 100%);
  height: 38px;
  background: #102a3d;
  border: 1px solid #2f6683;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  margin-bottom: 12px;
  font-size: 13.5px;
}

.hero-search input {
  background: transparent;
  border: 0;
  outline: 0;
  color: white;
  flex: 1;
  font-size: 13.5px;
}

.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid #2f6683;
  border-radius: 16px;
  background: transparent;
  color: #a8bcc8;
  padding: 7px 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.pill.active,
.pill:hover {
  background: #0d7fc5;
  border-color: var(--cyan);
  color: white;
}

.layout {
  max-width: 1880px;
  margin: 0 auto;
  padding: 16px 38px;
}

.content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  grid-auto-flow: initial;
}

.content > .tool-section:nth-child(1) {
  grid-row: 1 / 3;
  grid-column: 1;
}

.content > .tool-section:nth-child(3) {
  grid-row: 1;
  grid-column: 2;
}

.content > .tool-section:nth-child(2) {
  grid-row: 2;
  grid-column: 2;
}

.content > .tool-section:nth-child(4) {
  grid-row: 3;
  grid-column: 1 / -1;
}

.tool-section {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

[dir="rtl"] .section-title {
  flex-direction: row-reverse;
}

.section-title i {
  display: none;
}

.section-title h2 {
  font-size: 22px;
  margin: 0;
  font-weight: 600;
  color: white;
  letter-spacing: -0.5px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  grid-auto-flow: initial;
}

.tool-grid.single {
  grid-template-columns: 1fr;
}

.tool-section:nth-child(4) .tool-grid {
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
}

.converter-column {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.converter-source-header {
  font-size: 12px;
  font-weight: 600;
  color: #7fa0ae;
  padding: 8px 0 6px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(24, 215, 255, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.converter-column .tool-card {
  padding: 10px 0;
  gap: 4px;
}

.converter-column .tool-card h3 {
  font-size: 20px;
}

.converter-column .tool-card p {
  display: none;
}

.tool-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(24, 215, 255, 0.08);
}

.tool-card:last-child {
  border-bottom: none;
}

.tool-card:hover {
  background: rgba(24, 215, 255, 0.04);
}

.tool-card:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

[dir="rtl"] .tool-header {
  flex-direction: row-reverse;
}

.tool-icon {
  display: none;
}

.tool-content {
  flex: 1;
  min-width: 0;
}

.tool-card h3 {
  font-size: 20px;
  margin: 0;
  font-weight: 600;
  color: white;
  line-height: 1.25;
}

.tool-card p {
  display: none;
}

.tool-chevron {
  color: #7a9aaa;
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 0;
  font-weight: 300;
  transition: color 0.15s;
}

.tool-card:hover .tool-chevron {
  color: var(--cyan);
}

[dir="rtl"] .tool-chevron {
  transform: scaleX(-1);
}

.view-all {
  display: none;
}

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

  .content > .tool-section:nth-child(1) {
    grid-row: 1 / 3;
    grid-column: 1;
  }

  .content > .tool-section:nth-child(3) {
    grid-row: 1;
    grid-column: 2;
  }

  .content > .tool-section:nth-child(2) {
    grid-row: 2;
    grid-column: 2;
  }

  .content > .tool-section:nth-child(4) {
    grid-row: 3;
    grid-column: 1 / -1;
  }

  .tool-section:nth-child(4) .tool-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .layout {
    padding: 14px 28px;
  }

  .content {
    grid-template-columns: 1fr;
  }

  .content > .tool-section:nth-child(1) {
    grid-row: auto;
    grid-column: auto;
  }

  .content > .tool-section:nth-child(3) {
    grid-row: auto;
    grid-column: auto;
  }

  .content > .tool-section:nth-child(2) {
    grid-row: auto;
    grid-column: auto;
  }

  .content > .tool-section:nth-child(4) {
    grid-row: auto;
    grid-column: auto;
  }

  .tool-section:nth-child(4) .tool-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero {
    padding: 14px 18px 10px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero p {
    font-size: 13px;
  }

  .hero-search {
    width: 100%;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-section:nth-child(4) .tool-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  header {
    padding: 0 16px;
  }

  .hero {
    padding: 12px 16px 8px;
  }

  .layout {
    padding: 12px 16px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero h1 b {
    display: block;
  }

  .pills {
    gap: 4px;
  }

  .pill {
    padding: 6px 12px;
    font-size: 12px;
  }

  .tool-section {
    padding: 14px;
  }

  .section-title h2 {
    font-size: 17.5px;
  }

  .tool-card h3 {
    font-size: 13.5px;
  }
}
