/*
Template Name: Herozi - Admin & Dashboard Template
Author: SRBThemes
Version: 1.0.0
File: Custom Css File
*/

/* ================================================================
   MOBILE GLOBAL FIXES — applies across all pages
   ================================================================ */

/* ── Prevent body/app from overflowing horizontally ── */
body { overflow-x: hidden; }
.app-wrapper, .app-container { overflow-x: hidden; }

/* ── Page header rows (d-flex justify-content-between) ── */
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
}

/* ── All tables: touch scroll by default ── */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* ── Breadcrumb: don't overflow ── */
.breadcrumb { flex-wrap: wrap; }

/* ── Buttons in action groups: allow shrink ── */
.btn-group-mobile { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Cards: no horizontal overflow (only x-axis, not y — avoids clipping sticky elements) ── */
.card { overflow-x: hidden; }

/* ================================================================
   SELECT DESIGN — visual upgrade for all .form-select elements
   ================================================================ */

/* Base: cleaner border, softer radius, subtle shadow on focus */
.form-select {
    border-color: #d1d5db;
    border-radius: 8px;
    font-size: 13.5px;
    color: #374151;
    background-color: #fff;
    padding-top: 7px;
    padding-bottom: 7px;
    transition: border-color .18s, box-shadow .18s;
    cursor: pointer;
}
.form-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
    outline: none;
}
.form-select:hover:not(:focus):not(:disabled) {
    border-color: #9ca3af;
}
.form-select:disabled {
    background-color: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Small variant */
.form-select-sm {
    font-size: 12.5px;
    padding-top: 5px;
    padding-bottom: 5px;
    border-radius: 7px;
}

/* Custom arrow: sharper, centered */
.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='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
    background-size: 13px 13px;
    background-position: right 10px center;
    padding-right: 30px;
}

/* Dark mode compat */
[data-bs-theme="dark"] .form-select {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
[data-bs-theme="dark"] .form-select:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, .15);
}

/* Mobile: full-width selects stack nicely */
@media (max-width: 767.98px) {
    .form-select {
        font-size: 14px;
        padding-top: 9px;
        padding-bottom: 9px;
        min-height: 42px;
    }
    .form-select-sm {
        font-size: 13px;
        padding-top: 7px;
        padding-bottom: 7px;
        min-height: 38px;
    }
}

@media (max-width: 767.98px) {

    /* ── App container padding reduction ── */
    .app-container { padding-left: 12px !important; padding-right: 12px !important; }
    .app-content   { padding: 12px !important; }

    /* ── Generic page title + action header ── */
    .d-flex.justify-content-between.align-items-center:not(.no-mobile-stack) {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    /* ── Tables: ensure horizontal scroll ── */
    .table-responsive { border-radius: 0; }
    table { font-size: 12.5px; }
    table th, table td { padding: 8px 10px !important; }

    /* ── Cards ── */
    .card-body { padding: 14px !important; }
    .card-header { padding: 12px 14px !important; }

    /* ── Breadcrumb ── */
    .breadcrumb-item + .breadcrumb-item { padding-left: 4px; }
    .breadcrumb-item + .breadcrumb-item::before { padding-right: 4px; }

    /* ── Form controls ── */
    .form-control, .form-select { font-size: 14px !important; }

    /* ── Buttons: don't clip text ── */
    .btn { white-space: normal; }
    .btn-sm { font-size: 12px; }

    /* ── Nav tabs: scroll horizontally ── */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
    .nav-tabs::-webkit-scrollbar { display: none; }
    .nav-tabs .nav-link { white-space: nowrap; }

    /* ── Modals: full width on mobile ── */
    .modal-dialog { margin: 8px; }
    .modal-dialog:not(.modal-fullscreen) { max-width: calc(100vw - 16px); }

    /* ── Alert boxes ── */
    .alert { font-size: 13px; padding: 10px 14px; }

    /* ── Pagination ── */
    .pagination { flex-wrap: wrap; gap: 4px; }
    .page-link { padding: 4px 8px; font-size: 12px; }

    /* ── Input groups ── */
    .input-group > .form-control,
    .input-group > .form-select { min-width: 0; }

    /* ── Badge pills wrapping ── */
    .hstack.gap-2, .hstack.gap-3 { flex-wrap: wrap; }

    /* ── Stats/KPI grids ── */
    .row.g-3 > [class*="col-lg-3"],
    .row.g-3 > [class*="col-lg-4"] {
        /* Bootstrap already handles col-12 fallback; this ensures 2-col for col-lg-3 without col-6 */
    }
    .row.g-2 > [class*="col-lg-3"]:not([class*="col-6"]):not([class*="col-sm"]) {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 575.98px) {

    /* ── Stack all row elements unless explicitly col-6 ── */
    .row.g-3 > [class*="col-lg"]:not([class*="col-6"]):not([class*="col-sm"]):not([class*="col-12"]) {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* ── Tiny screens: tighter padding ── */
    .app-container { padding-left: 8px !important; padding-right: 8px !important; }
    .card-body { padding: 10px !important; }

    /* ── Hide non-essential table columns: add .d-none.d-sm-table-cell to columns ── */
    .table .d-none-xs { display: none !important; }

    /* ── Smaller headings ── */
    h4 { font-size: 16px; }
    h5 { font-size: 14px; }
    h6 { font-size: 13px; }
}
