/* =========================================================================
   style.css
   USDT Payment Monitor - Dark glassmorphism crypto dashboard theme
   Inspired by the visual language of Binance / Bybit / OKX.
   ========================================================================= */

:root {
    --bg-base: #0a0e17;
    --bg-elevated: #10141f;
    --glass-bg: rgba(20, 26, 41, 0.55);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.04);

    --accent-primary: #f0b90b;      /* Binance-style gold */
    --accent-primary-soft: rgba(240, 185, 11, 0.15);
    --accent-green: #0ecb81;
    --accent-green-soft: rgba(14, 203, 129, 0.14);
    --accent-red: #f6465d;
    --accent-red-soft: rgba(246, 70, 93, 0.14);
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;

    --text-primary: #f3f5f9;
    --text-secondary: #9aa4b5;
    --text-tertiary: #626c7d;

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;

    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.35);
    --transition-fast: 160ms ease;
    --transition-med: 280ms ease;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.mono {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    letter-spacing: 0.2px;
}

/* ---------------------------------------------------------------------
   Background ambience
   --------------------------------------------------------------------- */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
}
.bg-glow-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    left: -150px;
    background: var(--accent-primary);
}
.bg-glow-2 {
    width: 700px;
    height: 700px;
    bottom: -300px;
    right: -200px;
    background: var(--accent-purple);
    opacity: 0.25;
}

/* ---------------------------------------------------------------------
   Glassmorphism base
   --------------------------------------------------------------------- */
.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow: var(--shadow-glass);
    position: relative;
    z-index: 1;
}

/* ---------------------------------------------------------------------
   Top bar
   --------------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 14, 23, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
}
.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-logo {
    width: 38px;
    height: 38px;
}
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.brand-title {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.2px;
}
.brand-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}
.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-tertiary);
    box-shadow: 0 0 0 0 rgba(0,0,0,0);
    transition: background var(--transition-med);
}
.status-dot.online {
    background: var(--accent-green);
    animation: pulse-dot 1.8s infinite;
}
.status-dot.error {
    background: var(--accent-red);
}
@keyframes pulse-dot {
    0%   { box-shadow: 0 0 0 0 rgba(14, 203, 129, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(14, 203, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(14, 203, 129, 0); }
}

/* ---------------------------------------------------------------------
   Dashboard layout
   --------------------------------------------------------------------- */
.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px;
    position: relative;
    z-index: 1;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}
@media (max-width: 1100px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
    .cards-grid { grid-template-columns: 1fr; }
}

.card {
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: transform var(--transition-med), box-shadow var(--transition-med);
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.card.highlight {
    background: linear-gradient(135deg, rgba(240, 185, 11, 0.12), rgba(20, 26, 41, 0.55));
    border-color: rgba(240, 185, 11, 0.25);
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.card-icon img { width: 22px; height: 22px; opacity: 0.9; }

.card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.card-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}
.card-value {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-value.big {
    font-size: 24px;
    color: var(--accent-primary);
}
.card-sub {
    font-size: 12px;
    color: var(--text-tertiary);
}

.copy-btn {
    align-self: flex-start;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 4px 9px;
    border-radius: 7px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.copy-btn img { width: 11px; height: 11px; opacity: 0.8; }
.copy-btn:hover {
    background: var(--accent-primary-soft);
    border-color: rgba(240, 185, 11, 0.35);
    color: var(--accent-primary);
}
.copy-btn.small {
    padding: 4px 6px;
    margin-top: 0;
    margin-left: 6px;
}
.copy-btn.copied {
    background: var(--accent-green-soft);
    border-color: rgba(14, 203, 129, 0.4);
    color: var(--accent-green);
}

/* ---------------------------------------------------------------------
   History / table section
   --------------------------------------------------------------------- */
.history {
    padding: 22px 24px 8px;
}
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
}
.history-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.history-title-wrap h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}
.history-count {
    font-size: 12px;
    color: var(--text-tertiary);
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    padding: 3px 10px;
    border-radius: 999px;
}
.history-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 12px;
    min-width: 280px;
    transition: border-color var(--transition-fast);
}
.search-box:focus-within {
    border-color: rgba(240, 185, 11, 0.4);
}
.search-icon { width: 15px; height: 15px; opacity: 0.6; }
.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    flex: 1;
    min-width: 0;
}
.search-box input::placeholder { color: var(--text-tertiary); }
.search-clear {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}
.search-clear:hover { color: var(--text-primary); }

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-icon img { width: 16px; height: 16px; }
.btn-icon:hover {
    background: var(--accent-primary-soft);
    border-color: rgba(240, 185, 11, 0.35);
}
.btn-icon.spinning img { animation: spin 0.9s linear infinite; }

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

.table-wrap {
    overflow-x: auto;
    padding-bottom: 8px;
}
.payments-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}
.payments-table thead th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-tertiary);
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}
.payments-table tbody td {
    padding: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    vertical-align: middle;
    white-space: nowrap;
}
.payments-table tbody tr.payment-row {
    transition: background var(--transition-fast);
}
.payments-table tbody tr.payment-row:hover {
    background: rgba(255, 255, 255, 0.03);
}
.payments-table tbody tr.payment-row.new-row {
    animation: highlight-row 2.2s ease;
}
@keyframes highlight-row {
    0%   { background: rgba(240, 185, 11, 0.18); }
    100% { background: transparent; }
}

.amount-pill {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    background: var(--accent-green-soft);
    color: var(--accent-green);
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 13px;
}

.addr {
    color: var(--text-secondary);
    font-size: 12.5px;
}

.confirmations-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--accent-blue-soft, rgba(59, 130, 246, 0.14));
    color: var(--accent-blue);
}
.confirmations-badge.confirmed {
    background: var(--accent-green-soft);
    color: var(--accent-green);
}

.btn-explorer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    background: var(--accent-primary-soft);
    color: var(--accent-primary);
    border: 1px solid rgba(240, 185, 11, 0.3);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    transition: all var(--transition-fast);
}
.btn-explorer img { width: 12px; height: 12px; }
.btn-explorer:hover {
    background: var(--accent-primary);
    color: #1a1a1a;
}

.empty-row td { white-space: normal; }
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 0;
    color: var(--text-tertiary);
    font-size: 13px;
}
.spinner {
    width: 34px;
    height: 34px;
    animation: spin 1s linear infinite;
}

/* ---------------------------------------------------------------------
   Toasts
   --------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--accent-green);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    animation: toast-in 0.3s ease;
    font-size: 13px;
}
.toast.error { border-left-color: var(--accent-red); }
.toast-icon { font-size: 16px; line-height: 1; margin-top: 1px; }
.toast-title { font-weight: 700; margin-bottom: 2px; }
.toast-body { color: var(--text-secondary); font-size: 12px; }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; }
    to   { opacity: 0; transform: translateX(20px); }
}
.toast.hide { animation: toast-out 0.3s ease forwards; }

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 22px 4px 40px;
    font-size: 12px;
    color: var(--text-tertiary);
}
.footer a {
    color: var(--text-secondary);
    text-decoration: none;
}
.footer a:hover { color: var(--accent-primary); }

/* ---------------------------------------------------------------------
   Responsive table -> stacked cards on small screens
   --------------------------------------------------------------------- */
@media (max-width: 760px) {
    .topbar-inner { padding: 14px 16px; }
    .dashboard { padding: 16px; }
    .history { padding: 18px 14px 6px; }
    .search-box { min-width: 0; flex: 1; }
}
