/* ===================================
   MOBILE RESPONSIVENESS & TOUCH OPTIMIZATIONS
   Phase 2 - Promope Platform
   =================================== */

/* Touch-Friendly Button Sizes (Minimum 44x44px) */
.btn,
.nav-link,
.dropdown-item,
button,
a.btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
}

/* Mobile Navigation Enhancements */
@media (max-width: 991px) {
    /* Navbar Mobile */
    .navbar {
        padding: 0.75rem 0;
    }

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

    .navbar-toggler {
        padding: 0.5rem;
        min-height: 44px;
        min-width: 44px;
        border: none;
        border-radius: 8px;
    }

    .navbar-toggler:focus {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
        outline: none;
    }

    .navbar-collapse {
        background: white;
        padding: 1.5rem;
        margin-top: 1rem;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        max-height: 80vh;
        overflow-y: auto;
    }

    .navbar-nav {
        gap: 0.5rem;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        padding: 1rem !important;
        border-radius: 8px;
        margin: 0 !important;
        width: 100%;
        justify-content: flex-start;
        transition: all 0.2s;
    }

    .nav-link:hover,
    .nav-link.active {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
        transform: translateX(5px);
    }

    /* User Dropdown Mobile */
    .user-dropdown-toggle {
        width: 100%;
        padding: 1rem !important;
        border-radius: 8px;
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    }

    .custom-dropdown-menu {
        position: static !important;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 1px solid #e2e8f0;
        margin-top: 0.5rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .custom-dropdown-menu.active {
        max-height: 500px;
    }

    /* Dark Mode Toggle Mobile */
    .dark-mode-toggle {
        width: 100%;
        padding: 1rem;
        border-radius: 8px;
        margin-bottom: 0.5rem;
        justify-content: flex-start;
    }

    /* Join Now Button Mobile */
    .btn-primary.dropdown-toggle {
        width: 100%;
        justify-content: center;
    }
}

/* Tablet Breakpoint */
@media (max-width: 768px) {
    /* Container Padding */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Cards Mobile */
    .card {
        border-radius: 12px;
    }

    .card-body {
        padding: 1.25rem;
    }

    /* Campaign/Influencer Cards */
    .campaign-card,
    .influencer-card {
        margin-bottom: 1rem;
    }

    .campaign-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .campaign-meta-item {
        text-align: left;
    }

    /* Stats Cards */
    .stat-card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }

    .stat-card h3 {
        font-size: 2rem;
    }

    /* Welcome Banner */
    .welcome-banner {
        padding: 1.5rem;
        text-align: center;
    }

    .welcome-banner h1 {
        font-size: 1.5rem;
    }

    .quick-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .quick-actions .btn {
        width: 100%;
        min-width: auto;
    }

    /* Forms Mobile */
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
        border-radius: 8px;
    }

    textarea.form-control {
        min-height: 120px;
    }

    .form-label {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    /* Buttons Mobile */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        min-height: 44px;
    }

    .btn-lg {
        padding: 1rem 2rem;
        font-size: 1.125rem;
        min-height: 52px;
    }

    /* Tables Mobile */
    .table-responsive {
        border-radius: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Modals Mobile */
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

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

    /* Footer Mobile */
    footer {
        padding: 2rem 0 1rem;
    }

    footer .col-md-2,
    footer .col-md-4 {
        margin-bottom: 2rem;
    }
}

/* Small Mobile Breakpoint */
@media (max-width: 576px) {
    /* Typography Mobile */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    h5 {
        font-size: 1rem;
    }

    /* Hero Section Mobile */
    .hero-section {
        padding: 2rem 0;
    }

    .hero-section h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .hero-section p {
        font-size: 1rem;
    }

    /* Stats Cards Small Mobile */
    .stat-card {
        padding: 1.25rem;
    }

    .stat-card h3 {
        font-size: 1.75rem;
    }

    .stat-card .stat-icon {
        font-size: 2rem;
    }

    /* Profile Images Small Mobile */
    .profile-img {
        width: 100px;
        height: 100px;
    }

    .profile-img-placeholder {
        width: 100px;
        height: 100px;
        font-size: 2rem;
    }

    .user-avatar-sm {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }

    /* Badges Small Mobile */
    .user-badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }

    .badge-category {
        font-size: 0.75rem;
        padding: 0.3rem 0.75rem;
    }

    /* Grid Columns Small Mobile */
    .col-md-6,
    .col-xl-4,
    .col-xl-6 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Bottom Sheet for Filters (Mobile) */
.filter-sidebar-wrapper {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

@media (max-width: 991px) {
    .filter-sidebar-wrapper {
        position: fixed;
        bottom: -100%;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 80vh;
        background: white;
        z-index: 1050;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.15);
        padding: 1.5rem;
        overflow-y: auto;
        transition: bottom 0.3s ease;
    }

    .filter-sidebar-wrapper.show {
        bottom: 0;
    }

    /* Filter Header Mobile */
    .filter-sidebar-wrapper h5 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    /* Filter Toggle Button */
    .filter-toggle-mobile {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        z-index: 1040;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        padding: 0;
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .filter-toggle-mobile:active {
        transform: scale(0.95);
    }

    /* Filter Overlay */
    .filter-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1049;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        backdrop-filter: blur(4px);
    }

    .filter-overlay.show {
        opacity: 1;
        visibility: visible;
    }
}

/* Touch Feedback */
@media (hover: none) and (pointer: coarse) {
    /* This targets touch devices only */

    .btn:active,
    .nav-link:active,
    .dropdown-item:active {
        transform: scale(0.98);
        opacity: 0.8;
    }

    .card:active {
        transform: scale(0.99);
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-link:hover,
    .dropdown-item:hover,
    .card:hover {
        transform: none;
    }

    /* But keep active states */
    .nav-link.active {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    }
}

/* Landscape Mobile Orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar-collapse {
        max-height: 60vh;
    }

    .custom-dropdown-menu {
        max-height: 50vh;
    }

    .filter-sidebar-wrapper {
        max-height: 70vh;
    }
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .filter-toggle-mobile {
        bottom: max(1rem, env(safe-area-inset-bottom));
        right: max(1rem, env(safe-area-inset-right));
    }
}

/* Prevent iOS Text Size Adjustment */
body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Smooth Scrolling on Mobile */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Hide Scrollbar on Mobile (But Keep Functionality) */
@media (max-width: 768px) {
    .navbar-collapse::-webkit-scrollbar,
    .custom-dropdown-menu::-webkit-scrollbar,
    .filter-sidebar-wrapper::-webkit-scrollbar {
        width: 4px;
    }

    .navbar-collapse::-webkit-scrollbar-thumb,
    .custom-dropdown-menu::-webkit-scrollbar-thumb,
    .filter-sidebar-wrapper::-webkit-scrollbar-thumb {
        background: rgba(102, 126, 234, 0.3);
        border-radius: 4px;
    }
}
