/* Custom styles for API Platform */

/* RHCN logo in navbar (from www5.roeyatehilaal.nl) – 400×225 source */
.navbar-brand .navbar-logo {
  height: 44px;
  width: auto;
  max-width: 220px;
  display: block;
  object-fit: contain;
  vertical-align: middle;
}

.card-feature {
  border: 1px solid #e3e6f0;
  transition: all 0.3s;
}

.card-feature:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.card-feature i {
  margin-bottom: 10px;
}

/* Swagger UI container */
.swagger-container {
  min-height: 600px;
}

/* API Key display */
.api-key-display {
  font-family: 'Courier New', monospace;
  background: #f8f9fa;
  padding: 10px;
  border-radius: 4px;
  word-break: break-all;
}

/* Status badges */
.badge {
  padding: 0.25em 0.6em;
  font-size: 0.75em;
}

/* Loading spinner */
.spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3em;
}

/* Table improvements */
.table-responsive {
  border-radius: 0.25rem;
}

.table th {
  border-top: none;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

/* Modal improvements */
.modal-content {
  border: none;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
  border-bottom: 1px solid #e3e6f0;
}

.modal-footer {
  border-top: 1px solid #e3e6f0;
}

/* Button improvements */
.btn {
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

/* Alert improvements */
.alert {
  border: none;
  border-radius: 0.375rem;
}

/* Avatar initials */
.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

/* Stats cards */
.card-body h3 {
  font-size: 2rem;
  font-weight: 600;
}

/* ========== Responsive ========== */

/* Base: prevent horizontal overflow */
html, body {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Navbar: logo and right area on small screens */
@media (max-width: 991px) {
  .navbar-brand .navbar-logo {
    height: 38px;
    max-width: 180px;
  }
  .navbar-right .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }
  .navbar-right .mg-r-5 {
    margin-right: 0.35rem !important;
  }
}

@media (max-width: 576px) {
  .navbar-brand .navbar-logo {
    height: 34px;
    max-width: 160px;
  }
  .navbar-right .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* Content: safe padding on mobile */
.content-fixed .container {
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 576px) {
  .content-fixed .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

/* Page header: stack title and actions on small screens */
.d-sm-flex.align-items-center.justify-content-between {
  flex-wrap: wrap;
  gap: 1rem;
}
.d-sm-flex.align-items-center.justify-content-between > div:last-child {
  flex-basis: 100%;
}
@media (min-width: 576px) {
  .d-sm-flex.align-items-center.justify-content-between > div:last-child {
    flex-basis: auto;
  }
}

/* Dashboard/Usage: button and selects full width on mobile */
@media (max-width: 575px) {
  .d-sm-flex .btn,
  .d-sm-flex select.form-control-sm {
    width: 100% !important;
    display: block !important;
  }
  .d-sm-flex select.form-control-sm + select.form-control-sm,
  .d-sm-flex select + select {
    margin-left: 0 !important;
    margin-top: 0.5rem;
  }
}

/* Stats cards: consistent spacing on small screens */
.row-xs .card-body {
  padding: 1rem;
}
@media (max-width: 575px) {
  .row-xs .card-body h3 {
    font-size: 1.5rem;
  }
}

/* Tables: horizontal scroll and readable on mobile */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}
@media (max-width: 768px) {
  .table-responsive {
    font-size: 0.8125rem;
  }
  .table-responsive .table {
    min-width: 520px;
  }
  .table-responsive .btn-sm {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }
  .table-responsive .btn-sm i {
    width: 12px;
    height: 12px;
  }
}

/* Swagger UI: contain and scroll on small screens */
.swagger-container {
  min-height: 400px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.swagger-container .swagger-ui {
  max-width: 100%;
}
@media (max-width: 768px) {
  .swagger-container {
    min-height: 350px;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* Portal landing (index) */
.content-landing .row.ht-100p {
  min-height: 60vh;
  padding: 2rem 0;
}
.content-landing h1.tx-color-01 {
  font-size: 2rem;
}
@media (min-width: 768px) {
  .content-landing h1.tx-color-01 {
    font-size: 2.5rem;
  }
}

/* Auth pages: full width form and padding */
.content-auth .container {
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}
.content-auth .sign-wrapper {
  width: 100%;
  max-width: 100%;
  padding: 1.5rem 0;
}
@media (min-width: 992px) {
  .content-auth .sign-wrapper {
    padding: 2rem 0;
  }
}

/* Modals: full width on small screens */
@media (max-width: 575px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  .modal-body .form-control,
  .modal-body select {
    font-size: 16px; /* avoids zoom on focus on iOS */
  }
}

/* API key display: break long strings */
.api-key-display {
  overflow-x: auto;
  max-width: 100%;
}

/* Landing page (index) logo in card */
.card > a > img[alt="RHCN API"] {
  max-height: 72px;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

/* Cards: no overflow */
.card-body {
  overflow-x: hidden;
}

/* Settings: save button and status stack on small screens */
@media (max-width: 575px) {
  #saveAnonKeyBtn + #saveStatus {
    display: block;
    margin-left: 0 !important;
    margin-top: 0.5rem;
  }
  #adminOnly .form-control {
    font-size: 16px; /* avoid zoom on iOS */
  }
}

/* Responsive tweaks (existing) */
@media (max-width: 768px) {
  .card-feature {
    margin-bottom: 1rem;
  }
}
