/**
 * 3DXplore MLM System - Enhanced User Interface Styles
 * Version: 2.1.0
 * 
 * A modern, professional UI design for the MLM dashboard
 * Includes: responsive layout, status badges, card components, form styling
 */

/* ============================================================================
   CSS VARIABLES - Design System
   ============================================================================ */

:root {
    /* Primary Colors */
    --tdx-primary: #2563eb;
    --tdx-primary-hover: #1d4ed8;
    --tdx-primary-light: #dbeafe;
    --tdx-primary-dark: #1e40af;
    
    /* Secondary Colors */
    --tdx-secondary: #64748b;
    --tdx-secondary-hover: #475569;
    
    /* Status Colors */
    --tdx-success: #10b981;
    --tdx-success-light: #d1fae5;
    --tdx-success-dark: #059669;
    
    --tdx-warning: #f59e0b;
    --tdx-warning-light: #fef3c7;
    --tdx-warning-dark: #d97706;
    
    --tdx-danger: #ef4444;
    --tdx-danger-light: #fee2e2;
    --tdx-danger-dark: #dc2626;
    
    --tdx-info: #3b82f6;
    --tdx-info-light: #dbeafe;
    
    /* Neutral Colors */
    --tdx-gray-50: #f8fafc;
    --tdx-gray-100: #f1f5f9;
    --tdx-gray-200: #e2e8f0;
    --tdx-gray-300: #cbd5e1;
    --tdx-gray-400: #94a3b8;
    --tdx-gray-500: #64748b;
    --tdx-gray-600: #475569;
    --tdx-gray-700: #334155;
    --tdx-gray-800: #1e293b;
    --tdx-gray-900: #0f172a;
    
    /* Typography */
    --tdx-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --tdx-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
    
    /* Spacing */
    --tdx-space-1: 0.25rem;
    --tdx-space-2: 0.5rem;
    --tdx-space-3: 0.75rem;
    --tdx-space-4: 1rem;
    --tdx-space-5: 1.25rem;
    --tdx-space-6: 1.5rem;
    --tdx-space-8: 2rem;
    
    /* Border Radius */
    --tdx-radius-sm: 0.25rem;
    --tdx-radius-md: 0.375rem;
    --tdx-radius-lg: 0.5rem;
    --tdx-radius-xl: 0.75rem;
    --tdx-radius-full: 9999px;
    
    /* Shadows */
    --tdx-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --tdx-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --tdx-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --tdx-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --tdx-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

.threedx-dashboard,
.three-dx-dashboard,
.threeDX-auth {
    font-family: var(--tdx-font-sans);
    color: var(--tdx-gray-800);
    line-height: 1.5;
}

/* ============================================================================
   CARD COMPONENT
   ============================================================================ */

.threedx-card,
.three-dx-dashboard .card,
.three-dx-licenses .card,
.three-dx-team-bonus .card {
    background: #fff;
    border: 1px solid var(--tdx-gray-200);
    border-radius: var(--tdx-radius-xl);
    padding: var(--tdx-space-5);
    box-shadow: var(--tdx-shadow-sm);
    transition: box-shadow var(--tdx-transition), transform var(--tdx-transition);
}

.threedx-card:hover,
.three-dx-dashboard .card:hover {
    box-shadow: var(--tdx-shadow-md);
}

.threedx-card h3,
.three-dx-dashboard .card h3 {
    margin: 0 0 var(--tdx-space-3);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--tdx-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.threedx-card .threedx-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--tdx-gray-900);
    line-height: 1.2;
}

.threedx-card .threedx-value.positive {
    color: var(--tdx-success);
}

.threedx-card .threedx-value.negative {
    color: var(--tdx-danger);
}

/* Card Grid */
.threedx-cards,
.three-dx-dashboard .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--tdx-space-4);
    margin-bottom: var(--tdx-space-6);
}

/* Stat Cards */
.threedx-stat-card {
    display: flex;
    align-items: flex-start;
    gap: var(--tdx-space-4);
}

.threedx-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--tdx-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.threedx-stat-icon.blue { background: var(--tdx-info-light); color: var(--tdx-primary); }
.threedx-stat-icon.green { background: var(--tdx-success-light); color: var(--tdx-success); }
.threedx-stat-icon.yellow { background: var(--tdx-warning-light); color: var(--tdx-warning-dark); }
.threedx-stat-icon.red { background: var(--tdx-danger-light); color: var(--tdx-danger); }

/* ============================================================================
   TAB NAVIGATION
   ============================================================================ */

.threedx-dashboard .nav-tab-wrapper,
.nav-tab-wrapper.threedx-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tdx-space-1);
    margin-bottom: var(--tdx-space-5);
    border-bottom: 2px solid var(--tdx-gray-200);
    padding-bottom: 0;
}

.threedx-dashboard .nav-tab,
.nav-tab-wrapper.threedx-tabs .nav-tab {
    padding: var(--tdx-space-3) var(--tdx-space-4);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tdx-gray-600);
    text-decoration: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    transition: color var(--tdx-transition), border-color var(--tdx-transition);
    cursor: pointer;
}

.threedx-dashboard .nav-tab:hover,
.nav-tab-wrapper.threedx-tabs .nav-tab:hover {
    color: var(--tdx-primary);
}

.threedx-dashboard .nav-tab-active,
.nav-tab-wrapper.threedx-tabs .nav-tab.active {
    color: var(--tdx-primary);
    border-bottom-color: var(--tdx-primary);
    background: transparent;
}

.threedx-tab-panel {
    background: #fff;
    border: 1px solid var(--tdx-gray-200);
    border-radius: var(--tdx-radius-lg);
    padding: var(--tdx-space-5);
}

/* ============================================================================
   TABLES
   ============================================================================ */

.threedx-table,
.threeDX-table,
table.widefat {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.threedx-table thead th,
.threeDX-table thead th,
table.widefat thead th {
    background: var(--tdx-gray-50);
    color: var(--tdx-gray-700);
    font-weight: 600;
    text-align: left;
    padding: var(--tdx-space-3) var(--tdx-space-4);
    border-bottom: 2px solid var(--tdx-gray-200);
    white-space: nowrap;
}

.threedx-table tbody td,
.threeDX-table tbody td,
table.widefat tbody td {
    padding: var(--tdx-space-3) var(--tdx-space-4);
    border-bottom: 1px solid var(--tdx-gray-100);
    vertical-align: middle;
}

.threedx-table tbody tr:hover,
.threeDX-table tbody tr:hover,
table.widefat tbody tr:hover {
    background: var(--tdx-gray-50);
}

.threedx-table tbody tr:last-child td,
.threeDX-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive Table */
@media (max-width: 768px) {
    .threedx-table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .threedx-table,
    .threeDX-table {
        min-width: 600px;
    }
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */

.threedx-badge,
.tdx-status {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--tdx-radius-full);
    text-transform: capitalize;
}

.threedx-badge-pending,
.tdx-status-pending {
    background: var(--tdx-warning-light);
    color: var(--tdx-warning-dark);
}

.threedx-badge-active,
.threedx-badge-approved,
.threedx-badge-completed,
.threedx-badge-running,
.tdx-status-active,
.tdx-status-approved,
.tdx-status-completed {
    background: var(--tdx-success-light);
    color: var(--tdx-success-dark);
}

.threedx-badge-rejected,
.threedx-badge-cancelled,
.threedx-badge-expired,
.tdx-status-rejected,
.tdx-status-cancelled,
.tdx-status-expired {
    background: var(--tdx-danger-light);
    color: var(--tdx-danger-dark);
}

.threedx-badge-inactive,
.tdx-status-inactive {
    background: var(--tdx-gray-100);
    color: var(--tdx-gray-600);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.threedx-btn,
.button.threedx-btn,
.three-dx-deposit button,
.three-dx-withdrawal button,
.threeDX-auth button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tdx-space-2);
    padding: var(--tdx-space-2) var(--tdx-space-4);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--tdx-radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--tdx-transition);
    text-decoration: none;
    line-height: 1.5;
}

.threedx-btn-primary,
.button-primary.threedx-btn,
button.button-primary {
    background: var(--tdx-primary);
    color: #fff;
    border-color: var(--tdx-primary);
}

.threedx-btn-primary:hover,
.button-primary.threedx-btn:hover,
button.button-primary:hover {
    background: var(--tdx-primary-hover);
    border-color: var(--tdx-primary-hover);
}

.threedx-btn-secondary,
.button.threedx-btn:not(.button-primary) {
    background: #fff;
    color: var(--tdx-gray-700);
    border-color: var(--tdx-gray-300);
}

.threedx-btn-secondary:hover,
.button.threedx-btn:not(.button-primary):hover {
    background: var(--tdx-gray-50);
    border-color: var(--tdx-gray-400);
}

.threedx-btn-danger {
    background: var(--tdx-danger);
    color: #fff;
    border-color: var(--tdx-danger);
}

.threedx-btn-danger:hover {
    background: var(--tdx-danger-dark);
    border-color: var(--tdx-danger-dark);
}

.threedx-btn:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button Sizes */
.threedx-btn-sm {
    padding: var(--tdx-space-1) var(--tdx-space-3);
    font-size: 0.75rem;
}

.threedx-btn-lg {
    padding: var(--tdx-space-3) var(--tdx-space-6);
    font-size: 1rem;
}

/* ============================================================================
   FORMS
   ============================================================================ */

.threedx-form-group {
    margin-bottom: var(--tdx-space-4);
}

.threedx-form-group label,
.three-dx-deposit label,
.three-dx-withdrawal label,
.threeDX-auth label {
    display: block;
    margin-bottom: var(--tdx-space-2);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tdx-gray-700);
}

.threedx-form-group input[type="text"],
.threedx-form-group input[type="email"],
.threedx-form-group input[type="password"],
.threedx-form-group input[type="number"],
.threedx-form-group input[type="tel"],
.threedx-form-group select,
.threedx-form-group textarea,
.three-dx-deposit input,
.three-dx-withdrawal input,
.threeDX-auth input[type="text"],
.threeDX-auth input[type="email"],
.threeDX-auth input[type="password"] {
    width: 100%;
    padding: var(--tdx-space-2) var(--tdx-space-3);
    font-size: 0.875rem;
    border: 1px solid var(--tdx-gray-300);
    border-radius: var(--tdx-radius-md);
    background: #fff;
    transition: border-color var(--tdx-transition), box-shadow var(--tdx-transition);
}

.threedx-form-group input:focus,
.threedx-form-group select:focus,
.threedx-form-group textarea:focus,
.three-dx-deposit input:focus,
.three-dx-withdrawal input:focus,
.threeDX-auth input:focus {
    outline: none;
    border-color: var(--tdx-primary);
    box-shadow: 0 0 0 3px var(--tdx-primary-light);
}

.threedx-form-group input.error,
.threedx-form-group.has-error input {
    border-color: var(--tdx-danger);
}

.threedx-form-group input.error:focus,
.threedx-form-group.has-error input:focus {
    box-shadow: 0 0 0 3px var(--tdx-danger-light);
}

.threedx-form-help {
    margin-top: var(--tdx-space-1);
    font-size: 0.75rem;
    color: var(--tdx-gray-500);
}

.threedx-form-error {
    margin-top: var(--tdx-space-1);
    font-size: 0.75rem;
    color: var(--tdx-danger);
}

/* File Input */
.threedx-file-input {
    position: relative;
    display: inline-block;
}

.threedx-file-input input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.threedx-file-input .threedx-file-label {
    display: inline-flex;
    align-items: center;
    gap: var(--tdx-space-2);
    padding: var(--tdx-space-2) var(--tdx-space-4);
    background: var(--tdx-gray-100);
    border: 1px dashed var(--tdx-gray-300);
    border-radius: var(--tdx-radius-md);
    cursor: pointer;
    transition: background var(--tdx-transition), border-color var(--tdx-transition);
}

.threedx-file-input:hover .threedx-file-label {
    background: var(--tdx-gray-200);
    border-color: var(--tdx-gray-400);
}

/* ============================================================================
   ALERTS & NOTIFICATIONS
   ============================================================================ */

.threedx-alert {
    padding: var(--tdx-space-4);
    border-radius: var(--tdx-radius-lg);
    margin-bottom: var(--tdx-space-4);
    display: flex;
    align-items: flex-start;
    gap: var(--tdx-space-3);
}

.threedx-alert-info {
    background: var(--tdx-info-light);
    border: 1px solid #93c5fd;
    color: var(--tdx-primary-dark);
}

.threedx-alert-success {
    background: var(--tdx-success-light);
    border: 1px solid #6ee7b7;
    color: var(--tdx-success-dark);
}

.threedx-alert-warning {
    background: var(--tdx-warning-light);
    border: 1px solid #fcd34d;
    color: var(--tdx-warning-dark);
}

.threedx-alert-danger {
    background: var(--tdx-danger-light);
    border: 1px solid #fca5a5;
    color: var(--tdx-danger-dark);
}

.threedx-alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.threedx-alert-content {
    flex: 1;
}

.threedx-alert-title {
    font-weight: 600;
    margin-bottom: var(--tdx-space-1);
}

.threedx-alert-dismiss {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity var(--tdx-transition);
}

.threedx-alert-dismiss:hover {
    opacity: 1;
}

/* Toast Notifications */
.threedx-toast-container {
    position: fixed;
    top: var(--tdx-space-4);
    right: var(--tdx-space-4);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--tdx-space-2);
}

.threedx-toast {
    padding: var(--tdx-space-3) var(--tdx-space-4);
    border-radius: var(--tdx-radius-lg);
    background: var(--tdx-gray-800);
    color: #fff;
    box-shadow: var(--tdx-shadow-lg);
    animation: threedx-slide-in 0.3s ease;
    max-width: 360px;
}

.threedx-toast.success { background: var(--tdx-success); }
.threedx-toast.error { background: var(--tdx-danger); }
.threedx-toast.warning { background: var(--tdx-warning-dark); }

@keyframes threedx-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================================================
   AUTH PAGES (Login/Register)
   ============================================================================ */

.threeDX-auth {
    max-width: 420px;
    margin: var(--tdx-space-8) auto;
    padding: 0 var(--tdx-space-4);
}

.threeDX-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--tdx-gray-200);
}

.threeDX-tab {
    flex: 1;
    padding: var(--tdx-space-3) var(--tdx-space-4);
    text-align: center;
    font-weight: 500;
    color: var(--tdx-gray-600);
    text-decoration: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    transition: all var(--tdx-transition);
}

.threeDX-tab:hover {
    color: var(--tdx-primary);
}

.threeDX-tab.active {
    color: var(--tdx-primary);
    border-bottom-color: var(--tdx-primary);
}

.threeDX-panel {
    display: none;
    padding: var(--tdx-space-6);
    background: #fff;
    border: 1px solid var(--tdx-gray-200);
    border-top: none;
    border-radius: 0 0 var(--tdx-radius-lg) var(--tdx-radius-lg);
}

.threeDX-panel.active {
    display: block;
}

.threeDX-register-form p {
    margin-bottom: var(--tdx-space-4);
}

.threeDX-links {
    text-align: center;
    margin-top: var(--tdx-space-4);
}

.threeDX-links a {
    color: var(--tdx-primary);
    text-decoration: none;
}

.threeDX-links a:hover {
    text-decoration: underline;
}

/* ============================================================================
   DEPOSIT/WITHDRAWAL PAGES
   ============================================================================ */

.three-dx-deposit,
.three-dx-withdrawal {
    max-width: 800px;
}

.three-dx-deposit form,
.three-dx-withdrawal form {
    background: var(--tdx-gray-50);
    padding: var(--tdx-space-5);
    border-radius: var(--tdx-radius-lg);
    margin-bottom: var(--tdx-space-6);
}

.three-dx-deposit form label,
.three-dx-withdrawal form label {
    display: block;
    margin-bottom: var(--tdx-space-2);
    margin-top: var(--tdx-space-4);
}

.three-dx-deposit form label:first-of-type,
.three-dx-withdrawal form label:first-of-type {
    margin-top: 0;
}

/* QR Code Section */
.threedx-qr-section {
    display: flex;
    gap: var(--tdx-space-6);
    align-items: center;
    flex-wrap: wrap;
    padding: var(--tdx-space-5);
    background: var(--tdx-gray-50);
    border-radius: var(--tdx-radius-lg);
    margin-bottom: var(--tdx-space-5);
}

.threedx-qr-code {
    flex-shrink: 0;
}

.threedx-qr-code img {
    width: 180px;
    height: 180px;
    border: 1px solid var(--tdx-gray-200);
    border-radius: var(--tdx-radius-lg);
    padding: var(--tdx-space-2);
    background: #fff;
}

.threedx-wallet-info code {
    display: block;
    padding: var(--tdx-space-2) var(--tdx-space-3);
    background: #fff;
    border: 1px solid var(--tdx-gray-200);
    border-radius: var(--tdx-radius-md);
    font-family: var(--tdx-font-mono);
    font-size: 0.75rem;
    word-break: break-all;
    margin-bottom: var(--tdx-space-3);
}

/* ============================================================================
   COUNTDOWN TIMER
   ============================================================================ */

.threedx-countdown {
    display: inline-flex;
    gap: var(--tdx-space-2);
    font-family: var(--tdx-font-mono);
    font-weight: 600;
}

.threedx-countdown-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--tdx-space-2) var(--tdx-space-3);
    background: var(--tdx-gray-100);
    border-radius: var(--tdx-radius-md);
    min-width: 50px;
}

.threedx-countdown-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tdx-primary);
}

.threedx-countdown-label {
    font-size: 0.625rem;
    color: var(--tdx-gray-500);
    text-transform: uppercase;
    font-weight: 500;
}

/* ============================================================================
   PROGRESS BARS
   ============================================================================ */

.threedx-progress {
    height: 8px;
    background: var(--tdx-gray-200);
    border-radius: var(--tdx-radius-full);
    overflow: hidden;
}

.threedx-progress-bar {
    height: 100%;
    background: var(--tdx-primary);
    border-radius: var(--tdx-radius-full);
    transition: width 0.5s ease;
}

.threedx-progress-bar.success { background: var(--tdx-success); }
.threedx-progress-bar.warning { background: var(--tdx-warning); }
.threedx-progress-bar.danger { background: var(--tdx-danger); }

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.threedx-loading {
    display: inline-flex;
    align-items: center;
    gap: var(--tdx-space-2);
    color: var(--tdx-gray-500);
}

.threedx-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--tdx-gray-300);
    border-top-color: var(--tdx-primary);
    border-radius: 50%;
    animation: threedx-spin 0.8s linear infinite;
}

@keyframes threedx-spin {
    to { transform: rotate(360deg); }
}

.threedx-skeleton {
    background: linear-gradient(90deg, var(--tdx-gray-200) 25%, var(--tdx-gray-100) 50%, var(--tdx-gray-200) 75%);
    background-size: 200% 100%;
    animation: threedx-skeleton-loading 1.5s infinite;
    border-radius: var(--tdx-radius-md);
}

@keyframes threedx-skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .threedx-cards,
    .three-dx-dashboard .cards {
        grid-template-columns: 1fr;
    }
    
    .threedx-dashboard .nav-tab-wrapper {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .threedx-dashboard .nav-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .threedx-qr-section {
        flex-direction: column;
        text-align: center;
    }
    
    .threedx-countdown {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .threedx-tab-panel {
        padding: var(--tdx-space-3);
    }
    
    .three-dx-deposit form,
    .three-dx-withdrawal form {
        padding: var(--tdx-space-3);
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.threedx-text-center { text-align: center; }
.threedx-text-right { text-align: right; }
.threedx-text-muted { color: var(--tdx-gray-500); }
.threedx-text-success { color: var(--tdx-success); }
.threedx-text-danger { color: var(--tdx-danger); }
.threedx-text-warning { color: var(--tdx-warning-dark); }

.threedx-font-mono { font-family: var(--tdx-font-mono); }
.threedx-font-bold { font-weight: 700; }

.threedx-mt-0 { margin-top: 0; }
.threedx-mt-2 { margin-top: var(--tdx-space-2); }
.threedx-mt-4 { margin-top: var(--tdx-space-4); }
.threedx-mb-0 { margin-bottom: 0; }
.threedx-mb-2 { margin-bottom: var(--tdx-space-2); }
.threedx-mb-4 { margin-bottom: var(--tdx-space-4); }

.threedx-hidden { display: none; }
.threedx-visible { display: block; }
