/* Global Container */
.mt4lg-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    margin: 20px 0;
}

/* Header & Controls */
.rdmt4-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.mt4lg-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    flex-wrap: wrap; 
}

.mt4lg-input {
    padding: 10px;
    width: 100%; 
    min-width: 250px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    flex: 1;
}

/* Stats Bar (Desktop Default) */
#mt4lg-stats-bar {
    background: #f8f9fa;
    padding: 10px 15px;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 14px;
    color: #444;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.stat-num {
    font-weight: bold;
    color: #0073aa;
    margin-left: 2px;
}

.stat-divider { color: #ccc; }

/* Result Card */
.mt4lg-card {
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
}

.mt4lg-card h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Grid Layouts */
.mt4lg-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.mt4lg-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

/* Info Items */
.mt4lg-item {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px; 
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.mt4lg-item:hover {
    background: #f0f7fc;
    border-color: #0073aa;
}

.mt4lg-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
    margin-bottom: 4px;
}

.mt4lg-item span {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    word-break: break-all;
}

/* Level 2 Status Box */
.mt4lg-level2-box {
    background-color: #fffbef !important; 
    border: 1px solid #e6dbb9 !important; 
}
.mt4lg-level2-box:hover {
    background-color: #fffbef !important;
    border-color: #e6dbb9 !important;
    cursor: default;
}

.mt4lg-level2-box label {
    color: #b58500 !important; 
}

.mt4lg-badge-joined {
    color: #155724; 
    font-weight: bold;
    font-size: 14px;
}

.mt4lg-badge-not-joined {
    color: #0c3e6d;
    font-style: italic;
    font-weight: 600;
    font-size: 14px;
}

/* Sections (VPS/MT4) */
.mt4lg-full-row {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #ccc;
}

#res-vps-box { border-left-color: #2196F3; }
#res-mt4-box { border-left-color: #4CAF50; }
#res-payment-box { border-left-color: #607d8b; }

.mt4lg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.mt4lg-header h5 {
    margin: 0;
    font-size: 15px;
    color: #555;
    font-weight: 600;
}

/* Payment Header Toggle */
.mt4lg-toggle-header {
    cursor: pointer;
}
.mt4lg-toggle-header:hover h5 {
    color: #0073aa;
}
.mt4lg-toggle-icon {
    transition: transform 0.3s ease;
    font-size: 18px;
    color: #888;
}
.mt4lg-toggle-icon.open {
    transform: rotate(180deg);
}

/* Expiry Tags */
.mt4lg-expiry-tag { font-weight: bold; color: #2e7d32; }
.mt4lg-expiry-tag.expired { color: #d63638; }

/* Icon Buttons */
.mt4lg-actions {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    align-items: center;
}

.mt4lg-icon-btn {
    background: #f0f0f1;
    border: 1px solid #ccc;
    color: #333;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
}

.mt4lg-icon-btn:hover {
    background: #e5e5e5;
    border-color: #999;
    color: #000;
}

.mt4lg-icon-btn.btn-vps {
    color: #2271b1;
    border-color: #2271b1;
    background: #f6f7f7;
}
.mt4lg-icon-btn.btn-vps:hover {
    background: #f0f0f1;
    color: #135e96;
}

.mt4lg-icon-btn span {
    font-size: 16px;
    line-height: 1;
}

/* Text Buttons (Edit, etc.) */
.btn-edit {
    width: auto !important;
    padding: 0 10px !important;
    font-size: 13px !important;
    color: #d63638 !important; 
    border: 1px solid transparent !important;
    background: transparent !important;
}
.btn-edit:hover {
    background: #f0f0f1 !important;
    border-color: #d63638 !important;
}

.button-primary {
    background-color: #2271b1;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.button-primary:hover { background-color: #135e96; }

.button-small {
    padding: 4px 8px;
    font-size: 12px;
    height: 32px; 
    line-height: 22px;
    box-sizing: border-box;
}

.button-secondary {
    background: #f6f7f7;
    color: #2271b1;
    border: 1px solid #2271b1;
    border-radius: 4px;
    cursor: pointer;
}
.button-secondary:hover {
    background: #f0f0f1;
    color: #135e96;
    border-color: #135e96;
}

/* Modal */
.mt4lg-modal { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
.mt4lg-modal-content { background: #fff; margin: 10% auto; padding: 25px; width: 90%; max-width: 500px; border-radius: 8px; position: relative; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.mt4lg-close { float: right; font-size: 24px; cursor: pointer; color: #999; }
.mt4lg-close:hover { color: #333; }
.mt4lg-input-small { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; margin-top: 5px; }
.mt4lg-form-group { margin-bottom: 15px; }

/* Autocomplete */
.ui-autocomplete.mt4lg-autocomplete-list {
    background: white; border: 1px solid #ccc; max-height: 250px; overflow-y: auto; overflow-x: hidden;
    z-index: 99999; padding: 0; margin: 0; list-style: none; width: 100%; box-sizing: border-box;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.ui-menu-item.mt4lg-autocomplete-item { padding: 10px 15px; cursor: pointer; font-size: 14px; color: #333; border-bottom: 1px solid #f0f0f0; }
.ui-state-active { background-color: #f1f3f5 !important; border: none !important; margin: 0 !important; color: #000 !important; }

/* Table for Payment History */
.mt4lg-table-responsive { overflow-x: auto; width: 100%; }
.mt4lg-table { width: 100%; border-collapse: collapse; min-width: 600px; font-size: 13px; }
.mt4lg-table th, .mt4lg-table td { text-align: left; padding: 10px; border-bottom: 1px solid #eee; vertical-align: middle; }
.mt4lg-table th { background: #f8f9fa; font-weight: 600; color: #555; }
.mt4lg-table tr:hover td { background: #fcfcfc; }

/* =========================================
   MOBILE RESPONSIVE STYLES
   ========================================= */
@media (max-width: 600px) {
    /* Main Container Reset */
    .mt4lg-container { 
        padding: 15px; 
        margin: 10px 0; 
        border-radius: 0; 
        box-shadow: none; 
        width: auto;
    }

    /* 1. Header & Title */
    .rdmt4-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .rdmt4-header h3 {
        width: 100%;
        margin-bottom: 0;
        font-size: 18px;
    }

    /* 2. Stats Bar - Transformed into Cards/Pills */
    #mt4lg-stats-bar { 
        width: 100%;
        display: flex;
        flex-direction: column; /* Stack the stats vertically */
        gap: 10px;
        background: transparent; /* Remove gray background */
        border: none;
        padding: 0;
    }

    /* Style the individual stat spans as Cards */
    #mt4lg-stats-bar > span:not(.stat-divider) {
        background: #f8f9fa;
        border: 1px solid #e0e0e0;
        padding: 12px 15px;
        border-radius: 6px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
        font-weight: 500;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    /* Hide the vertical dividers (|) on mobile */
    .stat-divider { display: none !important; }

    /* 3. Search Controls (Full Width) */
    .mt4lg-controls { 
        flex-direction: column;
        align-items: stretch; 
        gap: 10px;
    }

    .mt4lg-input { 
        width: 100%; 
        min-width: 0; 
        box-sizing: border-box;
        height: 42px; /* Touch friendly height */
    }

    #mt4lg-search-btn {
        width: 100%;
        justify-content: center;
        height: 42px; /* Match input height */
    }

    /* Grid & Layout Resets */
    .mt4lg-grid-3, .mt4lg-grid-2 { grid-template-columns: 1fr; }
    
    .mt4lg-actions { 
        justify-content: flex-start; 
        flex-wrap: wrap; 
    }
    
    .mt4lg-modal-content { 
        width: 90%; 
        margin: 30% auto; 
    }
}