/* ========== RESPONSIVE TYPOGRAPHY ========== */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 576px) {
  html {
    font-size: 15px;
  }
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

@media (min-width: 992px) {
  html {
    font-size: 17px;
  }
}

/* ========== BODY & LAYOUT ========== */
body {
  margin-bottom: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== FOCUS STATES ========== */
.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;
}

/* ========== CONTAINER SIZING ========== */
.container,
.container-sm,
.container-md,
.container-lg,
.container-xl,
.container-xxl,
.container-fluid {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

@media (min-width: 576px) {
  .container,
  .container-sm,
  .container-md,
  .container-lg,
  .container-xl,
  .container-xxl,
  .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ========== BUTTON OPTIMIZATIONS ========== */
.btn {
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-size: 0.95rem;
}

@media (max-width: 575px) {
  .btn {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem !important;
  }
  
  .btn-sm {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.85rem;
  }

  .btn-lg {
    padding: 0.6rem 1rem !important;
    font-size: 0.95rem;
  }
}

/* ========== FORM ELEMENTS ========== */
.form-control,
.form-select,
textarea {
  border-radius: 12px !important;
  border: 1px solid #E0E4E9 !important;
  padding: 0.7rem 1rem !important;
  font-size: 1rem;
  transition: all 0.3s ease;
}

@media (max-width: 575px) {
  .form-control,
  .form-select,
  textarea {
    padding: 0.6rem 0.9rem !important;
    font-size: 0.95rem;
  }
}

.form-control:focus,
.form-select:focus {
  border-color: #3B7197 !important;
  box-shadow: 0 0 0 0.2rem rgba(59, 113, 151, 0.15) !important;
}

/* ========== INPUT GROUP ========== */
.input-group {
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .input-group {
    gap: 0;
  }
}

/* ========== TABLES RESPONSIVENESS ========== */
.table {
  font-size: 0.95rem;
  margin-bottom: 0;
}

@media (max-width: 575px) {
  .table {
    font-size: 0.85rem;
  }

  .table thead {
    font-size: 0.75rem;
  }

  .table td {
    padding: 0.5rem 0.25rem !important;
  }

  /* Stack columns vertically on very small screens */
  .table.table-responsive {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table thead {
    display: none;
  }

  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    margin-bottom: 15px;
    border: 1px solid #E0E4E9;
    border-radius: 8px;
    overflow: hidden;
  }

  .table td {
    text-align: right;
    padding-left: 50% !important;
    position: relative;
  }

  .table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 50%;
    padding-right: 10px;
    text-align: left;
    font-weight: 600;
    color: #555;
  }
}

/* ========== BADGE & PILLS ========== */
.badge {
  border-radius: 12px !important;
  padding: 0.4rem 0.8rem !important;
  font-size: 0.8rem;
  white-space: nowrap;
}

@media (min-width: 576px) {
  .badge {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem;
  }
}

/* ========== CARDS ========== */
.card {
  border: none !important;
  border-radius: 16px !important;
  overflow: hidden;
  transition: all 0.3s ease;
}

@media (max-width: 575px) {
  .card {
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
  }
}

/* ========== MOBILE SPECIFIC FIXES ========== */
@media (max-width: 575px) {
  /* Remove aggressive transforms on small screens */
  .card:hover,
  .product-card:hover,
  .nav-link:hover {
    transform: none !important;
  }

  /* Reduce animation intensity */
  .card,
  .btn,
  .nav-link,
  .form-control {
    animation: none !important;
  }

  /* Better touch targets */
  .btn-sm,
  a.btn,
  button {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Readable spacing */
  .row {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
  }

  /* Better padding for readability */
  .pt-3, .py-3 {
    padding-top: 0.75rem !important;
  }

  .pb-3, .py-3 {
    padding-bottom: 0.75rem !important;
  }

  .px-3 {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  /* Hide unnecessary elements on mobile */
  .d-none.d-lg-block {
    display: none !important;
  }
}

/* ========== TEXT TRUNCATION ========== */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

/* ========== PRINT STYLES ========== */
@media print {
  body {
    background-color: white;
  }

  .navbar,
  footer,
  .btn,
  .dropdown-menu {
    display: none !important;
  }
}