/* ==========================================================================
   ZENTRA ADMINSTORE — custom.css
   Mobile-first. Dark mode. Override layer on top of theme.min.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Button brand colour
   -------------------------------------------------------------------------- */
.btn-primary {
    background-color: #333;
    border-color: #333;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-check:checked + .btn-primary,
.btn-primary:not(:disabled):not(.disabled):active,
.show > .btn-primary.dropdown-toggle {
    background-color: #262626;
    border-color: #262626;
}
.btn-primary:disabled,
.btn-primary.disabled {
    background-color: #333;
    border-color: #333;
    color: #fff;
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Auth page — login / register
   -------------------------------------------------------------------------- */
.auth-bg-surface {
    background: radial-gradient(circle at top right, #f5f7fb 0%, #e7edf7 40%, #e2e8f2 100%);
}
.auth-shell { position: relative; }
.auth-login-card { border-radius: 1rem; }
.auth-login-visual {
    background-image: linear-gradient(140deg, rgba(9,18,35,.78), rgba(23,35,58,.58)),
                      url("../images/marketing/hero-img.jpg");
    background-position: center;
    background-size: cover;
    color: #fff;
    min-height: 400px;
    overflow: hidden;
    padding: 2.25rem;
    position: relative;
}
.auth-login-copy {
    bottom: 2.25rem;
    left: 2.25rem;
    max-width: 24rem;
    position: absolute;
    z-index: 2;
}
.auth-kicker {
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.32);
    border-radius: 999px;
    display: inline-block;
    font-size: .72rem;
    letter-spacing: .08em;
    margin-bottom: .85rem;
    padding: .2rem .65rem;
}
.auth-flow-text {
    color: rgba(255,255,255,.18);
    font-size: 4.2rem;
    font-weight: 700;
    left: 1.9rem;
    letter-spacing: .18em;
    line-height: 1;
    position: absolute;
    top: 1.6rem;
    z-index: 1;
}

/* Mobile: hide the visual panel on small screens */
@media (max-width: 767.98px) {
    .auth-login-visual { display: none; }
    .auth-login-card  { border-radius: .75rem; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    .auth-login-card { border-radius: .75rem; }
    .auth-login-visual { min-height: 320px; }
}

/* --------------------------------------------------------------------------
   Mobile: responsive table utility & action button stacking
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    /* Let long codes / URLs break on small screens */
    code, .font-monospace { word-break: break-all; }

    /* Stack page header action buttons */
    .page-actions { flex-wrap: wrap; gap: .4rem !important; }

    /* Compact modals */
    .modal-dialog { margin: .5rem; }
}

/* --------------------------------------------------------------------------
   Sidebar & layout mobile utilities
   -------------------------------------------------------------------------- */
/* Hide sidebar text labels on very small sidebar widths if theme collapses */
@media (max-width: 767.98px) {
    #db-wrapper #page-content { margin-left: 0 !important; }
}

/* --------------------------------------------------------------------------
   Table improvements — light mode
   -------------------------------------------------------------------------- */
.table-responsive { border-radius: .375rem; }

/* Align badge vertically with surrounding text */
.badge { vertical-align: middle; }

/* --------------------------------------------------------------------------
   Progress bar label
   -------------------------------------------------------------------------- */
.progress { background-color: #e9ecef; }

/* ==========================================================================
   DARK MODE
   Applied via data-bs-theme="dark" on <html> AND body.dark-mode class.
   Both selectors are included so the JS toggle (which sets both) works
   and so Bootstrap's own dark-mode utilities keep working.
   ========================================================================== */

/* --- Base --- */
body.dark-mode,
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] {
    --bs-body-bg:    #1a1a2e;
    --bs-body-color: #d0d4e0;
    background-color: #1a1a2e !important;
    color: #d0d4e0;
}

/* --- Cards --- */
body.dark-mode .card,
[data-bs-theme="dark"] .card {
    background-color: #16213e;
    border-color: #0f3460;
    color: #d0d4e0;
}
body.dark-mode .card-header,
[data-bs-theme="dark"] .card-header {
    background-color: #0f3460 !important;
    border-bottom-color: #1a3a6e;
    color: #d0d4e0;
}
body.dark-mode .card-footer,
[data-bs-theme="dark"] .card-footer {
    background-color: #0f3460 !important;
    border-top-color: #1a3a6e;
}
body.dark-mode .card-body,
[data-bs-theme="dark"] .card-body {
    color: #d0d4e0;
}

/* --- Navbar / topbar --- */
body.dark-mode .header,
body.dark-mode .navbar,
[data-bs-theme="dark"] .header,
[data-bs-theme="dark"] .navbar {
    background-color: #16213e !important;
    border-bottom: 1px solid #0f3460;
    color: #d0d4e0;
}

/* --- Sidebar --- */
body.dark-mode .navbar-vertical,
body.dark-mode #nav-wrapper,
[data-bs-theme="dark"] .navbar-vertical {
    background-color: #0f3460 !important;
    border-right: 1px solid #1a3a6e;
}
body.dark-mode .navbar-vertical .nav-link,
[data-bs-theme="dark"] .navbar-vertical .nav-link {
    color: #a8b4cc;
}
body.dark-mode .navbar-vertical .nav-link:hover,
body.dark-mode .navbar-vertical .nav-link.active,
[data-bs-theme="dark"] .navbar-vertical .nav-link:hover,
[data-bs-theme="dark"] .navbar-vertical .nav-link.active {
    color: #fff;
    background-color: rgba(255,255,255,.08);
    border-radius: .375rem;
}

/* --- Tables --- */
body.dark-mode .table,
[data-bs-theme="dark"] .table {
    --bs-table-bg:            #16213e;
    --bs-table-striped-bg:    #1a1a2e;
    --bs-table-hover-bg:      #1a3a6e;
    --bs-table-border-color:  #0f3460;
    color: #d0d4e0;
    border-color: #0f3460;
}
/* thead.table-light inside dark cards */
body.dark-mode .table-light,
body.dark-mode thead.table-light,
body.dark-mode .table-light > th,
body.dark-mode .table-light > td,
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] thead.table-light,
[data-bs-theme="dark"] .table-light > th,
[data-bs-theme="dark"] .table-light > td {
    --bs-table-bg:    #0f3460 !important;
    background-color: #0f3460 !important;
    color: #c0c8d8 !important;
    border-color: #1a3a6e !important;
}
body.dark-mode .table thead th,
[data-bs-theme="dark"] .table thead th {
    border-bottom-color: #1a3a6e;
    color: #c0c8d8;
}
body.dark-mode .table-warning,
[data-bs-theme="dark"] .table-warning {
    --bs-table-bg: #2a1f00;
    color: #e0c060;
}

/* --- Forms --- */
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #0f3460;
    border-color: #1a3a6e;
    color: #d0d4e0;
}
body.dark-mode .form-control::placeholder,
[data-bs-theme="dark"] .form-control::placeholder {
    color: #6a7a90;
}
body.dark-mode .form-control:disabled,
body.dark-mode .form-select:disabled,
[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-select:disabled {
    background-color: #0a2040;
    color: #6a7a90;
}
body.dark-mode .input-group-text,
[data-bs-theme="dark"] .input-group-text {
    background-color: #0a2040;
    border-color: #1a3a6e;
    color: #a8b4cc;
}
body.dark-mode .form-text,
[data-bs-theme="dark"] .form-text {
    color: #7a8aaa !important;
}
body.dark-mode .form-label,
[data-bs-theme="dark"] .form-label {
    color: #c0c8d8;
}
body.dark-mode .form-check-label,
[data-bs-theme="dark"] .form-check-label {
    color: #c0c8d8;
}
body.dark-mode .form-check-input,
[data-bs-theme="dark"] .form-check-input {
    background-color: #0f3460;
    border-color: #1a3a6e;
}
body.dark-mode .form-check-input:checked,
[data-bs-theme="dark"] .form-check-input:checked {
    background-color: #4a7dd4;
    border-color: #4a7dd4;
}

/* --- Badges --- */
body.dark-mode .badge.bg-light,
[data-bs-theme="dark"] .badge.bg-light {
    background-color: #1a3a6e !important;
    color: #c0c8d8 !important;
    border-color: #2a4a7e !important;
}
body.dark-mode .badge.text-dark,
[data-bs-theme="dark"] .badge.text-dark {
    color: #c0c8d8 !important;
}

/* --- Modals --- */
body.dark-mode .modal-content,
[data-bs-theme="dark"] .modal-content {
    background-color: #16213e;
    border-color: #0f3460;
    color: #d0d4e0;
}
body.dark-mode .modal-header,
[data-bs-theme="dark"] .modal-header {
    background-color: #0f3460;
    border-bottom-color: #1a3a6e;
    color: #d0d4e0;
}
body.dark-mode .modal-footer,
[data-bs-theme="dark"] .modal-footer {
    background-color: #0f3460;
    border-top-color: #1a3a6e;
}
body.dark-mode .modal-title,
[data-bs-theme="dark"] .modal-title {
    color: #d0d4e0;
}
body.dark-mode .btn-close,
[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* --- Alerts --- */
body.dark-mode .alert-success,
[data-bs-theme="dark"] .alert-success {
    background-color: #0a2a1a;
    border-color: #1a5a30;
    color: #6fd89a;
}
body.dark-mode .alert-danger,
[data-bs-theme="dark"] .alert-danger {
    background-color: #2a0a0a;
    border-color: #5a1a1a;
    color: #f08080;
}
body.dark-mode .alert-warning,
[data-bs-theme="dark"] .alert-warning {
    background-color: #2a1a00;
    border-color: #5a3a00;
    color: #e0a040;
}
body.dark-mode .alert-info,
[data-bs-theme="dark"] .alert-info {
    background-color: #001a2a;
    border-color: #005070;
    color: #60b8d8;
}

/* --- Buttons (outline variants readability) --- */
body.dark-mode .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-secondary {
    color: #a8b4cc;
    border-color: #3a4a6a;
}
body.dark-mode .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #1a3a6e;
    color: #fff;
}
body.dark-mode .btn-outline-primary,
[data-bs-theme="dark"] .btn-outline-primary {
    color: #6a9fd8;
    border-color: #4a7dd4;
}
body.dark-mode .btn-outline-primary:hover,
[data-bs-theme="dark"] .btn-outline-primary:hover {
    background-color: #4a7dd4;
    color: #fff;
}
body.dark-mode .btn-outline-danger,
[data-bs-theme="dark"] .btn-outline-danger {
    color: #f08080;
    border-color: #d06060;
}
body.dark-mode .btn-outline-success,
[data-bs-theme="dark"] .btn-outline-success {
    color: #6fd89a;
    border-color: #4ab870;
}
body.dark-mode .btn-outline-warning,
[data-bs-theme="dark"] .btn-outline-warning {
    color: #e0a040;
    border-color: #c08020;
}
body.dark-mode .btn-outline-info,
[data-bs-theme="dark"] .btn-outline-info {
    color: #60b8d8;
    border-color: #3a98b8;
}

/* --- Text utilities --- */
body.dark-mode .text-muted,
[data-bs-theme="dark"] .text-muted {
    color: #7a8aaa !important;
}
body.dark-mode .text-dark,
[data-bs-theme="dark"] .text-dark {
    color: #d0d4e0 !important;
}
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3,
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6,
body.dark-mode .h1, body.dark-mode .h2, body.dark-mode .h3,
body.dark-mode .h4, body.dark-mode .h5, body.dark-mode .h6,
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3, [data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6 {
    color: #d8dce8;
}
body.dark-mode p,
body.dark-mode span,
body.dark-mode td,
body.dark-mode th,
body.dark-mode label,
[data-bs-theme="dark"] p,
[data-bs-theme="dark"] span,
[data-bs-theme="dark"] td,
[data-bs-theme="dark"] th,
[data-bs-theme="dark"] label {
    color: inherit;
}
body.dark-mode small,
[data-bs-theme="dark"] small {
    color: #8a9ab8;
}

/* --- Code & pre --- */
body.dark-mode code,
[data-bs-theme="dark"] code {
    background-color: #0a1a30;
    color: #7ad4f0;
    border-radius: .25rem;
    padding: .1em .3em;
}
body.dark-mode pre,
[data-bs-theme="dark"] pre {
    background-color: #0a1a30;
    color: #c0d8f0;
    border: 1px solid #1a3a6e;
}

/* --- Nav tabs --- */
body.dark-mode .nav-tabs,
[data-bs-theme="dark"] .nav-tabs {
    border-bottom-color: #0f3460;
}
body.dark-mode .nav-tabs .nav-link,
[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: #7a8aaa;
    border-color: transparent;
}
body.dark-mode .nav-tabs .nav-link:hover,
[data-bs-theme="dark"] .nav-tabs .nav-link:hover {
    color: #d0d4e0;
    border-color: #1a3a6e;
}
body.dark-mode .nav-tabs .nav-link.active,
[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #16213e;
    border-color: #0f3460 #0f3460 #16213e;
    color: #d0d4e0;
}
body.dark-mode .nav-pills .nav-link,
[data-bs-theme="dark"] .nav-pills .nav-link {
    color: #7a8aaa;
}
body.dark-mode .nav-pills .nav-link.active,
[data-bs-theme="dark"] .nav-pills .nav-link.active {
    background-color: #1a3a6e;
    color: #fff;
}

/* --- Dropdown --- */
body.dark-mode .dropdown-menu,
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #16213e;
    border-color: #0f3460;
}
body.dark-mode .dropdown-item,
[data-bs-theme="dark"] .dropdown-item {
    color: #d0d4e0;
}
body.dark-mode .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #0f3460;
    color: #fff;
}
body.dark-mode .dropdown-divider,
[data-bs-theme="dark"] .dropdown-divider {
    border-top-color: #0f3460;
}

/* --- Progress bars --- */
body.dark-mode .progress,
[data-bs-theme="dark"] .progress {
    background-color: #0a1a30;
}

/* --- Borders & dividers --- */
body.dark-mode .border,
body.dark-mode .border-top,
body.dark-mode .border-bottom,
body.dark-mode .border-start,
body.dark-mode .border-end,
[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom {
    border-color: #0f3460 !important;
}
body.dark-mode hr,
[data-bs-theme="dark"] hr {
    border-top-color: #0f3460;
    opacity: 1;
}
body.dark-mode .border-top,
[data-bs-theme="dark"] .border-top {
    border-top-color: #0f3460 !important;
}

/* --- List group --- */
body.dark-mode .list-group-item,
[data-bs-theme="dark"] .list-group-item {
    background-color: #16213e;
    border-color: #0f3460;
    color: #d0d4e0;
}

/* --- SEO SERP snippet preview (products/edit SEO tab) --- */
body.dark-mode .snippet-title-preview,
[data-bs-theme="dark"] .snippet-title-preview {
    color: #6a9fd8;
}
body.dark-mode .snippet-url-preview,
[data-bs-theme="dark"] .snippet-url-preview {
    color: #6ab87a;
}
body.dark-mode .snippet-desc-preview,
[data-bs-theme="dark"] .snippet-desc-preview {
    color: #8a9ab8;
}

/* --- Ratings (★ stars) keep their golden colour in dark mode --- */
body.dark-mode .text-warning,
[data-bs-theme="dark"] .text-warning {
    color: #e0b030 !important;
}

/* --- Inline bg-white overrides --- */
body.dark-mode .bg-white,
[data-bs-theme="dark"] .bg-white {
    background-color: #16213e !important;
    color: #d0d4e0;
}
body.dark-mode .bg-light,
[data-bs-theme="dark"] .bg-light {
    background-color: #0f3460 !important;
    color: #d0d4e0;
}

/* --- Pagination --- */
body.dark-mode .page-link,
[data-bs-theme="dark"] .page-link {
    background-color: #16213e;
    border-color: #0f3460;
    color: #6a9fd8;
}
body.dark-mode .page-item.active .page-link,
[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: #1a3a6e;
    border-color: #1a3a6e;
    color: #fff;
}
body.dark-mode .page-item.disabled .page-link,
[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: #0a1a30;
    color: #4a5a70;
}

/* --- Collapse toggle arrows --- */
body.dark-mode [data-bs-toggle="collapse"] .chevron,
[data-bs-theme="dark"] [data-bs-toggle="collapse"] .chevron {
    color: #7a8aaa;
}

/* --- Tab content pane separator fix --- */
body.dark-mode .tab-content,
[data-bs-theme="dark"] .tab-content {
    color: #d0d4e0;
}

/* ==========================================================================
   MOBILE-FIRST RESPONSIVE — global overrides
   Priority: mobile → tablet (md) → desktop (lg+)
   ========================================================================== */

/* --- Page content inner padding ------------------------------------------ */
#page-content > .container-fluid {
    padding: .75rem;          /* mobile base */
}
@media (min-width: 768px) {
    #page-content > .container-fluid { padding: 1.5rem; }
}
@media (min-width: 1200px) {
    #page-content > .container-fluid { padding: 2rem; }
}

/* --- Page headings -------------------------------------------------------- */
h3.mb-0, h3 { font-size: 1.2rem; }
@media (min-width: 768px)  { h3.mb-0, h3 { font-size: 1.4rem; } }
@media (min-width: 1200px) { h3.mb-0, h3 { font-size: 1.75rem; } }

/* --- Flex header rows (title + action buttons) wrap on mobile ------------- */
.d-flex.justify-content-between { flex-wrap: wrap; gap: .5rem; }

/* --- All tables: horizontal scroll on mobile, readable on all sizes ------- */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: .375rem;
}
/* Wrap every plain .table that is NOT already inside .table-responsive */
.card .table:not(.table-responsive .table) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 575.98px) {
    .table { font-size: .78rem; }
    .table td, .table th { padding: .35rem .5rem; }
    /* Let long strings break so they don't force horizontal scroll */
    .table td { word-break: break-word; max-width: 160px; }
    code, .font-monospace { word-break: break-all; }
}

/* --- Buttons: minimum touch target ---------------------------------------- */
.btn     { min-height: 36px; }
.btn-sm  { min-height: 30px; }
.btn-xs  { min-height: 26px; font-size: .72rem; padding: .15rem .45rem; }

/* --- Stack page header action buttons on mobile --------------------------- */
@media (max-width: 575.98px) {
    .page-actions,
    .d-flex.gap-2 { flex-wrap: wrap; gap: .35rem !important; }
    .modal-dialog  { margin: .4rem; }
    .card-body     { padding: .65rem; }
}

/* --- Tab bars: horizontal scroll on small screens ------------------------- */
.nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;           /* Firefox */
}
.nav-tabs::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.nav-tabs .nav-item { flex-shrink: 0; }

/* --- Form rows: full-width inputs on mobile ------------------------------- */
@media (max-width: 575.98px) {
    .row.g-3  > [class*="col-md"],
    .row.g-4  > [class*="col-md"],
    .row.g-2  > [class*="col-md"] {
        /* col-md-* collapses naturally to col-12 at xs; ensure no overflow */
        max-width: 100%;
    }
    .input-group { flex-wrap: nowrap; }
}

/* --- Sidebar: slide-in overlay on mobile (supplement theme behaviour) ----- */
@media (max-width: 767.98px) {
    #db-wrapper #page-content { margin-left: 0 !important; }
}

/* --- Media library lightbox ----------------------------------------------- */
.media-lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: .25rem;
}
/* Larger viewport: give the image more room */
@media (min-width: 768px) {
    .media-lightbox-img { max-height: 85vh; }
}

/* --- Sidebar & topbar responsive ------------------------------------------ */
@media (max-width: 991.98px) {
    /* Compact sidebar nav items */
    .navbar-vertical .nav-link { padding: .45rem .75rem; font-size: .875rem; }
}

/* --- Cards: consistent gutters on all screen sizes ----------------------- */
.row.g-4 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }
@media (min-width: 768px) {
    .row.g-4 { --bs-gutter-x: 1.5rem; --bs-gutter-y: 1.5rem; }
}

/* --- Compact stat/summary cards on mobile --------------------------------- */
@media (max-width: 575.98px) {
    .card.h-100 .card-body { padding: .6rem .75rem; }
    .fs-3, .fs-4 { font-size: 1.25rem !important; }
}

/* --- Prevent horizontal page overflow globally ---------------------------- */
body { overflow-x: hidden; }
.container-fluid { max-width: 100%; }
