/* =====================================================================
   Japan Arch – theme
   Crimson Red #C91D2E · Deep Charcoal #1A1A1A · Clean White
   ===================================================================== */
:root {
    --ja-red: #C91D2E;
    --ja-red-dark: #A3151F;
    --ja-red-soft: #FBEAEC;
    --ja-dark: #1A1A1A;
    --ja-dark-2: #262626;
    --ja-gray: #F4F5F7;
    --ja-border: #E6E8EC;
    --sidebar-w: 260px;
    --bs-primary: #C91D2E;
    --bs-primary-rgb: 201, 29, 46;
    --bs-link-color: #C91D2E;
    --bs-link-hover-color: #A3151F;
    --bs-font-sans-serif: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body { font-family: var(--bs-font-sans-serif); color: var(--ja-dark); }
.jp { font-family: 'Noto Sans JP', sans-serif; }

/* ---------- Utilities ---------- */
.text-ja-red { color: var(--ja-red) !important; }
.bg-ja-red { background-color: var(--ja-red) !important; }
.bg-ja-dark { background-color: var(--ja-dark) !important; color: #fff; }
.bg-ja-red-soft { background-color: var(--ja-red-soft) !important; }
.bg-ja-purple { background-color: #6F42C1 !important; color: #fff !important; }
.bg-ja-green { background-color: #0F6B3E !important; color: #fff !important; }

.btn-ja {
    --bs-btn-color: #fff; --bs-btn-bg: var(--ja-red); --bs-btn-border-color: var(--ja-red);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--ja-red-dark); --bs-btn-hover-border-color: var(--ja-red-dark);
    --bs-btn-active-bg: var(--ja-red-dark); --bs-btn-active-border-color: var(--ja-red-dark);
    --bs-btn-disabled-bg: var(--ja-red); --bs-btn-disabled-border-color: var(--ja-red);
}
.form-control:focus, .form-select:focus {
    border-color: rgba(201, 29, 46, .5);
    box-shadow: 0 0 0 .2rem rgba(201, 29, 46, .15);
}
.form-check-input:checked { background-color: var(--ja-red); border-color: var(--ja-red); }

/* =====================================================================
   ERP LAYOUT
   ===================================================================== */
.erp-body { background: var(--ja-gray); }
.erp-wrapper { display: flex; min-height: 100vh; }

.erp-sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: var(--ja-dark); color: #fff;
    position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1040;
    transition: transform .25s ease;
}
.erp-brand {
    display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px;
    color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
    width: 40px; height: 40px; border-radius: 50%; background: var(--ja-red); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.brand-name { display: block; font-weight: 700; font-size: 1.1rem; line-height: 1.1; }
.brand-sub  { display: block; font-size: .72rem; color: rgba(255,255,255,.55); font-family: 'Noto Sans JP', sans-serif; }

.erp-nav { padding: 12px 12px; overflow-y: auto; flex-grow: 1; }
.erp-nav-section { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.4); padding: 14px 12px 6px; }
.erp-nav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px;
    border-radius: 8px; color: rgba(255,255,255,.75); text-decoration: none; font-size: .92rem; transition: background .15s, color .15s;
}
.erp-nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.erp-nav-link.active { background: var(--ja-red); color: #fff; box-shadow: 0 6px 16px rgba(201,29,46,.35); }
.erp-sidebar-foot { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,.08); }

.erp-main { flex-grow: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.erp-topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 8px;
    background: #fff; padding: 14px 28px; border-bottom: 1px solid var(--ja-border);
}
.erp-page-title { font-size: 1.3rem; font-weight: 700; }
.erp-content { padding: 28px; flex-grow: 1; }
.erp-footer { padding: 14px 28px; font-size: .8rem; color: #888; border-top: 1px solid var(--ja-border); background: #fff; display: flex; gap: 6px; }

.erp-backdrop { display: none; }
@media (max-width: 991.98px) {
    .erp-sidebar { transform: translateX(-100%); }
    .erp-sidebar.show { transform: translateX(0); }
    .erp-main { margin-left: 0; }
    .erp-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
    .erp-content { padding: 18px; }
    .erp-topbar { padding: 12px 16px; }
}

.avatar-circle {
    width: 32px; height: 32px; border-radius: 50%; background: var(--ja-red); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem;
}

/* Japanese-themed header chips */
.jp-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
    background: var(--ja-gray); border: 1px solid var(--ja-border); font-size: .82rem; font-weight: 600; color: var(--ja-dark);
}
.jp-chip .jp { font-size: .72rem; padding: 1px 6px; border-radius: 4px; background: var(--ja-dark); color: #fff; }
.jp-chip-warn .jp { background: #D39E00; }
.jp-chip-red .jp  { background: var(--ja-red); }

/* ---------- Cards ---------- */
.erp-card { border: 1px solid var(--ja-border); border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); overflow: hidden; }
.erp-card > .card-header { background: #fff; font-weight: 600; padding: 14px 18px; border-bottom: 1px solid var(--ja-border); }
.erp-card > .card-header.bg-ja-dark { background: var(--ja-dark) !important; }
.step-num {
    display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--ja-red); color: #fff;
    align-items: center; justify-content: center; font-size: .78rem; margin-right: 6px;
}

.kpi-card {
    display: flex; gap: 16px; align-items: center; background: #fff; border: 1px solid var(--ja-border);
    border-radius: 12px; padding: 18px; height: 100%; position: relative; overflow: hidden;
}
.kpi-card::after {
    content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%;
    background: var(--ja-red); opacity: .05;
}
.kpi-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.kpi-label { font-size: .8rem; color: #6c757d; font-weight: 500; }
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.kpi-foot  { font-size: .76rem; color: #8a8f98; }

.mini-stat { background: #fff; border: 1px solid var(--ja-border); border-radius: 10px; padding: 12px 16px; }
.mini-stat small { display: block; color: #6c757d; font-size: .76rem; }
.mini-stat strong { font-size: 1.15rem; }

.balance-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: var(--ja-gray); border-radius: 10px; padding: 10px 12px; }
.balance-box small { display: block; font-size: .7rem; color: #6c757d; }
.balance-box strong { font-size: .9rem; }

/* ---------- Tables ---------- */
.erp-table thead th {
    background: #FAFAFB; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
    color: #6c757d; font-weight: 600; border-bottom-width: 1px; white-space: nowrap;
}
.erp-table td { font-size: .9rem; }
div.dt-container .dt-search input { border-radius: 8px; }
div.dt-container .page-item.active .page-link { background: var(--ja-red); border-color: var(--ja-red); }

/* Payment method badges */
.method-cash          { background: #495057; }
.method-bank-transfer { background: #0D6EFD; }
.method-bkash         { background: #E2136E; }
.method-nagad         { background: #F6921E; }

/* ---------- Visa pipeline colors ---------- */
.stage-lead          { background-color: #6C757D !important; }
.stage-enrolled      { background-color: #0D6EFD !important; }
.stage-documents     { background-color: #0DCAF0 !important; color: #000 !important; }
.stage-coe_applied   { background-color: #FFC107 !important; color: #000 !important; }
.stage-coe_received  { background-color: #6F42C1 !important; }
.stage-visa_stamping { background-color: #198754 !important; }
.stage-flight_ready  { background-color: #0F6B3E !important; }

.pipeline-bar { border-radius: 8px; background: var(--ja-gray); }
.pipeline-bar .progress-bar { font-weight: 600; font-size: .8rem; }
.pipeline-steps { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; position: relative; }
.pipeline-steps::before {
    content: ''; position: absolute; top: 22px; left: 7%; right: 7%; height: 2px; background: var(--ja-border); z-index: 0;
}
.pipeline-step { text-align: center; color: var(--ja-dark); position: relative; z-index: 1; }
.pipeline-step:hover .step-dot { transform: scale(1.08); }
.step-dot {
    width: 44px; height: 44px; border-radius: 50%; color: #fff; margin: 0 auto 6px;
    display: flex; align-items: center; justify-content: center; border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.12); transition: transform .15s;
}
.step-count { font-weight: 700; font-size: 1.15rem; }
.step-label { font-size: .74rem; color: #6c757d; }
@media (max-width: 767.98px) {
    .pipeline-steps { grid-template-columns: repeat(4, 1fr); row-gap: 16px; }
    .pipeline-steps::before { display: none; }
}

.visa-stage-options .btn-check:checked + .btn { background: var(--ja-red); border-color: var(--ja-red); color: #fff; }

/* ---------- Student journey ---------- */
.journey { display: flex; justify-content: space-between; position: relative; gap: 6px; }
.journey::before { content: ''; position: absolute; top: 22px; left: 5%; right: 5%; height: 3px; background: var(--ja-border); }
.journey-step { flex: 1; text-align: center; position: relative; }
.journey-dot {
    width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: #fff; border: 3px solid var(--ja-border); color: #adb5bd; position: relative;
}
.journey-step.done .journey-dot { background: var(--ja-dark); border-color: var(--ja-dark); color: #fff; }
.journey-step.current .journey-dot { background: var(--ja-red); border-color: var(--ja-red); color: #fff; box-shadow: 0 0 0 6px rgba(201,29,46,.15); }
.journey-label { font-size: .74rem; color: #6c757d; }
.journey-step.current .journey-label { color: var(--ja-red); font-weight: 600; }
@media (max-width: 767.98px) {
    .journey { flex-direction: column; }
    .journey::before { display: none; }
    .journey-step { display: flex; align-items: center; gap: 12px; text-align: left; }
    .journey-dot { margin: 0; }
}

/* =====================================================================
   LOGIN
   ===================================================================== */
.login-body {
    min-height: 100vh;
    background: radial-gradient(circle at 85% 15%, rgba(201,29,46,.35), transparent 40%), var(--ja-dark);
}
.login-card { border-radius: 16px; }
.login-brand {
    background: linear-gradient(160deg, var(--ja-red) 0%, var(--ja-red-dark) 100%); color: #fff;
    padding: 48px; align-items: center; position: relative; overflow: hidden;
}
.login-brand::after {
    content: '日本'; font-family: 'Noto Sans JP', sans-serif; font-weight: 900; position: absolute;
    right: -20px; bottom: -40px; font-size: 9rem; opacity: .08; line-height: 1;
}
.hinomaru { width: 64px; height: 64px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 16px #fff, inset 0 0 0 40px var(--ja-red); }

/* ---------- Print (ERP pages) ---------- */
@media print {
    .erp-sidebar, .erp-topbar, .erp-footer, .btn, form .dt-search { display: none !important; }
    .erp-main { margin: 0; }
}
