/* ═══════════════════════════════════════════════════════════════
   BiswasHost Client Portal — Design Enhancement v2.0
   Drop-in CSS override — paste into Blesta Theme > Custom CSS
   or save as custom-enhancements.css and link in structure.pdt
   ═══════════════════════════════════════════════════════════════ */

/* ── 0. CSS Variables (easy to tweak) ────────────────────────── */
:root {
  --bh-primary: #0d6efd;
  --bh-primary-soft: #e8f0fe;
  --bh-accent: #0a58ca;
  --bh-success: #198754;
  --bh-success-soft: #d1f5e0;
  --bh-danger: #dc3545;
  --bh-danger-soft: #fce4e6;
  --bh-warning: #ffc107;
  --bh-warning-soft: #fff8e1;
  --bh-text: #1e293b;
  --bh-text-muted: #64748b;
  --bh-bg: #f0f2f5;
  --bh-card-bg: #ffffff;
  --bh-border: #e2e8f0;
  --bh-radius: 10px;
  --bh-radius-sm: 6px;
  --bh-shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --bh-shadow: 0 4px 16px rgba(15, 23, 42, .07), 0 1px 3px rgba(15, 23, 42, .05);
  --bh-shadow-lg: 0 10px 40px rgba(15, 23, 42, .1), 0 2px 6px rgba(15, 23, 42, .04);
  --bh-transition: .2s cubic-bezier(.4, 0, .2, 1);
}

/* ── 1. Base Body & Typography ───────────────────────────────── */
body {
  background-color: var(--bh-bg) !important;
  color: var(--bh-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

/* ── 2. Main Content Area ────────────────────────────────────── */
.container-md {
  padding-top: 28px !important;
  padding-bottom: 20px !important;
}

.main {
  min-height: calc(100vh - 320px);
}

/* ── 3. Card System — Unified Elevated Cards ─────────────────── */
.card,
.card-blesta,
.panel-blesta {
  background: var(--bh-card-bg);
  border: 1px solid var(--bh-border);
  border-radius: var(--bh-radius) !important;
  box-shadow: var(--bh-shadow-sm);
  transition: box-shadow var(--bh-transition), transform var(--bh-transition);
  overflow: hidden;
}

.card:hover,
.card-blesta:hover {
  box-shadow: var(--bh-shadow);
}

.card-header,
.card-blesta > .card-header {
  font-weight: 600;
  font-size: .875rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bh-border);
  border-radius: var(--bh-radius) var(--bh-radius) 0 0 !important;
}

.card-body {
  padding: 18px;
}

.card-footer {
  padding: 12px 18px;
  background: #fafbfc;
  border-top: 1px solid var(--bh-border);
}

/* ── 4. Sidebar (My Info Panel) ──────────────────────────────── */
#my-info .card-blesta {
  margin-bottom: 16px;
}

#my-info address {
  font-size: .9rem;
  line-height: 1.7;
  color: var(--bh-text-muted);
  margin-bottom: 0;
}

#my-info address strong {
  color: var(--bh-text);
  font-size: .95rem;
}

#my-info address hr {
  margin: 10px 0;
  border-color: var(--bh-border);
}

#my-info address a {
  word-break: break-all;
}

/* Sidebar settings list */
.list-group.list-options .list-group-item {
  border: 1px solid var(--bh-border);
  border-radius: var(--bh-radius-sm) !important;
  margin-bottom: 8px;
  padding: 12px 14px;
  font-size: .875rem;
  transition: all var(--bh-transition);
}

.list-group.list-options .list-group-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--bh-shadow-sm);
}

/* Currency amounts card */
.list-group.list-options .credits {
  background: var(--bh-primary-soft) !important;
  border-color: rgba(13, 110, 253, .15) !important;
  font-weight: 500;
}

.list-group.list-options .credits .currency_value {
  font-weight: 700;
  font-size: 1.05em;
}

/* ── 5. Dashboard Stat Cards ─────────────────────────────────── */
.right_content .cards .card {
  border-radius: var(--bh-radius) !important;
  border: none;
  box-shadow: var(--bh-shadow);
  transition: all .25s ease;
  overflow: hidden;
  position: relative;
}

.right_content .cards .card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--bh-primary), var(--bh-accent));
  opacity: 0;
  transition: opacity var(--bh-transition);
}

.right_content .cards .card:hover {
  transform: translateY(-3px);
  box-shadow: var(--bh-shadow-lg);
}

.right_content .cards .card:hover::after {
  opacity: 1;
}

.right_content .cards .card .card-content {
  padding: 20px;
}

.right_content .cards .card .card-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.right_content .cards .card .card-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .75;
  margin-top: 4px;
  font-weight: 500;
}

/* ── 6. Tables — Clean & Readable ────────────────────────────── */
.table {
  font-size: .9rem;
}

.table thead th {
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bh-text-muted);
  border-bottom: 2px solid var(--bh-border);
  padding: 12px 14px;
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--bh-border);
  color: var(--bh-text);
}

.table-striped-alt tbody tr:nth-child(4n+1),
.table-striped-alt tbody tr:nth-child(4n+2) {
  background-color: transparent;
}

.table-striped-alt tbody tr:nth-child(4n+3),
.table-striped-alt tbody tr:nth-child(4n+4) {
  background-color: #f8fafc;
}

.table-hover tbody tr:hover td {
  background-color: var(--bh-primary-soft) !important;
}

/* Expandable row indicator */
.table tr.expand {
  cursor: pointer;
}

.table tr.expand:hover td:first-child {
  position: relative;
}

.table tr.expand:hover td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--bh-primary);
  border-radius: 0 2px 2px 0;
}

/* ── 7. Buttons — Refined & Consistent ───────────────────────── */
.btn {
  font-weight: 500;
  font-size: .875rem;
  border-radius: var(--bh-radius-sm) !important;
  transition: all var(--bh-transition);
  letter-spacing: .01em;
  line-height: 1.5;
}

.btn:active {
  transform: scale(.97);
}

.btn-light {
  border: 1px solid var(--bh-border) !important;
}

.btn-light:hover {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

.btn-xs {
  padding: 5px 12px !important;
  font-size: .8rem;
}

.btn-sm {
  padding: 6px 14px !important;
}

.btn-block {
  border-radius: var(--bh-radius-sm) !important;
}

/* Service manage action buttons */
.service-info + div .btn-med,
.btn-med {
  padding: 10px 16px !important;
  font-size: .85rem;
  border-radius: var(--bh-radius-sm) !important;
}

/* ── 8. Widget Headers (WidgetClient) ────────────────────────── */
.content_section .widget_header,
.widget_content_section > div:first-child {
  border-radius: var(--bh-radius) var(--bh-radius) 0 0;
}

/* Widget tabs */
.nav-link {
  font-size: .875rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--bh-radius-sm) var(--bh-radius-sm) 0 0 !important;
  transition: all var(--bh-transition);
}

/* ── 9. Alerts — Soft & Readable ─────────────────────────────── */
.alert {
  border-radius: var(--bh-radius-sm);
  border-left-width: 4px;
  font-size: .9rem;
  padding: 14px 18px;
}

.alert-success {
  background-color: var(--bh-success-soft) !important;
  border-color: var(--bh-success) !important;
  color: #065f46 !important;
}

.alert-danger {
  background-color: var(--bh-danger-soft) !important;
  border-color: var(--bh-danger) !important;
  color: #991b1b !important;
}

.alert-warning {
  background-color: var(--bh-warning-soft) !important;
  border-color: var(--bh-warning) !important;
  color: #92400e !important;
}

.alert-info {
  background-color: var(--bh-primary-soft) !important;
  border-color: var(--bh-primary) !important;
  color: #1e40af !important;
}

/* ── 10. Forms — Polished Inputs ─────────────────────────────── */
.form-control {
  border: 1.5px solid var(--bh-border);
  border-radius: var(--bh-radius-sm) !important;
  padding: 8px 14px;
  font-size: .9rem !important;
  transition: border-color var(--bh-transition), box-shadow var(--bh-transition);
  color: var(--bh-text) !important;
  background-color: #fff;
}

.form-control:focus {
  border-color: var(--bh-primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
  outline: none;
}

.form-control::placeholder {
  color: #94a3b8;
}

label {
  font-weight: 500;
  font-size: .875rem !important;
  color: var(--bh-text-muted);
  margin-bottom: 4px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 34px;
}

/* ── 11. Badges — Status Indicators ──────────────────────────── */
.badge {
  font-weight: 600;
  font-size: .75rem;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: .03em;
}

.badge-success {
  background-color: var(--bh-success-soft) !important;
  color: #065f46 !important;
}

.badge-danger {
  background-color: var(--bh-danger-soft) !important;
  color: #991b1b !important;
}

.badge-warning {
  background-color: var(--bh-warning-soft) !important;
  color: #92400e !important;
}

.badge-info {
  background-color: var(--bh-primary-soft) !important;
  color: #1e40af !important;
}

/* ── 12. Invoice View — Professional Layout ──────────────────── */
.col-md-12 .card h4 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--bh-text-muted);
  margin-bottom: 8px;
}

/* ── 13. Service Info Box — Cleaner Grid ─────────────────────── */
.panel-pad {
  padding: 20px;
}

.panel-pad .service-info label {
  font-size: .75rem !important;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--bh-text-muted);
  margin-bottom: 2px;
  display: block;
}

.panel-pad .service-info h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bh-text);
  margin-bottom: 14px;
  margin-top: 0;
}

.col-border {
  border-right: 1px solid var(--bh-border);
}

/* ── 14. Left Sidebar Navigation ─────────────────────────────── */
.col-md-3 .list-group .list-group-item-action {
  border-radius: 0;
  border-left: 3px solid transparent;
  font-size: .875rem;
  font-weight: 500;
  padding: 10px 16px;
  color: var(--bh-text-muted);
  transition: all var(--bh-transition);
}

.col-md-3 .list-group .list-group-item-action:hover {
  background-color: var(--bh-primary-soft) !important;
  color: var(--bh-primary);
  border-left-color: var(--bh-primary);
}

.col-md-3 .list-group .list-group-item-action.active {
  background-color: var(--bh-primary-soft) !important;
  color: var(--bh-primary) !important;
  border-left-color: var(--bh-primary) !important;
  font-weight: 600;
}

.col-md-3 .list-group .list-group-item-action i {
  width: 20px;
  text-align: center;
  margin-right: 6px;
}

/* ── 15. Secondary Content Area ──────────────────────────────── */
.col-md-3 {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* ── 16. Dropdown Menus ──────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--bh-border);
  border-radius: var(--bh-radius-sm);
  box-shadow: var(--bh-shadow-lg);
  padding: 6px;
  animation: dropdownFadeIn .15s ease;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item,
.dropdown-menu a,
.dropdown-menu li a {
  border-radius: var(--bh-radius-sm);
  padding: 8px 12px;
  font-size: .875rem;
  color: var(--bh-text);
  transition: background var(--bh-transition);
}

.dropdown-item:hover,
.dropdown-menu a:hover,
.dropdown-menu li a:hover {
  background-color: var(--bh-primary-soft);
  color: var(--bh-primary) !important;
}

/* ── 17. Pagination ──────────────────────────────────────────── */
.pagination {
  gap: 4px;
}

.pagination .page-link {
  border-radius: var(--bh-radius-sm) !important;
  border: 1px solid var(--bh-border);
  font-size: .85rem;
  font-weight: 500;
  padding: 6px 12px;
  min-width: 36px;
  text-align: center;
  transition: all var(--bh-transition);
}

.pagination .page-item.active .page-link {
  box-shadow: 0 2px 6px rgba(13, 110, 253, .25);
}

/* ── 18. Modal Improvements ──────────────────────────────────── */
.modal-content {
  border: none;
  border-radius: var(--bh-radius) !important;
  box-shadow: var(--bh-shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--bh-border);
  padding: 16px 20px;
}

.modal-header h5,
.modal-header .global_modal_title {
  font-weight: 600;
  font-size: 1.05rem;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  border-top: 1px solid var(--bh-border);
  padding: 12px 20px;
}

/* ── 19. Tooltip Override ────────────────────────────────────── */
.tooltip-inner {
  font-size: .8rem;
  padding: 6px 10px;
  border-radius: var(--bh-radius-sm);
  max-width: 260px;
}

/* ── 20. Empty State — Friendly ──────────────────────────────── */
.alert-info p:only-child {
  margin-bottom: 0;
}

/* ── 21. Scroll-to-Top Button ────────────────────────────────── */
.scroll-top {
  border-radius: 50% !important;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--bh-shadow);
  transition: all .25s ease;
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: var(--bh-shadow-lg);
}

/* ── 22. Login Page Enhancements ─────────────────────────────── */
.row.login .panel-blesta {
  box-shadow: var(--bh-shadow-lg);
  border-radius: var(--bh-radius) !important;
  border: none;
}

.row.login .panel-blesta .form-control {
  padding: 10px 14px;
}

.row.login .panel-blesta .btn-success {
  padding: 10px 20px !important;
  font-size: .95rem;
  font-weight: 600;
}

/* ── 23. Print Styles (Invoice PDF) ──────────────────────────── */
@media print {
  .main-header-menu-wrap,
  #header-top-bar,
  .scroll-top,
  footer,
  .footer-bottom {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  .card, .card-blesta {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* ── 24. Responsive Tweaks ───────────────────────────────────── */
@media (max-width: 767.98px) {
  .container-md {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .table thead th {
    font-size: .73rem;
    padding: 8px 10px;
  }

  .table tbody td {
    padding: 10px;
    font-size: .85rem;
  }

  .right_content .cards .card .card-value {
    font-size: 1.4rem;
  }

  .btn-xs {
    padding: 4px 8px !important;
    font-size: .75rem;
  }

  .col-border {
    border-right: none;
    border-bottom: 1px solid var(--bh-border);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
}

/* ── 25. Subtle Entry Animation ──────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .card,
  .card-blesta,
  .right_content .cards > div {
    animation: fadeUp .35s ease both;
  }

  .right_content .cards > div:nth-child(1) { animation-delay: .05s; }
  .right_content .cards > div:nth-child(2) { animation-delay: .1s; }
  .right_content .cards > div:nth-child(3) { animation-delay: .15s; }
  .right_content .cards > div:nth-child(4) { animation-delay: .2s; }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
