/**
 * Trades Page Pro CSS - Real CEX + DEX Trades
 * Build: 20260131_REAL_TRADES
 */

/* ============================================================
   VARIABLES
   ============================================================ */
:root {
    --tp-gap: 16px;
    --tp-gap-lg: 24px;
    --tp-radius: 12px;
    --tp-radius-sm: 8px;
    --tp-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    --tp-transition: all 0.2s ease;
    
    /* Colors */
    --tp-bg: var(--bg-page, #0a0e12);
    --tp-card: var(--card-bg, #131924);
    --tp-card-hover: #1a2332;
    --tp-border: rgba(255, 255, 255, 0.08);
    --tp-text: #ffffff;
    --tp-text-muted: #8a8a8a;
    --tp-primary: #3B82F6;
    --tp-positive: #10B981;
    --tp-negative: #EF4444;
    --tp-warning: #F59E0B;
}

/* ============================================================
   MAIN CONTAINER
   ============================================================ */
.trades-pro {
    direction: rtl;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--tp-gap);
    font-family: var(--font-family, 'Inter', sans-serif);
    color: var(--tp-text);
}

/* ============================================================
   HEADER
   ============================================================ */
.tp-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--tp-gap);
    margin-bottom: var(--tp-gap-lg);
    padding-bottom: var(--tp-gap);
    border-bottom: 1px solid var(--tp-border);
}

.tp-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.tp-header-left {
    display: flex;
    align-items: center;
    gap: var(--tp-gap);
}

.tp-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Health indicator */
.tp-health {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--tp-card);
    border-radius: 100px;
    font-size: 0.8125rem;
}

.tp-health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.tp-health.ok .tp-health-dot {
    background: var(--tp-positive);
    box-shadow: 0 0 8px var(--tp-positive);
}

.tp-health.warning .tp-health-dot {
    background: var(--tp-warning);
    box-shadow: 0 0 8px var(--tp-warning);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Range buttons */
.tp-range-btns {
    display: flex;
    background: var(--tp-card);
    border-radius: var(--tp-radius-sm);
    overflow: hidden;
}

.tp-range-btn {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--tp-text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tp-transition);
}

.tp-range-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--tp-text);
}

.tp-range-btn.active {
    background: var(--tp-primary);
    color: white;
}

/* Buttons */
.tp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--tp-radius-sm);
    border: 1px solid var(--tp-border);
    background: var(--tp-card);
    color: var(--tp-text);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--tp-transition);
}

.tp-btn:hover:not(:disabled) {
    background: var(--tp-card-hover);
    border-color: var(--tp-primary);
}

.tp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tp-btn.brand {
    width: auto;
    padding: 0 16px;
    font-size: 0.875rem;
    background: var(--tp-primary);
    border-color: var(--tp-primary);
}

.tp-btn.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Selects */
.tp-select {
    padding: 8px 14px;
    padding-left: 30px;
    background: var(--tp-card);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius-sm);
    color: var(--tp-text);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8a8a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 10px center;
}

.tp-select:focus {
    outline: none;
    border-color: var(--tp-primary);
}

.tp-account-select {
    min-width: 150px;
}

/* ============================================================
   KPI ROW
   ============================================================ */
.tp-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--tp-gap);
    margin-bottom: var(--tp-gap-lg);
}

.tp-kpi {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--tp-card);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius);
    transition: var(--tp-transition);
}

.tp-kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--tp-shadow);
}

.tp-kpi.primary {
    border-color: var(--tp-primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), var(--tp-card));
}

.tp-kpi.muted .tp-kpi-value { color: var(--tp-text-muted); }

.tp-kpi-icon {
    font-size: 1.5rem;
}

.tp-kpi-content {
    flex: 1;
}

.tp-kpi-label {
    font-size: 0.75rem;
    color: var(--tp-text-muted);
    margin-bottom: 4px;
}

.tp-kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    direction: ltr;
    text-align: right;
}

.tp-kpi-unit {
    font-size: 0.7rem;
    color: var(--tp-text-muted);
    margin-right: 4px;
}

/* ============================================================
   TABS
   ============================================================ */
.tp-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: var(--tp-gap);
    padding-bottom: var(--tp-gap);
    border-bottom: 1px solid var(--tp-border);
    overflow-x: auto;
}

.tp-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius-sm);
    color: var(--tp-text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tp-transition);
    white-space: nowrap;
}

.tp-tab:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--tp-text);
}

.tp-tab.active {
    background: var(--tp-primary);
    border-color: var(--tp-primary);
    color: white;
}

.tp-tab-count {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    font-size: 0.75rem;
}

.tp-tab.active .tp-tab-count {
    background: rgba(255, 255, 255, 0.2);
}

.tp-venue-icon {
    font-size: 1rem;
}

/* ============================================================
   FILTERS
   ============================================================ */
.tp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: var(--tp-gap);
    align-items: center;
}

.tp-filter {
    flex-shrink: 0;
}

.tp-input {
    padding: 10px 14px;
    background: var(--tp-card);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius-sm);
    color: var(--tp-text);
    font-size: 0.875rem;
    min-width: 180px;
}

.tp-input:focus {
    outline: none;
    border-color: var(--tp-primary);
}

.tp-input::placeholder {
    color: var(--tp-text-muted);
}

.tp-filter-info {
    margin-right: auto;
    font-size: 0.875rem;
    color: var(--tp-text-muted);
}

/* ============================================================
   PANEL
   ============================================================ */
.tp-panel {
    background: var(--tp-card);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius);
    overflow: hidden;
}

/* ============================================================
   TABLE
   ============================================================ */
.tp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.tp-table th {
    text-align: right;
    padding: 14px 16px;
    font-weight: 600;
    color: var(--tp-text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--tp-border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.tp-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--tp-border);
    vertical-align: middle;
}

.tp-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.tp-table tbody tr:last-child td {
    border-bottom: none;
}

/* Time cell */
.tp-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    direction: ltr;
    text-align: right;
}

.tp-date {
    font-size: 0.75rem;
    color: var(--tp-text-muted);
    direction: ltr;
    text-align: right;
}

/* Venue */
.tp-venue {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
}

/* Symbol */
.tp-symbol {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* Side */
.tp-side {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.tp-side.buy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--tp-positive);
}

.tp-side.sell {
    background: rgba(239, 68, 68, 0.15);
    color: var(--tp-negative);
}

/* Numbers */
.tp-num {
    font-family: 'JetBrains Mono', monospace;
    direction: ltr;
    text-align: right;
}

.tp-fee {
    font-size: 0.8125rem;
    color: var(--tp-text-muted);
}

/* ID cell */
.tp-id-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tp-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--tp-text-muted);
    direction: ltr;
}

.tp-copy-btn,
.tp-link-btn {
    padding: 4px 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--tp-transition);
    font-size: 0.75rem;
}

.tp-copy-btn:hover,
.tp-link-btn:hover {
    opacity: 1;
}

.tp-link-btn {
    text-decoration: none;
}

/* ============================================================
   STATES
   ============================================================ */
.tp-loading,
.tp-error,
.tp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.tp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--tp-border);
    border-top-color: var(--tp-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.tp-error-icon,
.tp-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.tp-error h3,
.tp-empty h3 {
    margin: 0 0 8px 0;
    font-size: 1.125rem;
}

.tp-error p,
.tp-empty p {
    margin: 0 0 20px 0;
    color: var(--tp-text-muted);
}

/* ============================================================
   NOTICE
   ============================================================ */
.tp-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: var(--tp-gap);
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--tp-radius-sm);
    font-size: 0.875rem;
    color: var(--tp-text-muted);
}

.tp-notice-icon {
    font-size: 1.25rem;
}

/* ============================================================
   SKELETON
   ============================================================ */
.skeleton-card {
    background: var(--tp-card);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius);
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 25%, 
        rgba(255,255,255,0.05) 50%, 
        transparent 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-line {
    background: linear-gradient(90deg, 
        var(--tp-card) 25%, 
        rgba(255,255,255,0.08) 50%, 
        var(--tp-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .tp-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .trades-pro {
        padding: 12px;
    }
    
    .tp-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tp-header-left,
    .tp-header-right {
        justify-content: space-between;
    }
    
    .tp-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tp-tabs {
        gap: 6px;
    }
    
    .tp-tab {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }
    
    .tp-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tp-input {
        width: 100%;
    }
    
    .tp-filter-info {
        margin-right: 0;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .tp-kpi-row {
        grid-template-columns: 1fr;
    }
    
    .tp-range-btns {
        width: 100%;
    }
    
    .tp-range-btn {
        flex: 1;
    }
}
