/**
 * Chromolab Insurance - Custom Admin Design
 * Built from scratch - FontAwesome, jQuery, DataTables
 */
:root {
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --success: #198754;
  --danger: #dc3545;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --body-bg: #f8fafc;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--body-bg); margin: 0; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
.app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
}
.app-main { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; min-width: 0; }
.app-topbar { padding-top: 0.35rem; padding-bottom: 0.35rem; z-index: 1030; }
.app-topbar-brand-wrap { min-width: 0; }
.app-topbar .navbar-brand { padding-top: 0; padding-bottom: 0; }
.app-brand-img { height: 36px; width: auto; max-width: min(200px, 42vw); object-fit: contain; }
@media (max-width: 576px) {
  .app-brand-img { height: 30px; }
}
.app-nav-dropdown .dropdown-toggle::after { margin-left: 0.35em; }
.app-nav-dropdown-menu { min-width: 220px; }
.app-nav-dropdown-menu .dropdown-item { padding: 0.5rem 1rem; display: flex; align-items: center; }
.app-nav-dropdown-menu .dropdown-item.active { background: #eff6ff; color: var(--primary); font-weight: 600; }
.app-nav-dropdown-menu .dropdown-item:not(.active):hover { background: #f8fafc; }
.app-content { flex: 1; padding: 1.5rem; min-width: 0; }
@media (max-width: 768px) {
  .app-content {
    padding: 1rem 0.75rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }
}
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);}
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid #eee; font-weight: 600; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.card-body { padding: 1.25rem; }
@media (max-width: 576px) {
  .card-body { padding: 1rem; }
  .card-header { padding: 0.85rem 1rem; }
}
.btn { padding: 0.5rem 1rem; border-radius: 6px; font-weight: 500; display: inline-flex; align-items: center; gap: 0.5rem; }
.btn-primary { background: var(--primary); border: none; color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline-primary { border: 1px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); border: none; color: #fff; }
.btn-danger:hover { background: #bb2d3b; color: #fff; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.875rem; }
.form-label { font-weight: 500; margin-bottom: 0.35rem; }
.form-control { border-radius: 6px; border: 1px solid #dee2e6; padding: 0.5rem 0.75rem; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,110,253,0.15); }
.input-group-text { border-radius: 6px; background: #f8f9fa; border: 1px solid #dee2e6; }
.input-group .form-control { border-left: 0; }
.input-group .input-group-text + .form-control { border-left: 1px solid #dee2e6; }
.input-group .form-control:focus { border-left-color: var(--primary); }
.table { margin-bottom: 0; }
.table th { font-weight: 600; color: #334155; }
.table td { vertical-align: middle; }
.badge { padding: 0.35em 0.65em; font-weight: 500; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.alert { border-radius: 6px; }
.actions-cell .btn { padding: 0.25rem 0.5rem; }

/* DataTables: stack controls on small screens */
@media (max-width: 576px) {
  .dataTables_wrapper .row { margin-left: 0; margin-right: 0; }
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    float: none !important;
    text-align: left !important;
    margin-bottom: 0.65rem;
  }
  .dataTables_wrapper .dataTables_filter label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    width: 100%;
  }
  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    margin-left: 0 !important;
  }
  .dataTables_wrapper .dataTables_info {
    padding-top: 0.5rem;
  }
  .dataTables_wrapper .dataTables_paginate {
    margin-top: 0.5rem;
    text-align: center;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .dataTables_wrapper .dataTables_paginate .pagination {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 0.35rem;
    margin-bottom: 0;
  }
  .dataTables_wrapper .dataTables_paginate .paginate_button,
  .dataTables_wrapper .dataTables_paginate .page-link {
    padding: 0.25rem 0.5rem !important;
    margin: 0 !important;
  }
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* Flatpickr above sidebar / cards */
.flatpickr-calendar {
  z-index: 1100;
}
