/* ========================================
   Binance Pay Dashboard - Design System
   ======================================== */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2035;
    --bg-input: #0f1629;
    --bg-hover: #1e293b;
    --bg-table-row: #141c2e;
    --bg-table-row-alt: #111827;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #f0b90b;
    --accent-hover: #d4a20a;
    --accent-glow: rgba(240, 185, 11, 0.15);
    --accent-glow-strong: rgba(240, 185, 11, 0.3);

    --success: #10b981;
    --danger: #ef4444;
    --border: #1e293b;
    --border-light: #2d3a50;

    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ========== Reset & Base ========== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Login Page ========== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(240, 185, 11, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.04) 0%, transparent 50%),
        var(--bg-primary);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 48px 40px;
    border: 1px solid var(--border);
    box-shadow:
        0 0 0 1px rgba(240, 185, 11, 0.05),
        0 25px 60px rgba(0, 0, 0, 0.4);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent), #e8a500);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(240, 185, 11, 0.2);
}

.login-logo .logo-icon svg {
    width: 28px;
    height: 28px;
    fill: #000;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.login-logo p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--accent), #d4a20a);
    color: #000;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.01em;
    margin-top: 8px;
}

.btn-login:hover {
    background: linear-gradient(135deg, #ffc929, var(--accent));
    box-shadow: 0 6px 20px rgba(240, 185, 11, 0.3);
    transform: translateY(-1px);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    margin-bottom: 20px;
    display: none;
}

.login-error.visible {
    display: block;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========== Dashboard Layout ========== */

.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Top Bar ---- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #e8a500);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topbar-logo svg {
    width: 18px;
    height: 18px;
    fill: #000;
}

.topbar-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sync-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.user-badge .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #e8a500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #000;
}

.btn-logout {
    padding: 7px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ---- Main Content ---- */

.main-content {
    flex: 1;
    padding: 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ---- Stats Cards ---- */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.stat-value .currency {
    font-size: 0.875rem;
    color: var(--accent);
    font-weight: 500;
    margin-left: 4px;
}

/* ---- Table Section ---- */

.table-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    gap: 20px;
    flex-wrap: wrap;
}

.table-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: auto;
}

/* ---- Controls ---- */

.table-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    min-width: 240px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    fill: var(--text-muted);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group select {
    padding: 7px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-family: var(--font);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.filter-group select:focus {
    border-color: var(--accent);
    color: var(--text-primary);
}

.table-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

thead th:hover {
    color: var(--accent);
}

thead th.sorted {
    color: var(--accent);
}

thead th .sort-arrow {
    margin-left: 4px;
    opacity: 0.5;
}

thead th.sorted .sort-arrow {
    opacity: 1;
}

tbody tr {
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
    transition: var(--transition);
}

tbody tr:nth-child(even) {
    background: var(--bg-table-row-alt);
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody td {
    padding: 14px 20px;
    white-space: nowrap;
    color: var(--text-secondary);
}

tbody td.amount-cell {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--success);
    font-size: 0.9rem;
}

tbody td.order-id-cell {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.failed {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ---- Empty State ---- */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    fill: var(--text-muted);
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.875rem;
}

/* ---- Loading Spinner ---- */

.loading-overlay {
    display: none;
    text-align: center;
    padding: 60px 20px;
}

.loading-overlay.visible {
    display: block;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

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

.loading-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ---- Refresh Countdown ---- */

.refresh-bar {
    height: 2px;
    background: var(--border);
    position: relative;
    overflow: hidden;
}

.refresh-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #e8a500);
    width: 100%;
    transform-origin: left;
    animation: countdown 30s linear infinite;
}

@keyframes countdown {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* ========== Responsive ========== */

@media (max-width: 768px) {
    .topbar {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .topbar-right {
        gap: 12px;
    }

    .main-content {
        padding: 16px;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .login-card {
        padding: 36px 28px;
    }

    table {
        font-size: 0.8125rem;
    }

    thead th,
    tbody td {
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .sync-indicator span {
        display: none;
    }
}
