/* nextTrading 2.0 - Maroon Theme */

html {
    font-size: 93.75%; /* 15px base — scales all rem values app-wide */
}

:root {
    --maroon-primary: #800000;
    --maroon-dark: #5c0000;
    --maroon-light: #a83232;
    --maroon-hover: #6b0000;
    --maroon-accent: #c0392b;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --bg-main: #f5eeee;
}

/* ─── Body & Base ──────────────────────────────────────────── */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-main);
    color: #333;
}

/* ─── Topbar ───────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: linear-gradient(135deg, var(--maroon-primary), var(--maroon-dark));
    border-bottom: 3px solid var(--maroon-accent);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.topbar .brand {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar .brand span.version {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 20px;
    color: #ffd;
}

.topbar .navbar-toggler-custom {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 5px 10px;
}

.topbar .nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar .nav-right .nav-icon {
    color: rgba(255,255,255,0.85);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s;
}
.topbar .nav-right .nav-icon:hover { color: #fff; }

.topbar .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.4);
}

/* ─── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a0000 0%, #2d0000 40%, #3d0000 100%);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease, width 0.3s ease;
    padding-top: var(--topbar-height);
    box-shadow: 3px 0 15px rgba(0,0,0,0.4);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar.collapsed {
    transform: translateX(-100%);
}

/* Sidebar top user info */
.sidebar-user-info {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--maroon-primary);
    border: 2px solid var(--maroon-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-user-name {
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
}
.sidebar-user-role {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
}

/* Sidebar navigation */
.sidebar-nav {
    padding: 10px 0 20px;
}

.sidebar-section-title {
    color: rgba(255,255,255,0.35);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 12px 20px 5px;
}

/* Single menu item */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.88rem;
    transition: all 0.2s;
    position: relative;
    border-left: 3px solid transparent;
}
.sidebar-link i { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.07);
    border-left-color: var(--maroon-accent);
}
.sidebar-link.active {
    color: #fff;
    background: rgba(192,57,43,0.25);
    border-left-color: var(--maroon-accent);
    font-weight: 600;
}

/* Accordion parent */
.sidebar-accordion .accordion-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    user-select: none;
}
.sidebar-accordion .accordion-header i.menu-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-accordion .accordion-header .chevron {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.3s;
}
.sidebar-accordion .accordion-header:hover {
    color: #fff;
    background: rgba(255,255,255,0.07);
    border-left-color: var(--maroon-accent);
}
.sidebar-accordion.open .accordion-header {
    color: #fff;
    background: rgba(192,57,43,0.2);
    border-left-color: var(--maroon-accent);
}
.sidebar-accordion.open .accordion-header .chevron {
    transform: rotate(90deg);
}

.sidebar-accordion .accordion-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}
.sidebar-accordion.open .accordion-body {
    max-height: 500px;
}

.sidebar-accordion .accordion-body a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px 8px 46px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.83rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-accordion .accordion-body a:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
    border-left-color: rgba(192,57,43,0.6);
}
.sidebar-accordion .accordion-body a.active {
    color: #fff;
    background: rgba(192,57,43,0.2);
    border-left-color: var(--maroon-accent);
}

/* ─── Main Content ─────────────────────────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left 0.3s ease;
    padding: 24px;
}

.main-wrapper.full-width {
    margin-left: 0;
}

/* ─── Page Header ──────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.page-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--maroon-primary);
    margin: 0;
}

.page-header .breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 0.82rem;
}

/* ─── Cards ────────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    margin-bottom: 20px;
}

.card-header {
    background: linear-gradient(135deg, var(--maroon-primary), var(--maroon-dark));
    color: #fff;
    border-radius: 10px 10px 0 0 !important;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Stats Cards ──────────────────────────────────────────── */
.stat-card {
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }

.stat-card .stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
}
.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}
.stat-card .stat-label {
    font-size: 0.82rem;
    opacity: 0.85;
    margin-top: 4px;
}

.stat-card.maroon   { background: linear-gradient(135deg, var(--maroon-primary), var(--maroon-dark)); }
.stat-card.blue     { background: linear-gradient(135deg, #1565c0, #0d47a1); }
.stat-card.green    { background: linear-gradient(135deg, #2e7d32, #1b5e20); }
.stat-card.orange   { background: linear-gradient(135deg, #e65100, #bf360c); }

/* ─── Buttons ──────────────────────────────────────────────── */
.btn-maroon {
    background: linear-gradient(135deg, var(--maroon-primary), var(--maroon-dark));
    border-color: var(--maroon-dark);
    color: #fff;
}
.btn-maroon:hover {
    background: linear-gradient(135deg, var(--maroon-light), var(--maroon-primary));
    border-color: var(--maroon-primary);
    color: #fff;
}
.btn-maroon:focus { box-shadow: 0 0 0 0.25rem rgba(128,0,0,0.35); }
.btn-outline-maroon {
    border-color: var(--maroon-primary);
    color: var(--maroon-primary);
}
.btn-outline-maroon:hover {
    background: var(--maroon-primary);
    border-color: var(--maroon-primary);
    color: #fff;
}

/* ─── Tables ───────────────────────────────────────────────── */
.table thead th {
    background: linear-gradient(135deg, var(--maroon-primary), var(--maroon-dark));
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    white-space: nowrap;
}

.table-hover tbody tr:hover { background-color: rgba(128,0,0,0.04); }

/* Header and body share one fixed size so every table reads consistently,
   regardless of which page/component rendered it. */
.table > tbody > tr > td { font-size: 0.875rem; }

/* ─── Modals ───────────────────────────────────────────────── */
.modal-header {
    background: linear-gradient(135deg, var(--maroon-primary), var(--maroon-dark));
    color: #fff;
    border-radius: 0.5rem 0.5rem 0 0;
}
.modal-header .btn-close { filter: invert(1); }

/* ─── Form Controls ────────────────────────────────────────── */
/* One fixed size for every text box/select app-wide, regardless of whether a
   given view used the plain or "-sm" Bootstrap variant — this is the single
   source of truth so inputs never look larger than the surrounding table text. */
.form-control,
.form-select,
.input-group-text {
    font-size: 0.875rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--maroon-light);
    box-shadow: 0 0 0 0.2rem rgba(128,0,0,0.2);
}
.form-label { font-weight: 600; font-size: 0.85rem; color: #555; }

/* ─── Badges ───────────────────────────────────────────────── */
.badge-maroon { background-color: var(--maroon-primary); color: #fff; }

/* ─── Alerts ───────────────────────────────────────────────── */
.alert-maroon {
    background-color: rgba(128,0,0,0.1);
    border-color: var(--maroon-light);
    color: var(--maroon-dark);
}

/* ─── Login Page ───────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--maroon-dark) 0%, #1a0000 50%, #000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo .logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--maroon-primary), var(--maroon-dark));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 1.8rem;
    color: #fff;
}

.auth-logo h1 {
    color: var(--maroon-primary);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.auth-logo p {
    color: #888;
    font-size: 0.85rem;
    margin: 4px 0 0;
}

/* ─── Pagination ───────────────────────────────────────────── */
.page-item.active .page-link {
    background-color: var(--maroon-primary);
    border-color: var(--maroon-primary);
}
.page-link { color: var(--maroon-primary); }
.page-link:hover { color: var(--maroon-dark); }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1039; }
    .overlay.active { display: block; }
}

/* ─── Loading spinner overlay ──────────────────────────────── */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.7);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.spinner-maroon { color: var(--maroon-primary); }

/* ─── Dropdown user menu ───────────────────────────────────── */
.dropdown-item:active { background-color: var(--maroon-primary); }

/* ─── Topbar Search ─────────────────────────────────────────── */
.topbar-search {
    margin-left: 20px;    /* gap after brand */
    flex-shrink: 0;
}
.topbar-search .input-group { width: 280px; }

.topbar-search-icon {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.75);
}
.topbar-search-input {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}
.topbar-search-input::placeholder { color: rgba(255,255,255,0.5); }
.topbar-search-input:focus {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 0 0.2rem rgba(255,255,255,0.15);
    color: #fff;
}
.topbar-search-btn {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.9);
    line-height: 1;
}
.topbar-search-btn:hover {
    background: rgba(255,255,255,0.28);
    color: #fff;
}
@media (max-width: 576px) { .topbar-search { display: none; } }

/* ─── Product rates hover card ─────────────────────────────── */
.rates-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.product-row:hover .rates-card {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.rates-card-inner {
    background: #1a0000;
    border: 1px solid var(--maroon-accent);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    white-space: nowrap;
    min-width: 180px;
}

.rates-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 3px 0;
}

.rates-row + .rates-row {
    border-top: 1px solid rgba(255,255,255,0.07);
}

.rates-label {
    color: rgba(255,255,255,0.6);
    font-size: 0.75rem;
}

.rates-value {
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
