/**
 * Sandbox Dashboard - Amber Theme
 * Custom utilities and component styles
 */

/* ============================================
   DATA TABLES - Mobile Responsive
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0 1rem;
}

.card-flush .table-wrapper {
    padding: 0;
}

.table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #0f1419;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #2a3a4a;
    border-radius: 3px;
}

.data-table {
    width: 100%;
    font-size: 13px;
    min-width: 500px;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-size: 11px;
    font-weight: 500;
    color: #8896a4;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #2a3a4a;
    background: #151c24;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th.text-right,
.data-table td.text-right {
    text-align: right;
}

.data-table th.text-center,
.data-table td.text-center {
    text-align: center;
}

.data-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid #1e2a36;
    vertical-align: middle;
    white-space: nowrap;
}

.data-table tbody tr:hover td {
    background: #1e2730;
}

/* Mobile scroll indicator shadow */
.table-wrapper {
    position: relative;
}

.table-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to left, rgba(15, 20, 25, 0.9), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.table-wrapper.has-scroll::after {
    opacity: 1;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-yes {
    background: rgba(0, 212, 170, 0.15);
    color: #00d4aa;
    border: 1px solid rgba(0, 212, 170, 0.3);
}

.badge-no {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.badge-open {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-win {
    background: rgba(0, 212, 170, 0.2);
    color: #00d4aa;
}

.badge-loss {
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.badge-exited {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.badge-neutral {
    background: #151c24;
    color: #8896a4;
    border: 1px solid #2a3a4a;
}

.badge-warning {
    background: rgba(255, 165, 2, 0.2);
    color: #ffa502;
}

.badge-positive {
    background: rgba(0, 212, 170, 0.2);
    color: #00d4aa;
}

.badge-negative {
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.badge-info {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

/* League badges - Amber sandbox variants */
.badge-nfl { background: #013369; color: #fff; }
.badge-nba { background: rgba(201, 8, 42, 0.3); color: #fff; border: 1px solid #C9082A; }
.badge-nhl { background: rgba(52, 152, 219, 0.3); color: #fff; border: 1px solid #3498db; }
.badge-mlb { background: #002D72; color: #fff; }
.badge-cfb { background: #7C4D2B; color: #fff; }
.badge-cbb { background: rgba(245, 158, 11, 0.3); color: #fff; border: 1px solid #f59e0b; }
.badge-default { background: #666; color: #fff; }

/* Strategy badges */
.badge-momentum { background: #2563eb; color: #fff; }
.badge-fade { background: rgba(124, 58, 237, 0.3); color: #fff; border: 1px solid #7c3aed; }
.badge-steady { background: rgba(245, 158, 11, 0.1); color: #fff; border: 0.5px solid #f59e0b; }

/* ============================================
   STAT CARDS
   ============================================ */
.stat-card {
    background: #0f1419;
    border: 1px solid #1e2a36;
    border-radius: 0.5rem;
    padding: 1rem;
}

.stat-label {
    font-size: 11px;
    color: #8896a4;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
}

.stat-value-lg {
    font-size: 1.5rem;
}

.stat-delta {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    margin-top: 0.25rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: #0f1419;
    border: 1px solid #1e2a36;
    border-radius: 0.5rem;
    overflow: hidden;
}

.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #1e2a36;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 12px;
    font-weight: 500;
    color: #8896a4;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-body {
    padding: 1rem;
}

.card-flush .card-body {
    padding: 0;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #2a3a4a;
    border-radius: 0.375rem;
    background: #151c24;
    color: #8896a4;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    background: #1e2730;
    color: #e8eef4;
    border-color: #3a4a5a;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 11px;
}

.btn-icon {
    padding: 0.5rem;
}

.btn-primary {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.btn-primary:hover {
    background: rgba(245, 158, 11, 0.25);
}

/* ============================================
   TEXT COLORS
   ============================================ */
.text-positive { color: #00d4aa !important; }
.text-negative { color: #ff4757 !important; }
.text-warning { color: #ffa502 !important; }
.text-info { color: #3498db !important; }
.text-accent { color: #f59e0b !important; }
.text-muted { color: #8896a4 !important; }
.text-dim { color: #3a4a5a !important; }
.text-primary { color: #e8eef4 !important; }
.text-secondary { color: #8896a4 !important; }

/* ============================================
   UTILITY CLASSES
   ============================================ */
.font-mono { font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-lg { font-size: 14px; }
.text-xl { font-size: 16px; }
.text-2xl { font-size: 20px; }

.uppercase { text-transform: uppercase; }
.text-center { text-align: center; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }

.p-sm { padding: 0.5rem; }
.p-md { padding: 1rem; }
.p-lg { padding: 1.5rem; }
.mt-xs { margin-top: 0.25rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mb-xs { margin-bottom: 0.25rem; }
.my-sm { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.ml-sm { margin-left: 0.5rem; }

.rounded { border-radius: 0.375rem; }
.border-b { border-bottom: 1px solid #1e2a36; }

.bg-tertiary { background: #151c24; }

/* ============================================
   ANIMATIONS
   ============================================ */
.pulse {
    animation: pulse 1.5s infinite;
}

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

/* ============================================
   SORTABLE TABLE HEADERS
   ============================================ */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.25rem !important;
}

.sortable:hover {
    background: #1e2730;
}

.sortable::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-top-color: #3a4a5a;
    margin-top: 2px;
}

.sortable.asc::after {
    border-top-color: transparent;
    border-bottom-color: #f59e0b;
    margin-top: -6px;
}

.sortable.desc::after {
    border-top-color: #f59e0b;
}

/* ============================================
   CHART CONTAINERS
   ============================================ */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 200px;
}

/* ============================================
   LIVE SCORES
   ============================================ */
.live-score, .final-score {
    line-height: 1.3;
}

/* ============================================
   GRID SYSTEM
   ============================================ */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .data-table {
        font-size: 12px;
        min-width: 480px;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.625rem;
    }

    .data-table th {
        font-size: 10px;
    }

    .card-flush .table-wrapper {
        padding-left: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .stat-value-lg {
        font-size: 1.25rem;
    }

    .card-header {
        padding: 0.625rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .card-flush .card-body {
        padding: 0;
    }

    .grid-cols-2,
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }

    .grid-cols-4,
    .grid-cols-5,
    .grid-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .truncate {
        max-width: 120px !important;
    }

    .badge {
        padding: 2px 6px;
        font-size: 9px;
    }
}

@media (max-width: 768px) {
    .grid-cols-5,
    .grid-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-wrapper::after {
        opacity: 1;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid-cols-5 { grid-template-columns: repeat(3, 1fr); }
    .grid-cols-6 { grid-template-columns: repeat(3, 1fr); }
}

/* Touch-friendly tap targets */
@media (pointer: coarse) {
    .data-table td,
    .data-table th {
        padding: 0.625rem 0.75rem;
    }

    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.375rem 0.625rem;
    }
}

/* ============================================
   PROGRESS BARS
   ============================================ */
.progress-bar {
    height: 4px;
    background: #151c24;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-fill.positive { background: #00d4aa; }
.progress-fill.negative { background: #ff4757; }
.progress-fill.warning { background: #ffa502; }
.progress-fill.info { background: #3498db; }
.progress-fill.accent { background: #f59e0b; }

/* ============================================
   LEAGUE COLORS - Sidebar accents
   ============================================ */
/* .league-cbb { border-left: 4px solid #f59e0b; }
.league-nba { border-left: 4px solid #ef4444; }
.league-nhl { border-left: 4px solid #3b82f6; }
.league-nfl { border-left: 4px solid #22c55e; }
.league-cfb { border-left: 4px solid #a855f7; } */

/* ============================================
   INSIGHT CARDS
   ============================================ */
.insight-card {
    padding: 1rem;
    border-radius: 0.5rem;
}

.insight-card-positive {
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.3);
}

.insight-card-negative {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.insight-card-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.insight-card-info {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.3);
}
