/* ═══════════════════════════════════════════════════════════════════════
   RCS Working-Test Admin – Responsive Stylesheet
   Breakpoints:
     Desktop      ≥ 992 px
     Tablet 11"   768 px – 991 px
     iPhone       < 768 px  (refined < 576 px)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Base ────────────────────────────────────────────────────────────── */
:root {
  --rcs-max-width: 1400px;
  --rcs-header-bg: #fff;
  --rcs-border: #dee2e6;
  --rcs-text-muted: #6c757d;
}

html, body {
  height: 100%;
}

body {
  background-color: #f5f6f8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 0.95rem;
}

/* ── Outer wrapper ───────────────────────────────────────────────────── */
.container-fluid {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.container-fluid .header {
  background-color: var(--rcs-header-bg);
  border-bottom: 1px solid var(--rcs-border);
  width: 100%;
  margin-bottom: 0;
  float: none;
}

/* The inner title container: logo left, title text right */
.header .container.title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  max-width: var(--rcs-max-width);
  width: 100%;
  margin: 0 auto;
  float: none;
}

.header .container.title .img-fluid.logo {
  width: auto;
  max-height: 56px;
  float: none;
  padding: 0;
}

/* h1.title inside the header div */
.container .title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #212529;
  text-align: right;
  padding: 0;
  width: auto;
  float: none;
  line-height: 1.2;
}

/* ── Navbar ──────────────────────────────────────────────────────────── */
.navbar.navbar-dark.bg-dark {
  padding: 0.4rem 1rem;
  background-color: #455a6e !important;
}

.navbar.navbar-dark.bg-dark .navbar-brand {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.navbar.navbar-dark.bg-dark .nav-item.active > .nav-link {
  color: #fff;
  font-weight: 500;
}

.navbar.navbar-dark.bg-dark .dropdown-menu {
  min-width: 210px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.navbar.navbar-dark.bg-dark .dropdown-item {
  font-size: 0.875rem;
  padding: 0.45rem 1.2rem;
}

.navbar.navbar-dark.bg-dark .dropdown-item.active,
.navbar.navbar-dark.bg-dark .dropdown-item:active {
  background-color: #378add;
  color: #fff;
}

.navbar.navbar-dark.bg-dark .dropdown-item i {
  margin-right: 6px;
  opacity: 0.7;
  font-size: 0.9em;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────── */
.admin-breadcrumb {
  margin-bottom: 1rem;
}

.admin-breadcrumb .breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 0.83rem;
}

.admin-breadcrumb .breadcrumb-item a {
  color: #555;
  text-decoration: none;
}

.admin-breadcrumb .breadcrumb-item a:hover {
  text-decoration: underline;
}

.admin-breadcrumb .breadcrumb-item.active {
  color: #333;
  font-weight: 500;
}

/* ── Content ─────────────────────────────────────────────────────────── */
.container-fluid .container.content {
  flex: 1 0 auto;
  max-width: var(--rcs-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

.container-fluid .container.content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.container-fluid .container.content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.container-fluid .container.content .btn.btn-lg {
  border-radius: 10px;
  border: 1px solid #000;
  margin: 4px;
  background-color: #ebebeb;
  font-size: 0.9rem;
  min-height: 44px;
  min-width: 210px;
  padding: 0.4rem 1rem;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.container-fluid .container.content .btn.btn-lg:hover {
  background-color: #d8d8d8;
}

.btn-section,
.button-section {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 1rem;
}

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-control {
  font-size: 0.9rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.25rem;
}

.form-inline label {
  font-size: 0.9rem;
}

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  font-size: 0.9rem;
}

/* ── Tables ──────────────────────────────────────────────────────────── */
.table-responsive {
  border-radius: 6px;
  border: 1px solid var(--rcs-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.table {
  font-size: 0.875rem;
  margin-bottom: 0;
}

table.table thead.thead-light th {
  background-color: #f1f3f5;
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.85rem;
  vertical-align: bottom;
  border-bottom: 2px solid var(--rcs-border);
}

table.table td {
  vertical-align: middle;
}

table.table td.td-actions {
  white-space: nowrap;
}

/* ── Zebra striping ──────────────────────────────────────────────────── */
table.table tbody tr:nth-child(odd) {
  background-color: #fafbfc;
}

table.table tbody tr:hover {
  background-color: #f0f4ff;
}

/* ── Card table (mobile): .table-card turns rows into cards < 576px ── */
@media (max-width: 575.98px) {
  .table-responsive:has(.table-card) {
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  table.table-card {
    border: none;
  }

  table.table-card thead {
    display: none;
  }

  table.table-card tbody tr {
    display: block;
    border: 1px solid var(--rcs-border);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  }

  table.table-card tbody tr:nth-child(odd) {
    background-color: #fff;
  }

  table.table-card tbody tr:hover {
    background-color: #f8f9ff;
  }

  table.table-card tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.25rem;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.875rem;
  }

  table.table-card tbody td:last-child {
    border-bottom: none;
  }

  table.table-card tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--rcs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 1rem;
  }

  table.table-card tbody td[data-label=""]::before,
  table.table-card tbody td.td-actions::before {
    display: none;
  }

  table.table-card tbody td.td-actions {
    justify-content: flex-end;
    padding-top: 0.5rem;
  }
}

/* ── Footer ──────────────────────────────────────────────────────────── */
.container-fluid .container.footer {
  flex-shrink: 0;
  width: 100%;
  max-width: var(--rcs-max-width);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--rcs-border);
  background: #fff;
  font-size: 0.83rem;
  color: var(--rcs-text-muted);
}

.container.content .alert.alert-primary.d-flex.align-items-center.infobox .infoboxtext {
  margin-left: 5px;
}

/* ═══════════════════════════════════════════════════════════════════════
   Tablet 11"  – 768 px to 991 px
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 991.98px) {
  .header .container.title .img-fluid.logo {
    max-height: 46px;
  }

  .container .title {
    font-size: 1.1rem;
  }

  .container-fluid .container.content {
    padding: 1.25rem 1rem 2rem;
  }

  .container-fluid .container.content .btn.btn-lg {
    min-width: 180px;
    font-size: 0.875rem;
  }

  table.table {
    font-size: 0.85rem;
  }

  /* Dropdown opens correctly on tablet without hover */
  .navbar.navbar-dark.bg-dark .dropdown-menu {
    position: absolute;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   Mobile  – below 768 px  (covers iPhone and small tablets)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
  .header .container.title {
    padding: 0.45rem 0.75rem;
  }

  .header .container.title .img-fluid.logo {
    max-height: 38px;
  }

  .container .title {
    font-size: 0.95rem;
  }

  .container-fluid .container.content {
    padding: 1rem 0.75rem 2rem;
  }

  .container-fluid .container.content h3 {
    font-size: 1.15rem;
  }

  .container-fluid .container.content h4 {
    font-size: 1rem;
  }

  /* Full-width buttons on mobile */
  .container-fluid .container.content .btn.btn-lg {
    min-width: 0;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .btn-section,
  .button-section {
    flex-direction: column;
    gap: 6px;
  }

  /* Forms */
  .form-row > .col,
  .form-row > [class*="col-"] {
    padding-left: 6px;
    padding-right: 6px;
  }

  .form-inline {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .form-inline .form-control {
    width: 100%;
  }

  /* Tables */
  table.table {
    font-size: 0.78rem;
  }

  table.table th,
  table.table td {
    padding: 0.35rem 0.45rem;
  }

  /* Small action buttons */
  .btn.btn-sm {
    font-size: 0.72rem;
    padding: 0.2rem 0.35rem;
  }

  /* Breadcrumb */
  .admin-breadcrumb .breadcrumb {
    font-size: 0.78rem;
  }

  /* Dropdown in collapsed nav: no box shadow */
  .navbar.navbar-dark.bg-dark .dropdown-menu {
    box-shadow: none;
    border: 0;
    background-color: rgba(255, 255, 255, 0.05);
    padding-left: 1rem;
  }

  .navbar.navbar-dark.bg-dark .dropdown-item {
    color: rgba(255, 255, 255, 0.75);
  }

  .navbar.navbar-dark.bg-dark .dropdown-item:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   iPhone refined  – below 576 px
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 575.98px) {
  .header .container.title .img-fluid.logo {
    max-height: 32px;
  }

  .container .title {
    font-size: 0.85rem;
  }

  .container-fluid .container.content {
    padding: 0.75rem 0.6rem 1.5rem;
  }

  table.table {
    font-size: 0.72rem;
  }

  table.table th,
  table.table td {
    padding: 0.3rem 0.35rem;
  }
}
