/* ===== BASE ===== */
:root {
    --brand: #1a56db;
    --brand-dark: #1040a0;
    --brand-light: #e8effc;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --body-bg: #f1f5f9;
    --card-border: #e2e8f0;
    --success: #059669;
    --danger: #dc2626;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --radius: 8px;
}

html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 15px; } }

body {
    background: var(--body-bg);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
}

/* ===== NAVBAR ===== */
.navbar-mds {
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #0f172a 100%);
    padding: .6rem 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.navbar-mds .navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -.3px;
    color: #fff;
}

.navbar-mds .nav-link {
    color: var(--sidebar-text) !important;
    font-weight: 500;
    font-size: .875rem;
    padding: .4rem .85rem !important;
    border-radius: 6px;
    transition: all .15s;
}

.navbar-mds .nav-link:hover,
.navbar-mds .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,.08);
}

.navbar-mds .user-badge {
    color: var(--sidebar-text);
    font-size: .8rem;
    padding: .25rem .6rem;
    background: rgba(255,255,255,.06);
    border-radius: 6px;
}

/* ===== CARDS ===== */
.card {
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    background: #fff;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    font-size: .875rem;
    color: var(--text-primary);
    padding: .65rem 1rem;
}

.card-header .card-icon {
    width: 20px;
    height: 20px;
    margin-right: 6px;
    opacity: .6;
}

/* ===== FORM CONTROLS ===== */
.form-label {
    font-weight: 500;
    font-size: .8rem;
    color: var(--text-secondary);
    margin-bottom: .25rem;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.form-control, .form-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: .5rem .75rem;
    font-size: .9rem;
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

.form-control.input-error,
.form-select.input-error,
.input-validation-error {
    border-color: var(--danger) !important;
    background: #fef2f2;
}

.field-validation-error {
    color: var(--danger);
    font-size: .78rem;
    margin-top: 2px;
    display: block;
}

/* Hide the validation summary completely */
.validation-summary-errors,
.validation-summary-valid {
    display: none !important;
}

/* ===== BUTTONS ===== */
.btn-brand {
    background: var(--brand);
    color: #fff;
    border: none;
    font-weight: 600;
    padding: .6rem 1.5rem;
    border-radius: 6px;
    transition: all .15s;
}

.btn-brand:hover {
    background: var(--brand-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,86,219,.25);
}

.btn-brand:disabled {
    opacity: .65;
    transform: none;
    box-shadow: none;
}

.btn-submit-order {
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    padding: .75rem 2rem;
    border-radius: var(--radius);
    transition: all .2s;
    letter-spacing: .3px;
}

.btn-submit-order:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(5,150,105,.3);
    color: #fff;
}

.btn-submit-order:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.btn-submit-order .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
    margin-right: .5rem;
}

/* ===== SECTION HEADERS ===== */
.section-card {
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    background: #fff;
    margin-bottom: 1rem;
}

.section-card .section-header {
    padding: .6rem 1rem;
    font-weight: 600;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--card-border);
    background: #f8fafc;
}

.section-card .section-body {
    padding: 1rem;
}

/* ===== TABLES ===== */
.table-mds thead {
    background: var(--sidebar-bg);
    color: #fff;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.table-mds thead th {
    font-weight: 600;
    padding: .6rem .75rem;
    border: none;
}

.table-mds tbody td {
    padding: .55rem .75rem;
    vertical-align: middle;
    font-size: .875rem;
    border-color: #f1f5f9;
}

.table-mds tbody tr:hover {
    background: var(--brand-light);
}

/* Wide tables (Transactions) scroll sideways, which pushes the row action out of view.
   The action sits in the first column and stays pinned while the rest of the row scrolls;
   the whole row is also clickable. Sticky cells need an opaque background of their own,
   otherwise the scrolling columns show through them. */
.table-mds tbody tr.row-link {
    cursor: pointer;
}

.table-mds .col-view {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
}

.table-mds thead th.col-view {
    background: var(--sidebar-bg);
    z-index: 3;
}

.table-mds tbody tr:hover .col-view {
    background: var(--brand-light);
}

/* ===== BADGES ===== */
.badge-approved {
    background: #ecfdf5;
    color: var(--success);
    font-weight: 600;
    font-size: .78rem;
    padding: .3rem .6rem;
    border-radius: 4px;
}

.badge-declined {
    background: #fef2f2;
    color: var(--danger);
    font-weight: 600;
    font-size: .78rem;
    padding: .3rem .6rem;
    border-radius: 4px;
}

/* Blocked-bank submissions stopped before the gateway */
.badge-blocked {
    background: #1e293b;
    color: #fbbf24;
    font-weight: 600;
    font-size: .78rem;
    padding: .3rem .6rem;
    border-radius: 4px;
}

.badge-role {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 600;
    font-size: .78rem;
    padding: .3rem .6rem;
    border-radius: 4px;
}

.badge-active {
    background: #ecfdf5;
    color: var(--success);
    font-weight: 600;
}

.badge-inactive {
    background: #f1f5f9;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ===== PAGE HEADERS ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--card-border);
}

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

/* ===== FILTER BAR ===== */
.filter-bar {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
}

/* ===== LOGIN ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #0f172a 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    overflow: hidden;
}

.login-card .login-header {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    padding: 1.5rem;
    text-align: center;
}

.login-card .login-header h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.15rem;
}

.login-card .login-body {
    padding: 1.5rem;
}

/* ===== RESULT CARD ===== */
.result-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

.result-card .result-header {
    padding: 1.25rem 1.5rem;
    color: #fff;
}

.result-card .result-header.approved {
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
}

.result-card .result-header.declined {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
}

.result-card .result-header h4 {
    margin: 0;
    font-weight: 700;
}

.result-card .result-body {
    padding: 1.25rem 1.5rem;
}

.result-card .result-body .detail-row {
    display: flex;
    justify-content: space-between;
    padding: .5rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.result-card .result-body .detail-row:last-child {
    border-bottom: none;
}

.result-card .result-body .detail-label {
    color: var(--text-secondary);
    font-size: .85rem;
    font-weight: 500;
}

.result-card .result-body .detail-value {
    font-weight: 600;
    font-size: .9rem;
}

/* ===== ALERTS ===== */
.alert-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    min-width: 320px;
    animation: slideIn .3s ease;
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== PAGINATION ===== */
.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-primary);
    border-color: var(--card-border);
}

.pagination .page-item.active .page-link {
    background: var(--brand);
    border-color: var(--brand);
}

/* ===== SERVER ERROR TOAST ===== */
.server-error-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 400px;
    max-width: 600px;
    animation: fadeDown .3s ease;
    border: none;
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
    background: #fff;
    padding: .75rem 1rem;
}

@keyframes fadeDown {
    from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ===== FOOTER ===== */
.footer-mds {
    background: #fff;
    border-top: 1px solid var(--card-border);
    padding: .75rem 0;
    font-size: .8rem;
    color: var(--text-secondary);
}

/* ===== SEARCHABLE DROPDOWN ===== */
.searchable-dropdown {
    position: relative;
}

.searchable-dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1060;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    max-height: 240px;
    overflow-y: auto;
    margin-top: 2px;
}

.searchable-dropdown-item {
    padding: .4rem .75rem;
    font-size: .85rem;
    cursor: pointer;
    border-bottom: 1px solid #f8fafc;
}

.searchable-dropdown-item:hover {
    background: var(--brand-light);
    color: var(--brand);
}

.searchable-dropdown-item:last-child {
    border-bottom: none;
}

.searchable-dropdown-empty {
    padding: .6rem .75rem;
    font-size: .82rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ===== UTILITY ===== */
.text-truncate-sm { max-width: 160px; }
code { font-size: .82rem; background: #f1f5f9; padding: 2px 6px; border-radius: 3px; }
