/**
 * BMW Responsive Overrides
 * 
 * Target specific mobile issues across all MLM frontend pages.
 */

/* Global Mobile Fixes */
@media (max-width: 768px) {
    .container, .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
        overflow-x: hidden;
    }

    /* Tap Target Optimization */
    button, 
    .btn, 
    a.btn, 
    input[type="submit"],
    .bmw-action-card-new,
    .bmw-tab-button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Form Optimizations */
    .bmw-form-group {
        margin-bottom: 20px !important;
    }

    .bmw-form-label {
        display: block !important;
        font-weight: 700;
        margin-bottom: 8px;
        color: #1e293b;
        font-size: 14px;
    }

    .input-group-text {
        padding: 10px 15px !important;
    }

    /* Table Responsiveness */
    .bmw-data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .bmw-data-table {
        min-width: 600px; /* Force scroll for readable columns */
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    h1 { font-size: 1.8rem !important; }
    h2 { font-size: 1.5rem !important; }
    
    .bmw-stat-card-new {
        margin-bottom: 15px;
    }
    
    .bmw-stat-value {
        font-size: 24px !important;
    }
}

/* Forsa Ratib Widget Styles */
.bmw-forsa-ratib-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 20px;
    padding: 25px;
    color: white;
    margin-bottom: 30px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

.bmw-ratib-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.bmw-ratib-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.5px;
}

.bmw-ratib-title i {
    color: #fbbf24;
    margin-right: 10px;
}

.bmw-ratib-subtitle {
    margin: 5px 0 0 0;
    color: #94a3b8;
    font-size: 14px;
}

.bmw-ratib-status-badge {
    padding: 6px 15px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-verified_member { background: #10b981; }
.status-pending_admin { background: #f59e0b; }
.status-not_qualified { background: #64748b; }

.bmw-ratib-progress-container {
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 15px;
}

.bmw-ratib-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
}

.bmw-ratib-progress-value {
    color: #fbbf24;
}

.bmw-ratib-progress-bar-bg {
    width: 100%;
    height: 100px;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    overflow: hidden;
}

.bmw-ratib-progress-fill {
    height: 100%;
    background: #fbbf24;
    box-shadow: 0 0 10px rgba(251,191,36,0.5);
    transition: width 1s ease;
}

.bmw-ratib-info-text {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 12px;
}

.bmw-ratib-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.bmw-ratib-stat-item {
    background: rgba(255,255,255,0.05);
    padding: 18px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.1);
}

.bmw-ratib-stat-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.bmw-ratib-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: #f8fafc;
}

.bmw-ratib-stat-target {
    font-size: 12px;
    color: #64748b;
}

.bmw-ratib-stat-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.bmw-ratib-stat-bar-fill {
    height: 100%;
    transition: width 1s ease;
}

.fill-direct { background: #38bdf8; }
.fill-network { background: #10b981; }

.bmw-ratib-bonus-alert {
    margin-top: 15px;
    background: rgba(251,191,36,0.1);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(251,191,36,0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bmw-ratib-bonus-label {
    font-size: 13px;
    color: #fde047;
    font-weight: 600;
}

.bmw-ratib-bonus-value {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

/* Mobile Forsa Ratib */
@media (max-width: 600px) {
    .bmw-ratib-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .bmw-ratib-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .bmw-ratib-bonus-alert {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Genealogy Responsiveness */
.bmw-genealogy-container {
    background: #fff;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.bmw-genealogy-actions-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.bmw-genealogy-actions-wrapper .btn-action {
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.bmw-genealogy-actions-wrapper .btn-action:hover {
    background: #1e3a8a !important;
    color: #fff !important;
    border-color: #1e3a8a !important;
}

.bmw-genealogy-actions-wrapper .btn-back {
    width: auto;
    padding: 0 15px;
    margin-left: auto;
}

.bmw-genealogy-chart-viewport {
    width: 100%;
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* Mobile Genealogy Fixes */
@media (max-width: 768px) {
    .bmw-genealogy-actions-wrapper {
        justify-content: center;
    }
    
    .bmw-genealogy-actions-wrapper .btn-back {
        margin-left: 0;
        width: 100%;
        order: -1; /* Move back button to top on mobile */
    }
    
    .btn-text {
        display: none; /* Hide 'Back' text on mobile to save space */
    }
    
    .user-search-box {
        width: 90% !important;
        left: 5% !important;
        top: 80px !important;
    }
    
    .search-input {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
}

/* COI Dashboard Mobile Fixes */
@media (max-width: 768px) {
    .bmw-coi-gauges {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .bmw-coi-gauge {
        width: 140px !important;
        height: 140px !important;
    }
    
    .bmw-coi-gauge-value {
        font-size: 1.6rem !important;
    }
    
    .bmw-coi-tab-button {
        padding: 10px 15px !important;
        font-size: 0.9rem !important;
    }
}

/* Payment Order Form Mobile Fixes */
@media (max-width: 768px) {
    .bmw-payment-order-form .row > [class*="col-"] {
        margin-bottom: 15px;
    }
    
    .payment-method-info {
        border-left: none !important;
        border-top: 5px solid var(--bmw-primary);
        border-radius: var(--bmw-radius-lg) !important;
    }
}

/* Add New Partner Wizard Mobile Fixes */
@media (max-width: 576px) {
    .wizard-steps .step {
        padding: 0 5px !important;
    }
    
    .wizard-steps .step-number {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
    }
    
    .wizard-steps .step-label {
        display: none; /* Hide labels on very small screens to prevent overlap */
    }
    
    .wizard-steps .step.active .step-label {
        display: block; /* Only show active step label */
        position: absolute;
        width: 200%;
        left: -50%;
        top: 40px;
    }
}

/* Global Form Row Fix */
.bmw-form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

@media (max-width: 768px) {
    .bmw-form-row > [class*="col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}
