/*
 * mobile_ux.css — Mobile UX optimization (app-like experience)
 * Load after responsive.css. CSS + Bootstrap only; no backend changes.
 * Does not remove existing classes or break desktop layout.
 */

/* ==========================================================================
   STEP 8 — SMOOTH SCROLLING
   ========================================================================== */
html {
    scroll-behavior: smooth;
}

/* ==========================================================================
   STEP 1 — MOBILE NAVBAR OPTIMIZATION
   ========================================================================== */
@media (max-width: 768px) {
    .navbar-nav .nav-link {
        padding: 12px 16px;
        font-size: 16px;
    }

    .navbar-brand img,
    .navbar-brand .navbar-logo,
    .navbar-brand .brand-logo {
        height: 38px;
        width: auto;
        max-width: 140px;
    }

    .navbar-collapse .dropdown-item {
        padding: 12px 16px;
        font-size: 15px;
    }

    .navbar-toggler {
        padding: 10px 12px;
        min-height: 44px;
        min-width: 44px;
    }
}

/* ==========================================================================
   STEP 2 — FLOATING ACTION BUTTON (visible only on mobile)
   ========================================================================== */
.mobile-fab {
    display: none;
}

@media (max-width: 768px) {
    .mobile-fab {
        display: flex;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
    }

    .fab-button {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--accent-theme, #c62828);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        line-height: 1;
        text-decoration: none;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
        border: none;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .fab-button:hover,
    .fab-button:focus {
        color: white;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    }

    .fab-button:active {
        transform: scale(0.95);
    }

    .fab-button i {
        font-size: 1.5rem;
    }
}

@media (min-width: 769px) {
    .mobile-fab {
        display: none !important;
    }
}

/* ==========================================================================
   STEP 3 — DASHBOARD CARD MOBILE OPTIMIZATION
   ========================================================================== */
@media (max-width: 768px) {
    .dashboard-card,
    .dashboard-main .card,
    .admin-card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .dashboard-card h3,
    .dashboard-main .card h3,
    .dashboard-main .card .h5,
    .dashboard-main .card .h6 {
        font-size: 18px;
    }

    .dashboard-main .card-body {
        padding: 14px 16px;
    }
}

/* ==========================================================================
   STEP 4 — TOUCH INTERACTION IMPROVEMENTS (44px min tap target)
   ========================================================================== */
@media (max-width: 768px) {
    button,
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 14px;
    }

    .btn.btn-sm {
        min-height: 40px;
        min-width: 40px;
    }

    .navbar-nav .nav-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Tap feedback */
@media (max-width: 768px) {
    .btn:active {
        transform: scale(0.97);
    }

    .nav-link:active,
    .dropdown-item:active {
        opacity: 0.9;
    }
}

/* ==========================================================================
   STEP 5 — MOBILE SPACING OPTIMIZATION
   ========================================================================== */
@media (max-width: 768px) {
    .section {
        padding: 16px 10px;
    }

    .card-body {
        padding: 14px;
    }

    .container .row.g-4 {
        gap: 12px;
    }
}

/* ==========================================================================
   STEP 6 — STICKY MOBILE ACTIONS (add class to any important action bar)
   ========================================================================== */
@media (max-width: 768px) {
    .sticky-mobile-action {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--card-bg-theme, #fff);
        padding: 10px 15px;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 999;
        border-top: 1px solid var(--border-color-theme, #e5e7eb);
    }

    /* Prevent content from hiding under sticky bar */
    body.has-sticky-mobile-action main {
        padding-bottom: 70px;
    }
}

@media (min-width: 769px) {
    .sticky-mobile-action {
        position: static;
        box-shadow: none;
        padding: 0;
        background: transparent;
        border-top: none;
    }

    body.has-sticky-mobile-action main {
        padding-bottom: 0;
    }
}

/* ==========================================================================
   STEP 7 — MOBILE MODAL OPTIMIZATION
   ========================================================================== */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header,
    .modal-footer {
        padding: 12px 16px;
    }
}
