/* ── Result Alert Boxes ── */
.alert {
  padding: 1.25rem 1.5rem;
  border-radius: 1.25rem;
  font-size: 1rem;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.2);
  box-shadow: 0 4px 15px -1px rgba(34, 197, 94, 0.1);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.2);
  box-shadow: 0 4px 15px -1px rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .alert-success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .alert-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ── Form Controls ── */
.form-control {
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 1rem;
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

.form-select {
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 1rem;
  padding: 0.875rem 2.5rem 0.875rem 1.25rem;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23f59e0b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 1rem center;
  background-repeat: no-repeat;
  background-size: 1.25rem;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
  background: var(--bg-secondary);
}

/* ── Tool Page Buttons ── */
.btn-calc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border-radius: 1rem;
  font-size: 0.9375rem;
  font-weight: 700;
  font-family: "Poppins", sans-serif;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  border: none;
}

.btn-calc-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px -1px var(--accent-glow);
}

.btn-calc-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -1px var(--accent-glow);
}

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

.btn-calc-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ── Shape Tabs ── */
.shape-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding: 0.4rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  width: fit-content;
}

.shape-tab {
  padding: 0.625rem 1.25rem;
  border-radius: 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
}

.shape-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.4);
}

.shape-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-md);
  font-weight: 700;
}


/* ── Results Table ── */
.results-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.results-table th {
  background: var(--bg-card-hover);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  text-align: left;
}

.results-table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-top: 1px solid var(--border-color);
}

.results-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* ── Bootstrap Table Compat ──
   The JS uses Bootstrap table classes for the mean page */
.table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.table th {
  background: var(--bg-card-hover);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  text-align: left;
}

.table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-top: 1px solid var(--border-color);
}

.table tbody tr:hover {
  background: var(--bg-card-hover);
}


/* ── Input Group (mean page add-field) ── */
.input-group {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.input-group .form-floating {
  flex: 1;
}

.input-group .form-floating .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: none;
  border-radius: 0 0.625rem 0.625rem 0;
}

.input-group-text .btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* ── Grid Row (percentage / area pages) ── */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.col {
  flex: 1;
  min-width: 0;
}

.col-1 {
  flex: 0 0 auto;
  width: auto;
}

.col-3 {
  flex: 0 0 25%;
  max-width: 25%;
}

/* ── Percentage Page Specifics ── */
.uf {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.placeholder1 {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="17px" height="20px"><text x="1" y="15" style="font: normal 16px arial;" fill="%2394a3b8">%</text></svg>');
  background-position: right 12px center;
  background-repeat: no-repeat;
  padding-right: 28px !important;
}

/* ── Area-specific ── */
.calcs {
  display: none;
}

#rect_form {
  display: block;
}

.result {
  display: none;
}

/* ── Formula Text ── */
.formula-text {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* ── Responsive ── */
@media screen and (max-width: 640px) {
  .row {
    flex-direction: column;
  }

  .col-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .shape-tabs {
    justify-content: center;
  }
}
