/**
 * Exchange API Connection Popup CSS
 * File: assets/css/exchange-popup.css
 * Version: 3.2 - Updated with fixes from documentation
 * Description: Styling for Exchange API connection popup and related components
 * PART 1: BASE STYLES & OVERLAY
 */

/* =============================================================================
   PART 1: BASE STYLES & OVERLAY
   ============================================================================= */

/* Reset and Base Styles */
.exchange-popup-overlay *,
.exchange-popup-overlay *::before,
.exchange-popup-overlay *::after {
    box-sizing: border-box;
}

/* Main Overlay */
.exchange-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999 !important;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: 20px;
}

.exchange-popup-overlay.active {
    display: flex;
    opacity: 1;
}

/* Popup Container */
.exchange-popup-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    animation: exchangePopupSlideIn 0.3s ease-out;
    z-index: 1000000 !important;
}

.exchange-popup-overlay.active .exchange-popup-container {
    transform: scale(1) translateY(0);
}

@keyframes exchangePopupSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Popup Content */
.exchange-popup-content {
    padding: 0;
    position: relative;
    overflow-y: auto;
    max-height: 90vh;
}

/* Close Button */
.exchange-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.2s ease;
    z-index: 1000001 !important;
    line-height: 1;
}

.exchange-popup-close:hover {
    background: #e9ecef;
    color: #495057;
    transform: scale(1.05);
}

.exchange-popup-close:active {
    transform: scale(0.95);
}

.exchange-popup-close:focus {
    outline: 2px solid #5865F2 !important;
    outline-offset: 2px !important;
}

/* Step Container */
.exchange-popup-step {
    padding: 40px;
    min-height: 400px;
    display: none;
    animation: stepFadeIn 0.3s ease-in-out;
}

.exchange-popup-step:first-child,
.exchange-popup-step.active {
    display: block;
}

@keyframes stepFadeIn {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Step Headers */
.exchange-popup-step h3 {
    margin: 0 0 24px 0;
    font-size: 24px;
    font-weight: 700;
    color: #212529;
    text-align: center;
    line-height: 1.3;
}

.exchange-popup-step h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}

.exchange-popup-step h5 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #6c757d;
}

/* Back Button */
.exchange-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    text-decoration: none;
}

.exchange-back-btn:hover {
    background: #e9ecef;
    color: #495057;
    border-color: #adb5bd;
    text-decoration: none;
}

.exchange-back-btn:active {
    transform: scale(0.98);
}

.exchange-back-btn:focus {
    outline: 2px solid #5865F2 !important;
    outline-offset: 2px !important;
}

.exchange-back-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

/* FIXED: Selected Exchange Info - BLACK BACKGROUND WHITE TEXT */
.exchange-selected-info {
    background: #000000 !important; /* Hitam solid */
    color: #ffffff !important; /* Tulisan putih */
    padding: 16px 20px !important;
    border-radius: 12px !important;
    margin-bottom: 24px !important;
    text-align: center !important;
    border: 1px solid #333333 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.exchange-selected-info strong {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
}

#selected-exchange-name {
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* Body overflow control when popup is open - PERBAIKAN FINAL */
body.exchange-popup-open {
    overflow: hidden !important;
    /* SEMUA properti di bawah ini dihapus untuk mencegah lompatan scroll */
    /* position: fixed; */
    /* height: 100vh; */
    /* width: 100%; */
}

/* Responsive Design */
@media (max-width: 768px) {
    .exchange-popup-overlay {
        padding: 10px;
    }
    
    .exchange-popup-container {
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .exchange-popup-step {
        padding: 24px 20px;
        min-height: auto;
    }
    
    .exchange-popup-step h3 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .exchange-popup-close {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .exchange-popup-step {
        padding: 20px 16px;
    }
    
    .exchange-popup-step h3 {
        font-size: 18px;
    }
}
/* =============================================================================
   PART 2: EXCHANGE SELECTION GRID
   ============================================================================= */

/* Exchange Selection Grid */
.exchange-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin: 24px 0;
    padding: 0;
}

/* Exchange Select Button */
.exchange-select-btn {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 16px;
    padding: 24px 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 120px;
    justify-content: center;
}

.exchange-select-btn:hover {
    border-color: #5865F2;
    transform: translateY(-4px);
    box-shadow: 
        0 12px 24px rgba(88, 101, 242, 0.15),
        0 4px 8px rgba(0, 0, 0, 0.1);
}

.exchange-select-btn:active {
    transform: translateY(-2px);
    transition: transform 0.1s ease;
}

.exchange-select-btn.selected {
    border-color: #5865F2;
    background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 
        0 8px 16px rgba(88, 101, 242, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

.exchange-select-btn:focus {
    outline: 2px solid #5865F2 !important;
    outline-offset: 2px !important;
}

/* Exchange Logo */
.exchange-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 auto;
    position: relative;
}

/* Exchange Logo Colors */
.exchange-select-btn[data-exchange="okx"] .exchange-logo {
    background: linear-gradient(135deg, #000000 0%, #333333 100%);
}

.exchange-select-btn[data-exchange="binance"] .exchange-logo {
    background: linear-gradient(135deg, #F3BA2F 0%, #F0B90B 100%);
    color: #000000;
}

.exchange-select-btn[data-exchange="bybit"] .exchange-logo {
    background: linear-gradient(135deg, #F7A600 0%, #FF6B35 100%);
}

.exchange-select-btn[data-exchange="bitget"] .exchange-logo {
    background: linear-gradient(135deg, #00D4FF 0%, #0099CC 100%);
}

.exchange-select-btn[data-exchange="coinex"] .exchange-logo {
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
}

/* Selected state logo colors */
.exchange-select-btn.selected .exchange-logo {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Exchange Name */
.exchange-name {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin: 0;
    line-height: 1.2;
}

.exchange-select-btn.selected .exchange-name {
    color: #ffffff;
}

/* Exchange Description */
.exchange-description {
    font-size: 12px;
    color: #6c757d;
    margin: 4px 0 0 0;
    line-height: 1.3;
    opacity: 0.8;
}

.exchange-select-btn.selected .exchange-description {
    color: rgba(255, 255, 255, 0.8);
}

/* Hover Effects */
.exchange-select-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 14px;
}

.exchange-select-btn:hover::before {
    opacity: 0.05;
}

.exchange-select-btn.selected::before {
    opacity: 0;
}

/* Selection Indicator */
.exchange-select-btn::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.exchange-select-btn.selected::after {
    opacity: 1;
    transform: scale(1);
}

/* Loading State */
.exchange-select-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.exchange-select-btn.loading .exchange-logo::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: exchangeButtonSpin 1s linear infinite;
}

@keyframes exchangeButtonSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Grid Responsive */
@media (max-width: 768px) {
    .exchange-selection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .exchange-select-btn {
        padding: 20px 12px;
        min-height: 100px;
    }
    
    .exchange-logo {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .exchange-name {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .exchange-selection-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .exchange-select-btn {
        flex-direction: row;
        text-align: left;
        padding: 16px;
        min-height: 80px;
        gap: 16px;
    }
    
    .exchange-logo {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }
    
    .exchange-info {
        flex: 1;
    }
}
/* =============================================================================
   PART 3: FORM COMPONENTS & SECURITY NOTICE
   ============================================================================= */

/* Form Styling */
#exchange-credentials-form {
    margin-top: 24px;
}

/* Form Group */
.exchange-form-group {
    margin-bottom: 20px;
    position: relative;
}

.exchange-form-group:last-child {
    margin-bottom: 0;
}

/* Form Labels */
.exchange-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    line-height: 1.4;
}

.exchange-form-group label::after {
    content: '*';
    color: #dc3545;
    margin-left: 4px;
    font-weight: 700;
}

.exchange-form-group label.optional::after {
    display: none;
}

/* Form Inputs */
.exchange-form-group input[type="text"],
.exchange-form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #495057;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.exchange-form-group input:focus {
    border-color: #5865F2;
    box-shadow: 
        0 0 0 3px rgba(88, 101, 242, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    outline: 2px solid #5865F2 !important;
    outline-offset: 2px !important;
}

.exchange-form-group input:hover:not(:focus) {
    border-color: #adb5bd;
}

.exchange-form-group input.error {
    border-color: #dc3545;
    box-shadow: 
        0 0 0 3px rgba(220, 53, 69, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

.exchange-form-group input.success {
    border-color: #28a745;
    box-shadow: 
        0 0 0 3px rgba(40, 167, 69, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Input Icons */
.exchange-form-group.has-icon {
    position: relative;
}

.exchange-form-group.has-icon input {
    padding-right: 48px;
}

.exchange-form-group .input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 16px;
    pointer-events: none;
    margin-top: 14px; /* Offset for label */
}

.exchange-form-group .input-icon.success {
    color: #28a745;
}

.exchange-form-group .input-icon.error {
    color: #dc3545;
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 14px; /* Offset for label */
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: #495057;
    background: rgba(0, 0, 0, 0.05);
}

/* Field Help Text */
.field-help {
    font-size: 12px;
    color: #6c757d;
    margin-top: 6px;
    line-height: 1.4;
}

.field-help.error {
    color: #dc3545;
}

.field-help.success {
    color: #28a745;
}

/* FIXED: Enhanced Security Notice - CLEAN AND ORGANIZED */
.exchange-security-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #fef8e1 100%) !important;
    border: 2px solid #ffc107 !important;
    border-radius: 12px !important;
    padding: 0 !important; /* Reset padding untuk kontrol penuh */
    margin: 24px 0 !important;
    position: relative !important;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15) !important;
    overflow: hidden !important;
}

/* Security Notice Content Container */
.security-notice-content {
    padding: 20px !important;
    position: relative !important;
}

/* Security Header */
.security-header {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid rgba(255, 193, 7, 0.3) !important;
}

.security-icon {
    font-size: 20px !important;
    line-height: 1 !important;
    display: block !important;
}

.security-header strong {
    color: #856404 !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}

/* Security List */
.security-list {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.security-list li {
    margin-bottom: 10px !important;
    color: #856404 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    padding-left: 20px !important;
    position: relative !important;
}

.security-list li::before {
    content: '•' !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    color: #d69e2e !important;
    font-weight: 900 !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
}

.security-list li:last-child {
    margin-bottom: 0 !important;
}

.security-list li strong {
    color: #744210 !important;
    font-weight: 700 !important;
}

/* Security Tip */
.security-tip {
    margin-top: 16px !important;
    padding-top: 12px !important;
    border-top: 1px solid rgba(255, 193, 7, 0.3) !important;
    font-style: italic !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #856404 !important;
    opacity: 0.9 !important;
    text-align: center !important;
}

/* HAPUS semua ::before pseudo-elements yang menyebabkan duplikasi */
.exchange-security-notice::before {
    display: none !important;
}

.exchange-security-notice p {
    display: none !important; /* Hide old paragraph structure */
}

.exchange-security-notice ul {
    display: none !important; /* Hide old ul structure */
}

/* Form Actions */
.exchange-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
}

/* Exchange Buttons */
.exchange-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    position: relative;
    overflow: hidden;
    min-height: 44px;
    line-height: 1.2;
}

.exchange-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.exchange-btn:focus {
    outline: 2px solid #5865F2 !important;
    outline-offset: 2px !important;
}

/* Primary Button */
.exchange-btn.primary {
    background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(88, 101, 242, 0.3);
}

.exchange-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(88, 101, 242, 0.4);
}

.exchange-btn.primary:active:not(:disabled) {
    transform: translateY(0);
}

/* Secondary Button */
.exchange-btn.secondary {
    background: #ffffff;
    color: #5865F2;
    border: 2px solid #5865F2;
}

.exchange-btn.secondary:hover:not(:disabled) {
    background: #5865F2;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(88, 101, 242, 0.3);
}

/* Small Button */
.exchange-btn.small {
    padding: 8px 16px;
    font-size: 12px;
    min-height: 36px;
}

/* Button Loading State */
.exchange-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.exchange-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: exchangeButtonSpin 1s linear infinite;
    margin-left: 8px;
}

/* Button Icons */
.exchange-btn .icon {
    font-size: 16px;
    line-height: 1;
}

.exchange-btn.small .icon {
    font-size: 14px;
}

/* Responsive Security Notice */
@media (max-width: 768px) {
    .security-notice-content {
        padding: 16px !important;
    }
    
    .security-header {
        gap: 8px !important;
        margin-bottom: 14px !important;
    }
    
    .security-header strong {
        font-size: 14px !important;
    }
    
    .security-list li {
        font-size: 13px !important;
        padding-left: 18px !important;
        margin-bottom: 8px !important;
    }
    
    .security-tip {
        font-size: 12px !important;
        margin-top: 14px !important;
        padding-top: 10px !important;
    }
}

@media (max-width: 480px) {
    .security-notice-content {
        padding: 14px !important;
    }
    
    .security-icon {
        font-size: 18px !important;
    }
    
    .security-header strong {
        font-size: 13px !important;
    }
    
    .security-list li {
        font-size: 12px !important;
        padding-left: 16px !important;
        margin-bottom: 6px !important;
    }
    
    .security-tip {
        font-size: 11px !important;
        margin-top: 12px !important;
        padding-top: 8px !important;
    }
    
    .exchange-form-actions {
        flex-direction: column;
    }
    
    .exchange-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 16px;
        min-height: 48px;
    }
    
    .exchange-form-group input {
        padding: 10px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}
/* =============================================================================
   PART 4: SUCCESS STATE & INFO DISPLAY
   ============================================================================= */

/* Success Step Styling */
.exchange-success-info {
    text-align: center;
    padding: 32px 0;
}

.exchange-success-info p {
    font-size: 16px;
    color: #495057;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.exchange-success-info p:first-child {
    font-size: 18px;
    font-weight: 600;
    color: #28a745;
    margin-bottom: 20px;
}

#connected-exchange-name {
    color: #5865F2;
    font-weight: 700;
}

/* Connection Status Indicators */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin: 16px 0;
}

.connection-status.connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.connection-status.disconnected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.connection-status.testing {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.connection-status .status-icon {
    font-size: 16px;
}

/* Exchange Info Section (for member info shortcode) */
.exchange-info-section {
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f3ff 100%);
    border: 2px solid #3498db;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.exchange-info-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
}

.exchange-info-section h4 {
    margin: 0 0 16px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exchange-info-section h4::before {
    content: '🔗';
    font-size: 16px;
}

.exchange-info-section h5 {
    margin: 16px 0 8px 0;
    color: #34495e;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Exchange Connection Status */
.exchange-connection-status {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.exchange-connection-status p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.exchange-connection-status p:last-child {
    margin-bottom: 0;
}

.exchange-connection-status strong {
    color: #2c3e50;
    font-weight: 600;
}

.exchange-connection-status .exchange-name {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exchange-connection-status .status-connected {
    color: #27ae60;
    font-weight: 600;
}

.exchange-connection-status .last-sync {
    color: #7f8c8d;
    font-style: italic;
}

/* Balance Info */
.balance-info {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
}

.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    font-size: 13px;
}

.balance-item.total {
    font-weight: 700;
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    grid-column: 1 / -1;
}

.balance-label {
    color: #7f8c8d;
    font-weight: 500;
}

.balance-item.total .balance-label {
    color: rgba(255, 255, 255, 0.9);
}

.balance-value {
    font-weight: 600;
    color: #2c3e50;
}

.balance-item.total .balance-value {
    color: white;
    font-size: 14px;
}

/* Volume Info */
.volume-info {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    border-left: 4px solid #3498db;
}

.volume-breakdown {
    margin: 12px 0;
}

.volume-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(52, 152, 219, 0.1);
}

.volume-item:last-child {
    border-bottom: none;
}

.volume-item.total {
    font-weight: 700;
    font-size: 15px;
    border-top: 2px solid #3498db;
    padding-top: 12px;
    margin-top: 8px;
    color: #2c3e50;
}

.volume-label {
    color: #7f8c8d;
    font-weight: 500;
}

.volume-item.total .volume-label {
    color: #2c3e50;
}

.volume-value {
    font-weight: 600;
    color: #2c3e50;
    font-family: 'Courier New', monospace;
}

/* Volume Status */
.volume-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid rgba(52, 152, 219, 0.2);
    flex-wrap: wrap;
    gap: 12px;
}

.requirement-info {
    flex: 1;
    min-width: 120px;
}

.requirement-label {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 500;
    display: block;
}

.requirement-value {
    font-size: 14px;
    font-weight: 700;
    color: #e67e22;
    font-family: 'Courier New', monospace;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.status-indicator.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-indicator.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-indicator.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Action Buttons in Info Section */
.exchange-info-section .exchange-btn {
    margin: 8px 8px 0 0;
}

/* Change CEX Form Styling - TAMBAHAN DARI DOKUMENTASI */
#change-cex-form {
    margin-top: 20px !important;
}

#change-cex-form .exchange-selection-radios {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
    margin: 20px 0 !important;
}

#change-cex-form .exchange-radio-option {
    display: flex !important;
    align-items: center !important;
    padding: 12px 16px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

#change-cex-form .exchange-radio-option:hover {
    border-color: #1B8464 !important;
    background-color: #f0fff4 !important;
}

#change-cex-form .exchange-radio-option input[type="radio"] {
    margin-right: 8px !important;
    accent-color: #1B8464 !important;
}

#change-cex-form .exchange-radio-option input[type="radio"]:checked + label {
    color: #1B8464 !important;
    font-weight: 600 !important;
}

#change-cex-form .exchange-radio-option.selected {
    border-color: #1B8464 !important;
    background-color: #e8f5e8 !important;
}

#change-cex-uid {
    width: 100% !important;
    padding: 12px 16px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    margin-bottom: 15px !important;
}

#change-cex-uid:focus {
    border-color: #1B8464 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(27, 132, 100, 0.1) !important;
}

/* Update button text pricing secara dynamic */
.instant-price-display {
    font-weight: 600 !important;
    color: #1B8464 !important;
}

/* Responsive Volume Info */
@media (max-width: 768px) {
    .balance-grid {
        grid-template-columns: 1fr;
    }
    
    .volume-status {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .requirement-info {
        text-align: center;
        margin-bottom: 8px;
    }
    
    .status-indicator {
        justify-content: center;
    }
    
    .exchange-info-section {
        padding: 16px;
        margin: 16px 0;
    }
}

@media (max-width: 480px) {
    .exchange-info-section {
        padding: 16px;
        margin: 16px 0;
    }
    
    .volume-item {
        font-size: 13px;
    }
    
    .volume-item.total {
        font-size: 14px;
    }
    
    .exchange-success-info {
        padding: 24px 0;
    }
    
    .exchange-success-info p {
        font-size: 15px;
    }
    
    .exchange-success-info p:first-child {
        font-size: 17px;
    }
}
/* =============================================================================
   PART 5: UTILITIES, STATES & ADDITIONAL FEATURES
   ============================================================================= */

/* Loading States */
.exchange-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.exchange-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(88, 101, 242, 0.3);
    border-top: 3px solid #5865F2;
    border-radius: 50%;
    animation: exchangeSpinner 1s linear infinite;
    z-index: 10;
}

@keyframes exchangeSpinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Full Page Loading Overlay */
.exchange-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.exchange-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.exchange-loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(88, 101, 242, 0.3);
    border-top: 4px solid #5865F2;
    border-radius: 50%;
    animation: exchangeSpinner 1s linear infinite;
    margin-bottom: 16px;
}

.exchange-loading-overlay .loading-text {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    text-align: center;
}

/* Error States */
.exchange-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.4;
}

.exchange-error strong {
    font-weight: 600;
}

.exchange-error .error-details {
    margin-top: 8px;
    font-size: 13px;
    opacity: 0.8;
}

/* Success Messages */
.exchange-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Warning Messages */
.exchange-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Info Messages */
.exchange-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Message Icons */
.exchange-error::before,
.exchange-success::before,
.exchange-warning::before,
.exchange-info::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: text-top;
    background-size: contain;
    background-repeat: no-repeat;
}

.exchange-error::before {
    content: '❌';
}

.exchange-success::before {
    content: '✅';
}

.exchange-warning::before {
    content: '⚠️';
}

.exchange-info::before {
    content: 'ℹ️';
}

/* Tooltips */
.exchange-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.exchange-tooltip .tooltip-text {
    visibility: hidden;
    width: 240px;
    background: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.4;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -120px;
    opacity: 0;
    transition: opacity 0.3s;
}

.exchange-tooltip .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.exchange-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Progress Indicators */
.exchange-progress {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin: 12px 0;
}

.exchange-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #5865F2 0%, #4752C4 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
    position: relative;
}

.exchange-progress-bar.animated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Dividers */
.exchange-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e9ecef 50%, transparent 100%);
    margin: 24px 0;
}

.exchange-divider.thick {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #dee2e6 50%, transparent 100%);
}

/* Badges */
.exchange-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exchange-badge.connected {
    background: #d4edda;
    color: #155724;
}

.exchange-badge.disconnected {
    background: #f8d7da;
    color: #721c24;
}

.exchange-badge.testing {
    background: #fff3cd;
    color: #856404;
}

/* Animations */
@keyframes exchangeFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes exchangeSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes exchangePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Utility Classes */
.exchange-fade-in {
    animation: exchangeFadeIn 0.5s ease-out;
}

.exchange-slide-in {
    animation: exchangeSlideIn 0.5s ease-out;
}

.exchange-pulse {
    animation: exchangePulse 2s infinite;
}

.exchange-hidden {
    display: none !important;
}

.exchange-invisible {
    visibility: hidden;
    opacity: 0;
}

.exchange-text-center {
    text-align: center;
}

.exchange-text-left {
    text-align: left;
}

.exchange-text-right {
    text-align: right;
}

.exchange-mb-0 { margin-bottom: 0 !important; }
.exchange-mb-8 { margin-bottom: 8px !important; }
.exchange-mb-16 { margin-bottom: 16px !important; }
.exchange-mb-24 { margin-bottom: 24px !important; }

.exchange-mt-0 { margin-top: 0 !important; }
.exchange-mt-8 { margin-top: 8px !important; }
.exchange-mt-16 { margin-top: 16px !important; }
.exchange-mt-24 { margin-top: 24px !important; }

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .exchange-popup-container {
        background: #2b2d31;
        color: #ffffff;
    }
    
    .exchange-popup-step h3,
    .exchange-popup-step h4,
    .exchange-popup-step h5 {
        color: #ffffff;
    }
    
    .exchange-form-group input {
        background: #383a40;
        border-color: #4f545c;
        color: #ffffff;
    }
    
    .exchange-form-group input:focus {
        border-color: #5865F2;
        background: #404249;
    }
    
    .exchange-select-btn {
        background: #383a40;
        border-color: #4f545c;
        color: #ffffff;
    }
    
    .exchange-select-btn:hover {
        background: #404249;
    }
    
    .exchange-info-section {
        background: #2b2d31;
        border-color: #4f545c;
    }
}

/* Print Styles */
@media print {
    .exchange-popup-overlay {
        display: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .exchange-popup-container {
        border: 2px solid #000000;
    }
    
    .exchange-btn.primary {
        background: #000000;
        border: 2px solid #000000;
    }
    
    .exchange-select-btn {
        border-width: 2px;
    }
    
    .exchange-form-group input {
        border-width: 2px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .exchange-popup-overlay,
    .exchange-popup-container,
    .exchange-btn,
    .exchange-select-btn,
    .exchange-form-group input {
        transition: none;
        animation: none;
    }
    
    .exchange-loading::after,
    .exchange-loading-overlay .spinner {
        animation: none;
        border: 3px solid #5865F2;
    }
}

/* Enhanced focus states for accessibility */
.exchange-select-btn:focus,
.exchange-btn:focus,
.exchange-form-group input:focus {
    outline: 2px solid #5865F2 !important;
    outline-offset: 2px !important;
}

/* PERBAIKAN TAMBAHAN DARI DOKUMENTASI */

/* Force cleanup body overflow - CRITICAL FIX */
body.exchange-popup-open {
    overflow: hidden !important;
    /* Properti 'position: fixed' dan lainnya dihapus */
}

/* Ensure popup layering is correct */
.exchange-popup-overlay {
    z-index: 999999 !important;
}

.exchange-popup-container {
    z-index: 1000000 !important;
}

.exchange-popup-close {
    z-index: 1000001 !important;
}

/* Enhanced button and input focus for accessibility */
.exchange-btn:focus,
.exchange-select-btn:focus,
.exchange-form-group input:focus,
.exchange-back-btn:focus,
.exchange-popup-close:focus {
    outline: 2px solid #5865F2 !important;
    outline-offset: 2px !important;
}

/* Additional button loading animation fix */
.exchange-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: exchangeButtonSpin 1s linear infinite;
    margin-left: 8px;
}

/* Ensure all animations use consistent keyframes */
@keyframes exchangeButtonSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}


/* =============================================================================
   PERBAIKAN KRITIS: Memastikan Overlay & Body Reset
   ============================================================================= */

/* Pastikan body kembali normal saat popup tidak aktif */
body:not(.exchange-popup-open) {
    overflow: auto !important;
    position: static !important;
    height: auto !important;
    width: auto !important;
}

/* Aturan yang lebih kuat untuk menyembunyikan overlay saat tidak aktif */
.exchange-popup-overlay:not(.active) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important; /* Mencegah klik pada overlay transparan */
}

/* Aturan untuk menampilkan overlay saat aktif */
.exchange-popup-overlay.active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: all !important;
}


/* End of exchange-popup.css */