/* 
 * Mobile Responsive CSS
 * Dedicated mobile styles for enhanced responsiveness
 * Covers member portal, admin panel, and all public pages
 */

/* ===== MOBILE NAVIGATION ENHANCEMENTS ===== */
@media (max-width: 768px) {
    /* Enhanced Mobile Menu */
    .navbar-menu {
        background: var(--color-white);
        border-radius: 0 0 10px 10px;
        padding: 10px 0;
    }
    
    .navbar-menu li:last-child {
        border-bottom: none;
    }
    
    .navbar-menu .dropdown-menu {
        background: rgba(169, 30, 35, 0.05);
        margin-left: 20px;
        border-radius: 5px;
    }
    
    /* Mobile Header Contact Info */
    .mobile-contact-info {
        background: var(--color-primary);
        color: white;
        padding: 8px 0;
        font-size: 0.8rem;
        text-align: center;
        display: block;
    }
    
    .mobile-contact-info a {
        color: white;
        text-decoration: none;
    }
}

/* ===== MEMBER PORTAL MOBILE STYLES ===== */
@media (max-width: 768px) {
    /* Member Dashboard Mobile */
    .member-dashboard {
        background: #f8f9fa;
    }
    
    .welcome-box {
        border-radius: 15px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    
    .welcome-box .row {
        flex-direction: column;
        text-align: center;
    }
    
    .welcome-box .col-md-9,
    .welcome-box .col-md-3 {
        flex: none;
        max-width: 100%;
    }
    
    /* Mobile Menu Cards Grid */
    .mobile-menu-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .menu-card {
        aspect-ratio: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        min-height: 120px;
    }
    
    /* Member Info Cards Mobile */
    .member-info-mobile {
        background: white;
        border-radius: 10px;
        padding: 15px;
        margin-bottom: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .member-info-mobile h6 {
        color: var(--color-primary);
        font-size: 0.8rem;
        margin-bottom: 5px;
        text-transform: uppercase;
        font-weight: 600;
    }
    
    .member-info-mobile p {
        margin: 0;
        font-size: 0.9rem;
        color: var(--color-dark);
    }
    
    /* Mobile Status Badges */
    .status-badge-mobile {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: 500;
    }
    
    .status-badge-mobile.active {
        background: #d4edda;
        color: #155724;
    }
    
    .status-badge-mobile.pending {
        background: #fff3cd;
        color: #856404;
    }
    
    .status-badge-mobile.expired {
        background: #f8d7da;
        color: #721c24;
    }
    
    /* Mobile Member Card */
    .member-card-mobile {
        background: white;
        border-radius: 15px;
        padding: 20px;
        text-align: center;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        margin-bottom: 20px;
    }
    
    .member-card-mobile .member-photo {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        margin: 0 auto 15px;
        border: 3px solid var(--color-primary);
    }
    
    .member-card-mobile .qr-code {
        width: 120px;
        height: 120px;
        margin: 15px auto;
    }
}

/* ===== ADMIN PANEL MOBILE STYLES ===== */
@media (max-width: 768px) {
    /* Admin Sidebar Mobile */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        background: var(--color-dark);
        transition: left 0.3s ease;
        z-index: 1050;
        overflow-y: auto;
    }
    
    .admin-sidebar.active {
        left: 0;
    }
    
    .admin-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        display: none;
    }
    
    .admin-sidebar-overlay.active {
        display: block;
    }
    
    /* Admin Content Mobile */
    .admin-content {
        margin-left: 0;
        padding: 15px;
    }
    
    .admin-header-mobile {
        background: var(--color-white);
        padding: 10px 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
    }
    
    .admin-menu-toggle {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--color-dark);
        cursor: pointer;
    }
    
    /* Admin Stats Mobile */
    .admin-stats-mobile {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .admin-stat-card {
        background: white;
        padding: 15px;
        border-radius: 10px;
        text-align: center;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .admin-stat-card .stat-number {
        font-size: 1.5rem;
        font-weight: bold;
        color: var(--color-primary);
        margin-bottom: 5px;
    }
    
    .admin-stat-card .stat-label {
        font-size: 0.8rem;
        color: var(--color-gray);
        text-transform: uppercase;
    }
    
    /* Admin Tables Mobile */
    .admin-table-mobile {
        background: white;
        border-radius: 10px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .admin-table-mobile .table {
        margin: 0;
        font-size: 0.8rem;
    }
    
    .admin-table-mobile .table th {
        background: var(--color-primary);
        color: white;
        font-size: 0.75rem;
        padding: 10px 8px;
    }
    
    .admin-table-mobile .table td {
        padding: 8px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* Admin Action Buttons Mobile */
    .admin-actions-mobile {
        display: flex;
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .admin-actions-mobile .btn {
        padding: 6px 10px;
        font-size: 0.7rem;
        border-radius: 5px;
    }
}

/* ===== FORM ENHANCEMENTS MOBILE ===== */
@media (max-width: 768px) {
    /* Mobile Form Layout */
    .form-mobile {
        background: white;
        border-radius: 15px;
        padding: 20px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        margin-bottom: 20px;
    }
    
    .form-mobile .form-group {
        margin-bottom: 20px;
    }
    
    .form-mobile .form-label {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--color-dark);
        margin-bottom: 8px;
    }
    
    .form-mobile .form-control {
        border: 2px solid #e9ecef;
        border-radius: 10px;
        padding: 12px 15px;
        font-size: 1rem;
        transition: all 0.3s ease;
    }
    
    .form-mobile .form-control:focus {
        border-color: var(--color-primary);
        box-shadow: 0 0 0 3px rgba(169, 30, 35, 0.1);
    }
    
    /* Mobile File Upload */
    .file-upload-mobile {
        border: 2px dashed #ddd;
        border-radius: 10px;
        padding: 20px;
        text-align: center;
        background: #f8f9fa;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .file-upload-mobile:hover {
        border-color: var(--color-primary);
        background: rgba(169, 30, 35, 0.05);
    }
    
    .file-upload-mobile input[type="file"] {
        display: none;
    }
    
    .file-upload-mobile .upload-icon {
        font-size: 2rem;
        color: var(--color-gray);
        margin-bottom: 10px;
    }
    
    .file-upload-mobile .upload-text {
        font-size: 0.9rem;
        color: var(--color-gray);
    }
    
    /* Mobile Form Actions */
    .form-actions-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }
    
    .form-actions-mobile .btn {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
        border-radius: 10px;
    }
}

/* ===== TABLE RESPONSIVE ENHANCEMENTS ===== */
@media (max-width: 768px) {
    /* Mobile Table Cards */
    .table-card-mobile {
        display: none;
    }
    
    .table-responsive {
        display: none;
    }
    
    .mobile-table-cards {
        display: block;
    }
    
    .mobile-table-card {
        background: white;
        border-radius: 10px;
        padding: 15px;
        margin-bottom: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border-left: 4px solid var(--color-primary);
    }
    
    .mobile-table-card .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .mobile-table-card .card-title {
        font-weight: 600;
        color: var(--color-dark);
        margin: 0;
    }
    
    .mobile-table-card .card-actions {
        display: flex;
        gap: 5px;
    }
    
    .mobile-table-card .card-body {
        padding: 0;
    }
    
    .mobile-table-card .info-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
        font-size: 0.85rem;
    }
    
    .mobile-table-card .info-label {
        color: var(--color-gray);
        font-weight: 500;
    }
    
    .mobile-table-card .info-value {
        color: var(--color-dark);
        text-align: right;
        max-width: 60%;
        word-break: break-word;
    }
}

/* ===== MODAL ENHANCEMENTS MOBILE ===== */
@media (max-width: 768px) {
    .modal-mobile-fullscreen {
        padding: 0;
    }
    
    .modal-mobile-fullscreen .modal-dialog {
        margin: 0;
        width: 100%;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }
    
    .modal-mobile-fullscreen .modal-content {
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    .modal-mobile-fullscreen .modal-header {
        background: var(--color-primary);
        color: white;
        padding: 15px 20px;
        border-bottom: none;
    }
    
    .modal-mobile-fullscreen .modal-title {
        font-size: 1.1rem;
        margin: 0;
    }
    
    .modal-mobile-fullscreen .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
    }
    
    .modal-mobile-fullscreen .modal-footer {
        background: #f8f9fa;
        border-top: 1px solid #dee2e6;
        padding: 15px 20px;
    }
}

/* ===== ALERT ENHANCEMENTS MOBILE ===== */
@media (max-width: 768px) {
    .alert-mobile {
        border-radius: 10px;
        border: none;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        margin-bottom: 15px;
    }
    
    .alert-mobile .alert-icon {
        font-size: 1.2rem;
        margin-right: 10px;
    }
    
    .alert-mobile .alert-content {
        flex: 1;
    }
    
    .alert-mobile .alert-title {
        font-weight: 600;
        margin-bottom: 5px;
        font-size: 0.9rem;
    }
    
    .alert-mobile .alert-message {
        font-size: 0.85rem;
        margin: 0;
        line-height: 1.4;
    }
    
    /* Floating Alert */
    .alert-floating {
        position: fixed;
        top: 20px;
        left: 15px;
        right: 15px;
        z-index: 1060;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
        animation: slideDown 0.3s ease;
    }
    
    @keyframes slideDown {
        from {
            transform: translateY(-100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* ===== PAGINATION MOBILE ===== */
@media (max-width: 768px) {
    .pagination-mobile {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 5px;
        margin: 20px 0;
        flex-wrap: wrap;
    }
    
    .pagination-mobile .page-item {
        margin: 2px;
    }
    
    .pagination-mobile .page-link {
        padding: 8px 12px;
        font-size: 0.8rem;
        border-radius: 8px;
        border: 1px solid #dee2e6;
        color: var(--color-dark);
        text-decoration: none;
        min-width: 40px;
        text-align: center;
    }
    
    .pagination-mobile .page-link:hover {
        background: var(--color-primary);
        color: white;
        border-color: var(--color-primary);
    }
    
    .pagination-mobile .page-item.active .page-link {
        background: var(--color-primary);
        color: white;
        border-color: var(--color-primary);
    }
    
    .pagination-mobile .page-item.disabled .page-link {
        color: #6c757d;
        background: #f8f9fa;
        border-color: #dee2e6;
    }
}

/* ===== SEARCH AND FILTER MOBILE ===== */
@media (max-width: 768px) {
    .search-filter-mobile {
        background: white;
        border-radius: 15px;
        padding: 15px;
        margin-bottom: 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .search-input-mobile {
        position: relative;
        margin-bottom: 15px;
    }
    
    .search-input-mobile input {
        width: 100%;
        padding: 12px 45px 12px 15px;
        border: 2px solid #e9ecef;
        border-radius: 25px;
        font-size: 1rem;
        background: #f8f9fa;
    }
    
    .search-input-mobile .search-icon {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--color-gray);
        font-size: 1.1rem;
    }
    
    .filter-buttons-mobile {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .filter-btn-mobile {
        padding: 8px 15px;
        border: 1px solid #dee2e6;
        background: white;
        color: var(--color-dark);
        border-radius: 20px;
        font-size: 0.8rem;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .filter-btn-mobile.active {
        background: var(--color-primary);
        color: white;
        border-color: var(--color-primary);
    }
}

/* ===== LOADING STATES MOBILE ===== */
@media (max-width: 768px) {
    .loading-overlay-mobile {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(255, 255, 255, 0.9);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1070;
    }
    
    .loading-spinner-mobile {
        width: 50px;
        height: 50px;
        border: 4px solid #f3f3f3;
        border-top: 4px solid var(--color-primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
    
    .loading-text-mobile {
        margin-top: 15px;
        color: var(--color-dark);
        font-size: 0.9rem;
        text-align: center;
    }
    
    /* Skeleton Loading */
    .skeleton-mobile {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading 1.5s infinite;
        border-radius: 8px;
    }
    
    @keyframes loading {
        0% {
            background-position: 200% 0;
        }
        100% {
            background-position: -200% 0;
        }
    }
    
    .skeleton-text {
        height: 16px;
        margin-bottom: 8px;
    }
    
    .skeleton-title {
        height: 24px;
        margin-bottom: 12px;
        width: 70%;
    }
    
    .skeleton-avatar {
        width: 60px;
        height: 60px;
        border-radius: 50%;
    }
}

/* ===== TOUCH OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn-mobile {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 20px;
    }
    
    .form-control-mobile {
        min-height: 48px;
        padding: 12px 16px;
    }
    
    .nav-link-mobile {
        min-height: 48px;
        display: flex;
        align-items: center;
        padding: 12px 20px;
    }
    
    /* Remove hover effects on touch devices */
    .card:hover,
    .btn:hover,
    .menu-card:hover {
        transform: none;
        box-shadow: inherit;
    }
    
    /* Add active states for touch feedback */
    .btn:active {
        transform: scale(0.98);
    }
    
    .card:active {
        transform: scale(0.99);
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (max-width: 768px) {
    /* Focus indicators */
    .focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 2px;
    }
    
    /* High contrast mode support */
    @media (prefers-contrast: high) {
        .btn {
            border: 2px solid currentColor;
        }
        
        .card {
            border: 1px solid var(--color-dark);
        }
    }
    
    /* Reduced motion support */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
    
    /* Screen reader only content */
    .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    :root {
        --color-dark: #ffffff;
        --color-white: #1a1a1a;
        --color-cream: #2a2a2a;
        --color-blue-white: #1e1e1e;
        --color-light-gray: #3a3a3a;
        --color-gray: #cccccc;
    }
    
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .card,
    .form-mobile,
    .member-info-mobile,
    .admin-stat-card {
        background: #2a2a2a;
        color: #ffffff;
    }
    
    .navbar {
        background: #2a2a2a;
    }
    
    .footer {
        background: #0a0a0a;
    }
}

/* ===== PRINT STYLES MOBILE ===== */
@media print {
    .mobile-only,
    .btn,
    .navbar,
    .footer,
    .alert,
    .modal {
        display: none !important;
    }
    
    .container {
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
    
    .member-card-mobile {
        page-break-inside: avoid;
    }
}
