:root {
    --primary: #012A60;
    --primary-light: #0d47a1;
    --accent: #e30613;
    --danger: #e53935;
    --bg: #f5f7fb;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body { background-color: var(--bg); font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }

.bg-primary-custom { background-color: var(--primary) !important; }

/* KPI Cards */
.kpi-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: transform 0.15s ease;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-card .kpi-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.kpi-card .kpi-label { font-size: 0.85rem; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-card .kpi-icon { font-size: 2.5rem; opacity: 0.15; }

.card-custom { background: #fff; border-radius: 12px; box-shadow: var(--card-shadow); border: none; }

/* Status badges */
.badge-created { background-color: #42a5f5; }
.badge-sent { background-color: #7e57c2; }
.badge-paid { background-color: #66bb6a; }
.badge-expired { background-color: #bdbdbd; }
.badge-failed { background-color: #e53935; }

/* Tables */
.table-custom th { background: var(--primary); color: #fff; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; border: none; }
.table-custom td { vertical-align: middle; }

/* Buttons */
.btn-primary-custom { background-color: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary-custom:hover { background-color: var(--primary-light); border-color: var(--primary-light); color: #fff; }

.form-card { background: #fff; border-radius: 12px; box-shadow: var(--card-shadow); padding: 32px; }

/* QR */
.qr-display { text-align: center; padding: 24px; background: #fff; border-radius: 12px; box-shadow: var(--card-shadow); }
.qr-display img { width: 200px; height: 200px; }

/* ========================================
   MODERN LOGIN PAGE
   ======================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    background: #f0f2f5;
    overflow: hidden;
}

/* Left panel - branding */
.login-brand-panel {
    flex: 1;
    background: linear-gradient(145deg, #012A60 0%, #0a3d7a 40%, #0d47a1 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.login-brand-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(227,6,19,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.login-brand-panel::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
}

.login-brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
}

.login-brand-content img {
    width: 220px;
    margin-bottom: 32px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.login-brand-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.login-brand-content p {
    font-size: 1.05rem;
    opacity: 0.8;
    max-width: 320px;
    line-height: 1.6;
}

.login-brand-features {
    margin-top: 48px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-brand-features .feature {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
}

.login-brand-features .feature-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

/* Right panel - form */
.login-form-panel {
    width: 480px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    background: #fff;
}

.login-form-header {
    margin-bottom: 36px;
}

.login-form-header .subtitle {
    font-size: 0.85rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.login-form-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
}

.login-form-header .desc {
    color: #888;
    font-size: 0.9rem;
}

/* Form inputs */
.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.login-form .form-control {
    border: 2px solid #e8ecf0;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #fafbfc;
}

.login-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(1,42,96,0.1);
    background: #fff;
}

.login-form .input-icon-wrapper {
    position: relative;
}

.login-form .input-icon-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #aab;
    font-size: 1rem;
}

.login-form .input-icon-wrapper .form-control {
    padding-left: 44px;
}

/* Login button */
.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    background: #c50510;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(227,6,19,0.35);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    margin-top: 32px;
    text-align: center;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s;
}

.login-footer a:hover {
    color: var(--accent);
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #ccc;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8ecf0;
}

.login-divider span {
    padding: 0 16px;
}

/* Alert */
.login-alert {
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 16px;
    color: #dc2626;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Mobile responsive */
@media (max-width: 992px) {
    .login-page { flex-direction: column; }
    .login-brand-panel {
        padding: 40px 30px;
        min-height: auto;
    }
    .login-brand-content img { width: 160px; margin-bottom: 16px; }
    .login-brand-content h1 { font-size: 1.6rem; }
    .login-brand-features { display: none; }
    .login-form-panel {
        width: 100%;
        padding: 40px 30px;
    }
}

@media (max-width: 768px) {
    .kpi-card .kpi-value { font-size: 1.5rem; }
}

/* ============================================================
   CrediMax Merchant Portal branding — login pages
   Matches merchantportal-eu.credimax.com.bh (DM Sans, #004B8E
   primary, split artwork layout, Material-style outlined fields)
   ============================================================ */
.cm-login { display:flex; min-height:100vh; font-family:'DM Sans',system-ui,sans-serif; background:#fff; }
.cm-login-art {
    flex:1 1 50%;
    background:#0b0f2b url('../images/credimax-login-bg.jpg') center/cover no-repeat;
    position:relative; min-height:100vh;
}
.cm-login-art .cm-logo { position:absolute; top:36px; left:44px; width:190px; }
.cm-login-formwrap { flex:1 1 50%; display:flex; align-items:center; justify-content:center; padding:32px; background:#fff; }
.cm-login-form { width:100%; max-width:420px; }
.cm-login-form h1 { font-size:1.6rem; font-weight:700; color:#2A3547; margin-bottom:6px; }
.cm-login-form .cm-welcome { font-size:1.05rem; font-weight:700; color:#16355c; margin-bottom:26px; }
.cm-alert-err { background:#fdecec; color:#b02a37; border:1px solid #f5c2c7; border-radius:7px; padding:10px 14px; font-size:.87rem; margin-bottom:18px; }
.cm-fld { position:relative; margin-bottom:18px; }
.cm-fld input {
    width:100%; height:48px; padding:12px 14px; font-size:14px; font-family:inherit;
    color:#2A3547; background:#fff; border:1px solid #d5dae3; border-radius:7px;
    outline:none; transition:border-color .15s;
}
.cm-fld input:focus { border-color:#004B8E; border-width:2px; padding:11px 13px; }
.cm-fld label {
    position:absolute; left:14px; top:50%; transform:translateY(-50%);
    color:#5b6478; font-size:14px; pointer-events:none; transition:all .15s ease;
    background:transparent; padding:0;
}
.cm-fld input:focus + label,
.cm-fld input:not(:placeholder-shown) + label {
    top:0; font-size:11.5px; color:#004B8E; background:#fff; padding:0 5px; left:11px;
}
.cm-forgot { text-align:right; margin:-6px 0 14px; }
.cm-forgot a, .cm-link { color:#748CBB; font-weight:600; font-size:.85rem; text-decoration:none; cursor:pointer; }
.cm-forgot a:hover, .cm-link:hover { color:#004B8E; text-decoration:underline; }
.cm-btn {
    width:100%; height:44px; border:none; border-radius:7px; font-family:inherit;
    font-size:14px; font-weight:500; cursor:pointer; transition:background .15s, opacity .15s;
    background:#004B8E; color:#fff;
}
.cm-btn:hover:not(:disabled) { background:#003d75; }
.cm-btn:disabled { background:rgba(26,27,31,.12); color:rgba(26,27,31,.38); cursor:not-allowed; }
.cm-register { text-align:center; font-size:.86rem; color:#2A3547; margin-top:18px; }
.cm-altline { text-align:center; margin-top:26px; padding-top:16px; border-top:1px solid #eef0f4; font-size:.82rem; }
@media (max-width: 991px) {
    .cm-login { flex-direction:column; }
    .cm-login-art { flex:none; min-height:150px; height:150px; }
    .cm-login-art .cm-logo { top:50%; transform:translateY(-50%); left:32px; width:150px; }
    .cm-login-formwrap { align-items:flex-start; padding-top:44px; }
}

/* CrediMax login tagline (bottom-left of the artwork panel) */
.cm-login-art .cm-tagline {
    position:absolute; left:45px; bottom:40px; margin:0;
    color:#fff; font-size:27px; font-weight:900; font-family:'DM Sans',system-ui,sans-serif;
}
@media (max-width: 991px) {
    .cm-login-art .cm-tagline { display:none; }
}

/* CrediMax auth pages — success alert variant */
.cm-alert-ok { background:#e8f7ee; color:#0f5132; border:1px solid #c8e7d2; border-radius:7px; padding:10px 14px; font-size:.87rem; margin-bottom:18px; }

/* CrediMax auth pages — 2FA / code entry */
.cm-label { display:block; font-size:.8rem; font-weight:600; color:#5b6478; margin-bottom:6px; }
.cm-code {
    width:100%; height:52px; text-align:center; font-size:1.45rem; letter-spacing:8px;
    border:1px solid #d5dae3; border-radius:7px; color:#2A3547; font-family:inherit; outline:none;
    transition:border-color .15s;
}
.cm-code:focus { border-color:#004B8E; border-width:2px; }
.cm-qr { display:block; width:200px; height:200px; border:1px solid #e6e8ee; border-radius:8px; margin:0 auto 16px; }
.cm-secret { display:flex; gap:8px; margin-bottom:16px; }
.cm-secret input {
    flex:1; height:40px; border:1px solid #d5dae3; border-radius:7px; padding:0 12px;
    font-family:Consolas,monospace; font-size:.85rem; letter-spacing:1px; color:#2A3547; background:#f8f9fc;
}
.cm-secret button { border:1px solid #d5dae3; background:#fff; border-radius:7px; width:44px; cursor:pointer; color:#5b6478; }
.cm-secret button:hover { border-color:#004B8E; color:#004B8E; }
.cm-note { font-size:.83rem; color:#5b6478; margin-bottom:18px; line-height:1.5; }
