/* ==========================================================================
   theme.css — dark mode ONLY. Loaded after styles.css (which is unchanged).
   Nothing here applies in light mode, so the light look is exactly as before.
   Dark is switched by <html data-bs-theme="dark"> (js/scripts.js + includes/theme_head.php)
   Written for Bootstrap 5.2.3 (no native dark mode), so components are overridden explicitly.
   ========================================================================== */

/* ---- Theme toggle button (both themes) ---- */
#themeToggle { border: 1px solid rgba(128,128,128,.35); margin-right: .5rem; }

/* Bootstrap 5.3 class used by the new pages (not in 5.2.3) */
.text-body-secondary { color: #6c757d !important; }

/* ---- Small helpers used by the new Clients / Payment Methods / form pieces ---- */
.payment-preview { white-space: pre-wrap; font-size: .85rem; padding: .6rem .75rem; border-radius: .375rem;
  background: rgba(128,128,128,.08); border: 1px dashed rgba(128,128,128,.4); color: #6c757d; }
.method-details { white-space: pre-wrap; font-size: .85rem; color: #6c757d; margin: 0; font-family: inherit; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ==========================================================================
   DARK
   ========================================================================== */
[data-bs-theme="dark"] {
  color-scheme: dark;
  --bs-body-color: #d7dce2;
  --bs-body-color-rgb: 215, 220, 226;
  --bs-body-bg: #171b22;
  --bs-body-bg-rgb: 23, 27, 34;
  --bs-border-color: #2c333d;
  --bs-border-color-translucent: rgba(255, 255, 255, .1);
  --bs-secondary-color: #9aa3ae;
  --bs-link-color: #6ea8fe;
  --bs-link-hover-color: #8bb9fe;
}
[data-bs-theme="dark"] body { background-color: #171b22; color: #d7dce2; }
[data-bs-theme="dark"] #wrapper { background-color: #0f1319; }
[data-bs-theme="dark"] a:not(.btn):not(.list-group-item):not(.dropdown-item):not(.page-link):not(.nav-link) { color: #6ea8fe; }
[data-bs-theme="dark"] hr { color: #fff; opacity: .15; }
[data-bs-theme="dark"] .text-muted, [data-bs-theme="dark"] .form-text { color: #9aa3ae !important; }
[data-bs-theme="dark"] .text-body-secondary { color: #9aa3ae !important; }
[data-bs-theme="dark"] .border, [data-bs-theme="dark"] .border-end, [data-bs-theme="dark"] .border-bottom { border-color: #2c333d !important; }
[data-bs-theme="dark"] .bg-white { background-color: #171b22 !important; }
[data-bs-theme="dark"] .bg-light { background-color: #1e232b !important; color: #d7dce2; }

/* Sidebar + top navbar */
[data-bs-theme="dark"] #sidebar-wrapper .list-group-item-light,
[data-bs-theme="dark"] #sidebar-wrapper .list-group-item {
  background-color: #171b22; color: #d7dce2; border-color: #2c333d;
}
[data-bs-theme="dark"] #sidebar-wrapper .list-group-item-action:hover,
[data-bs-theme="dark"] #sidebar-wrapper .list-group-item-action:focus { background-color: #232a33; color: #fff; }
[data-bs-theme="dark"] .navbar-light .navbar-nav .nav-link,
[data-bs-theme="dark"] .navbar-light .navbar-brand { color: #d7dce2; }
[data-bs-theme="dark"] .navbar-light .navbar-toggler { border-color: rgba(255,255,255,.2); }
[data-bs-theme="dark"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: #b5bcc6; --bs-btn-border-color: #4a525d; --bs-btn-hover-bg: #3a414b; --bs-btn-hover-border-color: #4a525d; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #3a414b; }
[data-bs-theme="dark"] #themeToggle { color: #d7dce2; }

/* Cards, modals, dropdowns, list groups */
[data-bs-theme="dark"] .card { --bs-card-bg: #171b22; --bs-card-cap-bg: rgba(255,255,255,.04); --bs-card-border-color: #2c333d; --bs-card-color: #d7dce2; color: #d7dce2; }
[data-bs-theme="dark"] .card-header, [data-bs-theme="dark"] .card-footer { border-color: #2c333d; }
[data-bs-theme="dark"] .modal-content { background-color: #171b22; color: #d7dce2; border-color: #2c333d; }
[data-bs-theme="dark"] .modal-header, [data-bs-theme="dark"] .modal-footer { border-color: #2c333d; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-bs-theme="dark"] .dropdown-menu { --bs-dropdown-bg: #1e232b; --bs-dropdown-color: #d7dce2; --bs-dropdown-link-color: #d7dce2;
  --bs-dropdown-link-hover-bg: #2a313b; --bs-dropdown-link-hover-color: #fff; --bs-dropdown-border-color: #2c333d; --bs-dropdown-divider-bg: #2c333d; }
[data-bs-theme="dark"] .list-group { --bs-list-group-bg: #171b22; --bs-list-group-color: #d7dce2; --bs-list-group-border-color: #2c333d; }

/* Tables */
[data-bs-theme="dark"] .table { --bs-table-color: #d7dce2; --bs-table-border-color: #2c333d; --bs-table-striped-bg: rgba(255,255,255,.04);
  --bs-table-hover-bg: rgba(255,255,255,.05); --bs-table-hover-color: #fff; color: #d7dce2; }
[data-bs-theme="dark"] .table-light, [data-bs-theme="dark"] .table > thead.table-light > tr > * { --bs-table-bg: #232a33; --bs-table-color: #d7dce2; color: #d7dce2; }

/* Forms */
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select {
  background-color: #11151b; color: #d7dce2; border-color: #303844;
}
[data-bs-theme="dark"] .form-select {
  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='%23d7dce2' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
[data-bs-theme="dark"] .form-control::placeholder { color: #6b7480; }
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus { background-color: #11151b; color: #fff; border-color: #6ea8fe; box-shadow: 0 0 0 .2rem rgba(110,168,254,.2); }
[data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-control[readonly], [data-bs-theme="dark"] .form-select:disabled { background-color: #1a1f27; color: #9aa3ae; }
[data-bs-theme="dark"] .form-check-input { background-color: #11151b; border-color: #4a525d; }
[data-bs-theme="dark"] .form-check-input:checked { background-color: #0d6efd; border-color: #0d6efd; }
[data-bs-theme="dark"] .input-group-text { background-color: #232a33; color: #d7dce2; border-color: #303844; }
[data-bs-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.8); }

/* Pagination */
[data-bs-theme="dark"] .page-link { background-color: #171b22; border-color: #2c333d; color: #6ea8fe; }
[data-bs-theme="dark"] .page-link:hover { background-color: #232a33; }
[data-bs-theme="dark"] .page-item.active .page-link { background-color: #0d6efd; border-color: #0d6efd; color: #fff; }

/* Alerts */
[data-bs-theme="dark"] .alert-success { background-color: #12301f; border-color: #1d4d31; color: #8fd6a8; }
[data-bs-theme="dark"] .alert-danger  { background-color: #351619; border-color: #5a2226; color: #f0a5ab; }
[data-bs-theme="dark"] .alert-warning { background-color: #352b0e; border-color: #574714; color: #f0d27a; }
[data-bs-theme="dark"] .alert-info    { background-color: #0f2a35; border-color: #184557; color: #8fd0e6; }

/* ---- The invoice / quotation sheet: paper stays exactly as designed, in both themes ---- */
[data-bs-theme="dark"] .invoice-box {
  --bs-body-color: #212529; --bs-body-bg: #fff; --bs-border-color: #dee2e6;
  --bs-secondary-color: #6c757d; --bs-link-color: #0d6efd;
  background: #fff; color: #222;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 8px 30px rgba(0,0,0,.5);
}
[data-bs-theme="dark"] .invoice-box .table { --bs-table-color: #212529; --bs-table-border-color: #dee2e6; color: #212529; }
[data-bs-theme="dark"] .invoice-box .text-muted { color: #6c757d !important; }
[data-bs-theme="dark"] .invoice-box hr { color: inherit; opacity: .25; }

@media print {
  #sidebar-wrapper, .navbar, .no-print { display: none !important; }
  #wrapper, body { background: #fff !important; }
}
