/* ============================================================
   KINJIYUDO — Custom Styles
   Supplements Tailwind CSS CDN.

   Sections:
   1. Nav utilities
   2. Brand / Logo
   3. Bootstrap compatibility shims (for Jinja2 filter class names)
   4. Status / colour utilities
   5. Plan card backgrounds
   6. Form / input overrides
   7. Custom components (gauge, ADR, spread, margin, win%)
   8. Table utilities
   9. Pagination
   10. Animations
   11. Dark-mode-aware misc overrides
   ============================================================ */


/* Alpine.js — hide x-cloak elements until Alpine initialises */
[x-cloak] { display: none !important; }


/* ============================================================
   1. NAV UTILITIES
   ============================================================ */

.nav-link-item {
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.dark .nav-link-item {
    color: #8b949e;
}
.nav-link-item:hover {
    background-color: #f3f4f6;
    color: #111827;
}
.dark .nav-link-item:hover {
    background-color: #21262d;
    color: #e6edf3;
}

.nav-link-active {
    background-color: #f97316 !important;
    color: #fff !important;
}
.dark .nav-link-active {
    background-color: #f97316 !important;
    color: #fff !important;
}

.mobile-nav-link {
    display: block;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
}
.dark .mobile-nav-link {
    color: #8b949e;
}
.mobile-nav-link:hover {
    background-color: #f3f4f6;
    color: #111827;
}
.dark .mobile-nav-link:hover {
    background-color: #21262d;
    color: #e6edf3;
}


/* ============================================================
   2. BRAND / LOGO
   ============================================================ */

@keyframes shimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.kanji-logo {
    background: linear-gradient(90deg, #c9a84c, #e8d060, #9e8820, #e8d060, #c9a84c);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
    animation: shimmer 4s linear infinite;
    white-space: nowrap;
}


/* ============================================================
   3. BOOTSTRAP COMPATIBILITY SHIMS
   (Jinja2 filters return these class names)
   ============================================================ */

/* Layout containers */
.container {
    width: 100%;
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
.row { display: flex; flex-wrap: wrap; margin-left: -0.75rem; margin-right: -0.75rem; }
.text-center { text-align: center; }
.text-start  { text-align: left; }
.text-end    { text-align: right; }
.lead { font-size: 1.1rem; }

/* Display helpers used by inline JS */
.d-none     { display: none !important; }
.d-block    { display: block !important; }
.d-flex     { display: flex !important; }
.d-inline   { display: inline !important; }

/* Text utilities */
.text-center  { text-align: center; }
.text-start   { text-align: left; }
.text-end     { text-align: right; }

/* Spacing - subset used by existing templates */
.ms-1 { margin-left: 0.25rem; }
.ms-2 { margin-left: 0.5rem; }
.ms-3 { margin-left: 0.75rem; }
.ms-auto { margin-left: auto; }
.me-2 { margin-right: 0.5rem; }
.me-3 { margin-right: 0.75rem; }
.me-4 { margin-right: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-0 { margin-bottom: 0; }
.p-2  { padding: 0.5rem; }
.p-3  { padding: 0.75rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.fw-bold    { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.small      { font-size: 0.875em; }
.fs-5       { font-size: 1.25rem; }
.h5, .h6   { margin-bottom: 0.5rem; font-weight: 600; }
.h5 { font-size: 1.25rem; }
.h6 { font-size: 1rem; }
.flex-grow-1 { flex-grow: 1; }
.align-middle { vertical-align: middle; }
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.w-100 { width: 100%; }
.rounded { border-radius: 0.375rem; }
.border   { border: 1px solid #d0d7de; }
.dark .border { border-color: #30363d; }
.border-1 { border-width: 1px; }
.overflow-hidden { overflow: hidden; }
.table-responsive { overflow-x: auto; }


/* ============================================================
   4. STATUS / COLOUR UTILITIES
   (Jinja2 filter return values — light & dark mode)
   ============================================================ */

/* Core status colours */
.text-success { color: #1a7f37 !important; }
.dark .text-success { color: #3fb950 !important; }

.text-danger  { color: #d1242f !important; }
.dark .text-danger  { color: #f85149 !important; }

.text-warning { color: #9a6700 !important; }
.dark .text-warning { color: #d29922 !important; }

.text-info    { color: #0969da !important; }
.dark .text-info    { color: #388bfd !important; }

.text-muted   { color: #656d76 !important; }
.dark .text-muted   { color: #8b949e !important; }

.text-primary { color: #1a6dff !important; }
.dark .text-primary { color: #5b9cf6 !important; }

.text-white   { color: #ffffff !important; }
.text-light   { color: #f8f9fa !important; }
.dark .text-light { color: #c9d1d9 !important; }

.text-slategrey {
    color: #656d76;
    transition: color 0.2s ease;
}
.dark .text-slategrey { color: #8b949e; }
a.text-slategrey:hover { color: #374151; }
.dark a.text-slategrey:hover { color: #c9d1d9; }

/* Muted variants */
.text-success-muted { color: #2e7d32 !important; }
.dark .text-success-muted { color: #3fb950 !important; opacity: 0.75; }

.text-danger-muted { color: #c62828 !important; }
.dark .text-danger-muted { color: #f85149 !important; opacity: 0.75; }

.text-lightgrey { color: #adb5bd !important; }
.dark .text-lightgrey { color: #6e7681 !important; }

.text-gray { color: #d1d5db; }
.dark .text-gray { color: #4b5563; }


/* ============================================================
   5. PLAN CARD BACKGROUNDS
   (Returned by plan_div_background_color filter)
   ============================================================ */

/* Active plan */
.green-hash-bg {
    background-color: rgba(26, 127, 55, 0.12);
    border: 1px solid rgba(26, 127, 55, 0.3);
    color: #1f2328;
}
.dark .green-hash-bg {
    background-color: #0d2818;
    border-color: rgba(63, 185, 80, 0.25);
    color: #e6edf3;
}

/* Disabled plan */
.red-hash-bg {
    background-color: rgba(209, 36, 47, 0.08);
    border: 1px solid rgba(209, 36, 47, 0.25);
    color: #1f2328;
}
.dark .red-hash-bg {
    background-color: #2d1117;
    border-color: rgba(248, 81, 73, 0.25);
    color: #e6edf3;
}

/* Paused plan */
.grey-hash-bg {
    background-color: rgba(110, 118, 129, 0.08);
    border: 1px solid rgba(110, 118, 129, 0.25);
    color: #1f2328;
}
.dark .grey-hash-bg {
    background-color: #1c2128;
    border-color: rgba(139, 148, 158, 0.25);
    color: #e6edf3;
}

/* Pending plan */
.blue-hash-bg {
    background-color: rgba(9, 105, 218, 0.08);
    border: 1px solid rgba(9, 105, 218, 0.25);
    color: #1f2328;
}
.dark .blue-hash-bg {
    background-color: #0d1b2b;
    border-color: rgba(56, 139, 253, 0.25);
    color: #e6edf3;
}

/* Default/suspended plan */
.bg-dark {
    background-color: #f6f8fa;
    border: 1px solid #d0d7de;
    color: #1f2328;
}
.dark .bg-dark {
    background-color: #161b22;
    border-color: #30363d;
    color: #e6edf3;
}


/* ============================================================
   6. FORM / INPUT / CARD OVERRIDES
   ============================================================ */

/* Base form control */
.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.5rem;
    border: 1px solid #d0d7de;
    background-color: #ffffff;
    color: #1f2328;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}
.dark .form-control {
    background-color: #0d1117;
    border-color: #30363d;
    color: #e6edf3;
}
.form-control:focus {
    border-color: #1a6dff;
    box-shadow: 0 0 0 3px rgba(26, 109, 255, 0.2);
}
.dark .form-control:focus {
    border-color: #388bfd;
    box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.2);
}
.form-control[readonly] {
    background-color: #f6f8fa;
    color: #8b949e;
    cursor: not-allowed;
    opacity: 1;
}
.dark .form-control[readonly] {
    background-color: #161b22;
    color: #6e7681;
}

/* Select */
select.form-control, .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    appearance: none;
}

/* Textarea */
textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Form label */
.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}
.dark .form-label { color: #8b949e; }

.form-group { margin-bottom: 0; }

/* Form check */
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check-input {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #d0d7de;
    accent-color: #1a6dff;
    cursor: pointer;
}
.dark .form-check-input { border-color: #30363d; }
.form-check-label { font-size: 0.875rem; color: #374151; cursor: pointer; }
.dark .form-check-label { color: #8b949e; }
.form-check-inline { display: inline-flex; align-items: center; gap: 0.375rem; margin-right: 0.75rem; }

/* Validation */
.is-invalid { border-color: #d1242f !important; }
.dark .is-invalid { border-color: #f85149 !important; }
.invalid-feedback { display: block !important; color: #d1242f; font-size: 0.8125rem; margin-top: 0.25rem; }
.dark .invalid-feedback { color: #f85149; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    line-height: 1.5;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background-color: #1a6dff;
    border-color: #1a6dff;
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background-color: #0d4fcc;
    border-color: #0d4fcc;
}

.btn-success {
    background-color: #1a7f37;
    border-color: #1a7f37;
    color: #fff;
}
.dark .btn-success { background-color: #238636; border-color: #238636; }
.btn-success:hover:not(:disabled) { background-color: #116329; border-color: #116329; }

.btn-danger {
    background-color: #d1242f;
    border-color: #d1242f;
    color: #fff;
}
.dark .btn-danger { background-color: #da3633; border-color: #da3633; }
.btn-danger:hover:not(:disabled) { background-color: #a40e26; border-color: #a40e26; }

.btn-warning {
    background-color: #9a6700;
    border-color: #9a6700;
    color: #fff;
}
.dark .btn-warning { background-color: #d29922; border-color: #d29922; color: #0d1117; }
.btn-warning:hover:not(:disabled) { background-color: #7d5400; }

.btn-secondary {
    background-color: #f6f8fa;
    border-color: #d0d7de;
    color: #24292f;
}
.dark .btn-secondary { background-color: #21262d; border-color: #30363d; color: #c9d1d9; }
.btn-secondary:hover:not(:disabled) { background-color: #eaeef2; }
.dark .btn-secondary:hover:not(:disabled) { background-color: #30363d; }

.btn-info {
    background-color: #1a6dff;
    border-color: #1a6dff;
    color: #fff;
}
.btn-info:hover:not(:disabled) { background-color: #0d4fcc; }

.btn-outline-primary {
    background-color: transparent;
    border-color: #1a6dff;
    color: #1a6dff;
}
.btn-outline-primary:hover:not(:disabled) { background-color: #1a6dff; color: #fff; }
.btn-outline-primary.active { background-color: #1a6dff; color: #fff; }

.btn-outline-light {
    background-color: transparent;
    border-color: #d0d7de;
    color: #656d76;
}
.dark .btn-outline-light { border-color: #30363d; color: #8b949e; }
.btn-outline-light:hover:not(:disabled) {
    background-color: #f6f8fa;
    border-color: #8b949e;
    color: #24292f;
}
.dark .btn-outline-light:hover:not(:disabled) {
    background-color: #21262d;
    border-color: #8b949e;
    color: #e6edf3;
}

.btn-sm  { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn-lg  { padding: 0.625rem 1.25rem; font-size: 1rem; }
.btn-link {
    background: none;
    border: none;
    padding: 0;
    color: #1a6dff;
    text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

/* Icon-only button */
.icon-button {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
}
.icon-button:hover { background-color: rgba(0,0,0,0.05); }
.dark .icon-button:hover { background-color: rgba(255,255,255,0.06); }

/* Card */
.card {
    background-color: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 0.75rem;
    overflow: hidden;
}
.dark .card { background-color: #161b22; border-color: #30363d; }

.card-border { border: 1px solid #30363d; }

.card-body { padding: 1.25rem; }

/* Status div (legacy) */
.status-div {
    border: 1px solid #d0d7de;
    border-radius: 0.75rem;
    padding: 1.25rem;
}
.dark .status-div { border-color: #30363d; }

/* Alert */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid;
    font-size: 0.875rem;
}
.alert-danger { background-color: #fff0f0; border-color: #fca5a5; color: #dc2626; }
.dark .alert-danger { background-color: #2d1117; border-color: #da3633; color: #f85149; }

/* Table base */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.5rem 0.75rem; }
.table th { font-weight: 600; text-align: left; }
.table-sm th, .table-sm td { padding: 0.25rem 0.5rem; font-size: 0.8125rem; }

/* Collapse helper (Bootstrap compatibility) */
.collapse { display: none; }
.collapse.show { display: block; }


/* ============================================================
   7. CUSTOM COMPONENTS
   ============================================================ */

/* --- Entry levels table (markets / plans) --- */
.entry-levels-table {
    width: 100%;
    border-collapse: collapse;
}
.entry-levels-header-cell {
    padding: 0.625rem 0.75rem;
    background-color: #f6f8fa;
    color: #374151;
    font-size: 0.8125rem;
    font-weight: 600;
    border-bottom: 1px solid #d0d7de;
    text-align: left;
}
.dark .entry-levels-header-cell {
    background-color: #161b22;
    color: #8b949e;
    border-bottom-color: #30363d;
}
.entry-levels-data-cell {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eaeef2;
    font-size: 0.8125rem;
    color: #374151;
}
.dark .entry-levels-data-cell { border-bottom-color: #21262d; color: #c9d1d9; }


/* --- Gauge (half-circle PnL gauge) --- */
.gauge {
    --w: 240;
    --th: 26;
    --fg: #3fb950;
    --bg: #30363d;
    --lbl-gap: -6px;
    position: relative;
    width: calc(var(--w) * 1px);
    margin-inline: auto;
    padding-bottom: calc(0.6rem + max(0, -1 * var(--lbl-gap)));
}
.gauge svg { display: block; width: 100%; height: calc(var(--w) / 2 * 1px); }
.gauge path { fill: none; stroke-linecap: butt; vector-effect: non-scaling-stroke; }
.gauge .track { stroke: var(--bg); stroke-width: var(--th); opacity: 0.7; }
.gauge .meter { stroke: var(--fg); stroke-width: var(--th); }
.gauge-center {
    position: absolute;
    left: 50%;
    top: 58%;
    transform: translate(-50%, -50%);
    text-align: center;
    line-height: 1.15;
}
.gauge-value { font-weight: 700; color: #e6edf3; }
.dark .gauge-value { color: #e6edf3; }
.gauge-caption { margin-top: 0.35rem; font-size: 0.85rem; color: #8b949e; }
.gauge-ends {
    position: absolute;
    left: 15px;
    right: 0;
    bottom: var(--lbl-gap);
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #8b949e;
    pointer-events: none;
}


/* --- ADR gauge --- */
.adr-gauge { padding: 0.75rem; border-radius: 0.5rem; width: 300px; color: #8b949e; }
.adr-label { font-size: 0.875rem; margin-bottom: 0.35rem; }
.adr-track {
    position: relative;
    height: 16px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: linear-gradient(to right, #1a6dff, #3fb950, #f85149);
}
.adr-needle {
    position: absolute;
    top: -4px;
    width: 8px;
    height: 24px;
    background: #1f2328;
    border-radius: 2px;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    transform: translateX(-50%);
}
.adr-scale { display: flex; justify-content: space-between; font-size: 0.75rem; color: #6e7681; margin-top: 0.25rem; }


/* --- Spread scale --- */
.spread-scale {
    position: relative;
    height: 14px;
    width: 100%;
    max-width: 180px;
    border-radius: 999px;
    background: linear-gradient(to right, #3fb950, #d29922, #f85149);
    overflow: hidden;
}
.spread-marker {
    position: absolute;
    top: -4px;
    width: 8px;
    height: 18px;
    background-color: #1f2328;
    border-radius: 2px;
    transform: translateX(-50%);
    transition: left 0.3s ease-out;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}


/* --- Margin requirement scale --- */
.margin-scale {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    padding: 0.75rem;
}
.margin-box {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.25;
    transition: opacity 0.3s, transform 0.3s;
}
.margin-box.active {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}
.margin-333 { background-color: #56d364; }
.margin-5  { background-color: #3fb950; }
.margin-10 { background-color: #1a7f37; }
.margin-20 { background-color: #d29922; }
.margin-25 { background-color: #e67e22; }
.margin-50 { background-color: #f85149; }


/* --- Win percentage bar --- */
.win-percentage-container { width: 200px; text-align: center; color: #8b949e; padding: 1rem; border-radius: 0.5rem; }
.win-percentage-block { display: flex; flex-direction: column; align-items: center; margin-top: 1rem; }
.win-percentage-title { color: #24292f; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 600; }
.dark .win-percentage-title { color: #e6edf3; }
.win-percentage-bar { width: 200px; height: 12px; background-color: #21262d; border-radius: 999px; overflow: hidden; margin-bottom: 0.375rem; }
.win-percentage-fill-winner { height: 100%; background-color: #3fb950; border-radius: 999px 0 0 999px; }
.win-percentage-fill-loser  { height: 100%; background-color: #f85149; border-radius: 999px 0 0 999px; }
.win-percentage-caption { font-size: 0.8125rem; color: #6e7681; }

/* --- Running vs Open PnL diverging dual bar --- */
.pnl-dual { display: flex; flex-direction: column; align-items: center; margin-top: 0.75rem; }
.pnl-dual-title { font-size: 0.875rem; font-weight: 600; color: #24292f; margin-bottom: 0.5rem; }
.dark .pnl-dual-title { color: #e6edf3; }
.pnl-dual-row { display: flex; align-items: center; gap: 0.5rem; width: 220px; margin-bottom: 0.5rem; }
.pnl-dual-label { font-size: 0.7rem; color: #8b949e; width: 42px; text-align: right; flex-shrink: 0; }
.pnl-dual-track { flex: 1; height: 10px; display: flex; background: #21262d; border-radius: 999px; overflow: hidden; }
.pnl-dual-left  { flex: 1; display: flex; justify-content: flex-end; overflow: hidden; }
.pnl-dual-right { flex: 1; display: flex; justify-content: flex-start; overflow: hidden; }
.pnl-dual-fill-pos { height: 100%; background: #3fb950; border-radius: 0 999px 999px 0; }
.pnl-dual-fill-neg { height: 100%; background: #f85149; border-radius: 999px 0 0 999px; }
.pnl-dual-fill-blue { height: 100%; background: #1a6dff; border-radius: 0 999px 999px 0; }
.pnl-dual-value { font-size: 0.7rem; font-weight: 600; width: 36px; flex-shrink: 0; }
.pnl-dual-zero { display: flex; justify-content: center; width: 220px; margin-bottom: 0.25rem; }
.pnl-dual-zero-tick { width: 1px; height: 5px; background: #30363d; }


/* --- Count badge --- */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    line-height: 1;
    text-align: center;
    margin-left: 0.2rem;
    transform: translateY(-5px);
    color: #fff;
}
.badge-blue   { background-color: #1a6dff; }
.badge-orange { background-color: #f97316; }
.badge-grey   { background-color: #6e7681; }


/* --- Collapsible header --- */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.375rem 0;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.collapsible-header:hover { background-color: rgba(255,255,255,0.04); }

/* --- Rule card --- */
.rule-card {
    background-color: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
}
.dark .rule-card {
    background-color: #161b22;
    border-color: #30363d;
}

/* --- Note card --- */
.note-card {
    background-color: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
}
.dark .note-card {
    background-color: #161b22;
    border-color: #30363d;
}
.note-card:hover { background-color: #eaeef2; }
.dark .note-card:hover { background-color: #21262d; }

/* --- Tab navigation --- */
.nav-tabs { display: flex; border-bottom: 1px solid #d0d7de; gap: 0.25rem; flex-wrap: wrap; }
.dark .nav-tabs { border-bottom-color: #30363d; }
.nav-tabs .nav-link {
    padding: 0.5rem 0.875rem;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 0.375rem 0.375rem 0 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #656d76;
    text-decoration: none;
    cursor: pointer;
    background: none;
    transition: color 0.15s, background-color 0.15s;
}
.dark .nav-tabs .nav-link { color: #8b949e; }
.nav-tabs .nav-link:hover { color: #1f2328; background-color: #f6f8fa; }
.dark .nav-tabs .nav-link:hover { color: #e6edf3; background-color: #21262d; }
.nav-tabs .nav-link.active {
    color: #1f2328;
    background-color: #ffffff;
    border-color: #d0d7de #d0d7de #ffffff;
}
.dark .nav-tabs .nav-link.active {
    color: #e6edf3;
    background-color: #0d1117;
    border-color: #30363d #30363d #0d1117;
}

.tab-content {
    border: 1px solid #d0d7de;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    padding: 1rem;
    background-color: #ffffff;
    color: #1f2328;
}
.dark .tab-content { border-color: #30363d; background-color: #0d1117; color: #e6edf3; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.tab-pane.fade { opacity: 0; transition: opacity 0.15s; }
.tab-pane.fade.show { opacity: 1; }


/* ============================================================
   8. TABLE UTILITIES
   ============================================================ */

.custom-striped-table tbody tr:nth-of-type(odd)  { background-color: rgba(0,0,0,0.02); }
.dark .custom-striped-table tbody tr:nth-of-type(odd) { background-color: rgba(255,255,255,0.03); }
.custom-striped-table tbody tr:nth-of-type(even) { background-color: transparent; }
.custom-striped-table th, .custom-striped-table td { border: none !important; }


/* ============================================================
   9. PAGINATION
   ============================================================ */

.custom-pagination { display: flex; align-items: center; list-style: none; gap: 0.125rem; padding: 0; margin: 0; }
.custom-pagination .page-item { background: transparent; }
.custom-pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    border: none;
    background: transparent;
    transition: background-color 0.15s;
}
.dark .custom-pagination .page-link { color: #8b949e; }
.custom-pagination .page-link:hover { background-color: #f6f8fa; }
.dark .custom-pagination .page-link:hover { background-color: #21262d; }
.custom-pagination .page-item.active .page-link { background-color: #f97316; color: #fff; }
.custom-pagination .page-item.disabled .page-link { opacity: 0.4; cursor: default; pointer-events: none; }


/* ============================================================
   10. ANIMATIONS
   ============================================================ */

@keyframes flash-border-animation {
    from { border-color: #f97316; box-shadow: 0 0 6px #f97316; }
    to   { border-color: #1a6dff; box-shadow: 0 0 6px #1a6dff; }
}
.flash-border {
    border: 2px solid #f97316 !important;
    box-shadow: 0 0 6px #f97316;
    animation: flash-border-animation 0.8s infinite alternate;
}

@keyframes flash-red-orange {
    0%, 100% { color: #f97316; }
    50%       { color: #5b9cf6; }
}
.text-flash-red-orange {
    animation: flash-red-orange 1s ease-in-out infinite;
    font-weight: 700;
}
@media (prefers-reduced-motion: reduce) {
    .text-flash-red-orange { animation: none; color: #f85149; }
}

/* Rotate icon for collapsible chevrons */
.rotate-icon { transition: transform 0.25s ease; }
[aria-expanded="true"] .rotate-icon { transform: rotate(180deg); }


/* ============================================================
   11. MISC OVERRIDES
   ============================================================ */

/* Zoom hover (market cards) */
.zoom-hover {
    min-width: 300px;
    transition: transform 0.3s ease;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
.zoom-hover:hover { transform: scale(1.05); }

/* Gray out disabled elements */
.gray-out { filter: grayscale(100%); pointer-events: none; cursor: not-allowed; }
.green-out { background-color: rgba(63, 185, 80, 0.3); pointer-events: none; cursor: not-allowed; }

/* Image frame */
.image-frame {
    border: 1px solid #30363d;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    border-radius: 0.375rem;
    max-width: 100%;
    height: auto;
}

/* VR separator */
.vr-sep { width: 1px; height: 90%; background-color: #30363d; margin: 0 0.625rem; }

/* Plan disabled visual */
.plan-disabled { opacity: 0.6; }

/* DataTables override for dark mode */
.dark .dataTables_wrapper,
.dark .dataTables_wrapper .dataTables_filter input,
.dark .dataTables_wrapper .dataTables_length select {
    color: #e6edf3;
    background-color: #0d1117;
    border-color: #30363d;
}
.dark table.dataTable {
    border-color: #30363d !important;
    color: #e6edf3;
}
.dark table.dataTable thead th {
    border-bottom-color: #30363d;
}

/* Hover highlights */
.hover_highlight_active { color: #e6edf3; font-weight: 500; text-decoration: none; transition: color 0.2s ease; }
.hover_highlight_active:hover { color: #f97316; }
.hover_highlight_warning { color: #8b949e; text-decoration: none; transition: color 0.2s ease; }
.hover_highlight_warning:hover { color: #f97316; }
.hover_highlight_danger { color: #8b949e; text-decoration: none; transition: color 0.2s ease; }
.hover_highlight_danger:hover { color: #f85149; }
.hover_highlight_success { color: #8b949e; text-decoration: none; transition: color 0.2s ease; }
.hover_highlight_success:hover { color: #3fb950; }

/* FA rotation helpers */
.fa-rotate-45deg  { display: inline-block; transform: rotate(45deg); }
.fa-rotate-135deg { display: inline-block; transform: rotate(135deg); }
