/* ============================================
   Mobile Responsiveness Fixes
   ============================================ */

/* --- Page header bars: title + action buttons --- */
@media (max-width: 575.98px) {
    .page-header-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }
    .page-header-flex .btn {
        width: 100%;
    }
    .page-header-flex > div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .page-header-flex > div > .btn {
        margin: 0 !important;
    }
}

/* --- Lead list filter form: stack on mobile --- */
@media (max-width: 767.98px) {
    .filter-form-row .col-md-2 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .filter-form-row .col-md-2:last-child {
        flex: 0 0 100%;
        max-width: 100%;
    }
}
@media (max-width: 575.98px) {
    .filter-form-row .col-md-2 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* --- Advisor leads filter bar: wrap on mobile --- */
@media (max-width: 767.98px) {
    .advisor-filter-bar .row {
        flex-direction: column;
    }
    .advisor-filter-bar .col-auto.ms-auto {
        margin-left: 0 !important;
        margin-top: 8px;
    }
    .advisor-filter-bar .col-auto.ms-auto .d-flex {
        flex-wrap: wrap;
    }
    .advisor-filter-bar .col-auto.ms-auto input[name="search"] {
        width: 100% !important;
        min-width: 0;
    }
}

/* --- Table action buttons: no wrapping issues --- */
@media (max-width: 767.98px) {
    .table td .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
        margin-bottom: 2px;
    }
}

/* --- Bulk action bar: stack on mobile --- */
@media (max-width: 575.98px) {
    #bulkBar {
        flex-direction: column;
        gap: 8px !important;
    }
    #bulkBar .form-select {
        width: 100% !important;
    }
}

/* --- Admin container padding reduction on mobile --- */
@media (max-width: 575.98px) {
    .content .container-fluid.px-4 {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    .content .container-fluid .bg-secondary.p-4 {
        padding: 16px !important;
    }
}

/* --- Dashboard stat cards: readable on small screens --- */
@media (max-width: 575.98px) {
    .col-sm-6.col-xl-3 .bg-secondary.p-4,
    .col-sm-6.col-xl-4 .bg-secondary.p-4 {
        padding: 12px !important;
    }
    .col-sm-6.col-xl-3 .fa-3x,
    .col-sm-6.col-xl-4 .fa-3x {
        font-size: 2rem !important;
    }
}

/* --- Top navbar: tighter spacing on mobile --- */
@media (max-width: 575.98px) {
    .content .navbar .navbar-nav .nav-link {
        margin-left: 10px;
    }
    .content .navbar .sidebar-toggler,
    .content .navbar .navbar-nav .nav-link i {
        width: 35px;
        height: 35px;
    }
}

/* --- Forms: ensure touch-friendly size on mobile --- */
@media (max-width: 575.98px) {
    .form-control,
    .form-select {
        min-height: 44px;
    }
    .btn {
        min-height: 44px;
    }
    .btn-sm {
        min-height: 36px;
    }
    .form-check-input {
        width: 20px;
        height: 20px;
        margin-top: 2px;
    }
    .form-check-label {
        padding-left: 4px;
    }
}

/* --- reCAPTCHA: scale down on very small screens --- */
@media (max-width: 360px) {
    .g-recaptcha {
        transform: scale(0.85);
        transform-origin: left top;
    }
}

/* --- Footer: center on mobile --- */
@media (max-width: 575.98px) {
    .bg-secondary.rounded-top .col-12.col-sm-6 {
        text-align: center !important;
    }
    .bg-secondary.rounded-top p {
        font-size: 0.8rem;
    }
}

/* --- Chart containers: min-height for readability --- */
@media (max-width: 575.98px) {
    canvas {
        max-height: 250px;
    }
}

/* --- Modal dialogs: full width on mobile --- */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 10px;
    }
}

/* --- Pagination: wrap on mobile --- */
@media (max-width: 575.98px) {
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }
    .pagination .page-link {
        min-width: 36px;
        min-height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 4px 8px;
    }
}

/* --- Settings page color pickers: larger touch area --- */
@media (max-width: 575.98px) {
    .form-control-color {
        min-height: 44px;
    }
}

/* --- Advisor list: photo column on mobile --- */
@media (max-width: 575.98px) {
    .table td img[style*="border-radius:50%"] {
        width: 40px !important;
        height: 40px !important;
    }
}

/* --- Edit advisor photo preview on mobile --- */
@media (max-width: 575.98px) {
    img[style*="max-width:150px"] {
        max-width: 100px !important;
    }
}

/* --- E1: jednotné prázdne stavy + skeleton loadery --- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #6c757d;
}
.empty-state i { font-size: 2.5rem; opacity: .4; margin-bottom: .75rem; display: block; }
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,.06) 25%, rgba(255,255,255,.14) 37%, rgba(255,255,255,.06) 63%);
    background-size: 400% 100%;
    animation: mrmSkeleton 1.2s ease-in-out infinite;
    border-radius: .35rem;
}
@keyframes mrmSkeleton { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* --- E4: mobilné tabuľky – plynulý horizontálny scroll + kompaktnejšie bunky --- */
@media (max-width: 575.98px) {
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .table-responsive > .table { font-size: .85rem; }
    .table-responsive > .table td,
    .table-responsive > .table th { padding: .4rem .5rem; white-space: nowrap; }
}
