html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 120px;
}

footer {
  position: absolute;
  bottom: 0;
  width: 100%;
}

/* Footer mobile spacing */
@media (max-width: 767.98px) {
  body {
    margin-bottom: 140px;
  }

  footer .row > div:first-child {
    margin-bottom: 0.75rem;
  }
}

.ts-wrapper.single .ts-control {
  overflow: hidden;
}

.ts-wrapper.single .ts-control > .item {
  max-width: calc(100% - 3rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Prevent CLS - Reserve space for 3D visualization */
#visualization-container {
    width: 100%;
    height: 400px;
    min-height: 400px;
    background-color: #f8f9fa;
}

@media (max-width: 768px) {
    #visualization-container {
        height: 300px;
        min-height: 300px;
    }
}

/* Touch-friendly button targets */
@media (hover: none) and (pointer: coarse) {
    .btn-group .btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Prevent iOS zoom on input focus */
@media (max-width: 767.98px) {
    input[type="number"],
    .form-control,
    .form-select {
        font-size: 16px;
    }
}

/* Privacy Policy and Terms of Service pages */
.privacy-policy,
.terms-of-service {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    line-height: 1.8;
}

.privacy-policy h1,
.terms-of-service h1 {
    margin-bottom: 0.5rem;
}

.privacy-policy h2,
.terms-of-service h2 {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--bs-border-color);
}

.privacy-policy h2:first-of-type,
.terms-of-service h2:first-of-type {
    margin-top: 1.5rem;
    padding-top: 0;
    border-top: none;
}

.privacy-policy h3,
.terms-of-service h3 {
    margin-top: 1.5rem;
}

.privacy-policy ul,
.terms-of-service ul {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.privacy-policy li,
.terms-of-service li {
    margin-bottom: 0.5rem;
    color: var(--bs-secondary-color);
}

.privacy-policy p,
.terms-of-service p {
    color: var(--bs-secondary-color);
    margin-bottom: 1rem;
}

.privacy-policy .last-updated,
.terms-of-service .last-updated {
    font-size: 0.875rem;
    color: var(--bs-tertiary-color);
    margin-bottom: 2rem;
}

.privacy-table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

.privacy-table th,
.privacy-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--bs-border-color);
}

.privacy-table th {
    font-weight: 600;
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
}

.privacy-resources {
    list-style: none;
    padding: 0;
}

.privacy-resources li {
    margin-bottom: 0.75rem;
}

/* RTL support for privacy and terms pages */
[dir="rtl"] .privacy-policy ul,
[dir="rtl"] .terms-of-service ul {
    padding-left: 0;
    padding-right: 1.5rem;
}

[dir="rtl"] .privacy-table th,
[dir="rtl"] .privacy-table td {
    text-align: right;
}