/**
 * Mobile Responsive Styles
 * Global styles for mobile devices across the application
 *
 * Breakpoints:
 * - Tablet: 768px and below
 * - Mobile: 576px and below
 * - Small Mobile: 390px and below (iPhone SE, etc.)
 */

/* ===== NAVBAR STYLES ===== */

/* User profile dropdown button */
.user-profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background 0.2s ease;
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Hide dropdown caret */
.navbar .dropdown-toggle::after {
    display: none;
}

/* Dropdown menu styling */
.navbar .dropdown-menu {
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 8px;
}

.navbar .dropdown-header {
    font-size: 0.8rem;
    color: #6c757d;
    padding: 0.5rem 1rem;
}

.navbar .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.navbar .dropdown-item i {
    width: 20px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .user-profile-btn {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
}


/* ===== PAGE HEADER MOBILE STYLES ===== */

/* Default state: desktop buttons visible, mobile menu hidden */
.admin-buttons-desktop {
    display: flex;
}

.admin-buttons-mobile {
    display: none;
}

@media (max-width: 768px) {
    .page-header-mobile {
        flex-direction: row !important;
        align-items: center;
        gap: 0.5rem;
    }

    .page-header-mobile h2 {
        font-size: 1.25rem;
        margin-bottom: 0;
    }

    .admin-buttons-desktop {
        display: none !important;
    }

    .admin-buttons-mobile {
        display: block !important;
    }
}

/* Overflow menu styling */
.admin-buttons-mobile .btn-overflow {
    padding: 0.375rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1;
}


/* ===== TAB NAVIGATION MOBILE STYLES ===== */

@media (max-width: 768px) {
    /* Horizontal scrolling tabs */
    .nav-tabs-mobile-scroll {
        display: flex;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        padding-bottom: 2px;
        margin-bottom: 1rem;
        border-bottom: 1px solid #dee2e6;
    }

    .nav-tabs-mobile-scroll::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .nav-tabs-mobile-scroll .nav-item {
        flex-shrink: 0;
    }

    .nav-tabs-mobile-scroll .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        border: none;
        border-bottom: 2px solid transparent;
        border-radius: 0;
        color: #6c757d;
    }

    .nav-tabs-mobile-scroll .nav-link.active {
        color: #0d6efd;
        border-bottom-color: #0d6efd;
        background: transparent;
    }

    /* Scroll fade indicator */
    .nav-tabs-wrapper {
        position: relative;
    }

    .nav-tabs-wrapper::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to right, transparent, rgba(248, 249, 250, 0.9));
        pointer-events: none;
    }
}


/* ===== GENERAL MOBILE UTILITIES ===== */

@media (max-width: 576px) {
    /* Reduce container padding on mobile */
    .container, .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Smaller headings */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
    h5 { font-size: 0.95rem; }

    /* Compact cards */
    .card-body {
        padding: 0.75rem;
    }

    /* Compact buttons */
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Extra small screens (iPhone SE) */
@media (max-width: 390px) {
    .container, .container-fluid {
        padding-left: 8px;
        padding-right: 8px;
    }

    h2 { font-size: 1.1rem; }

    .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
}


/* ===== TOUCH FEEDBACK ===== */

/* Better touch targets */
@media (max-width: 768px) {
    .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Touch feedback for interactive elements */
.touch-feedback:active {
    transform: scale(0.98);
    opacity: 0.9;
}


/* ===== MODAL MOBILE IMPROVEMENTS ===== */

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1;
    }

    /* iOS touch fix for buttons inside modals */
    .modal-body .btn,
    .modal-footer .btn {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    /* Ensure action button containers don't block touch */
    .modal-body .d-flex {
        pointer-events: auto;
    }
}
