/* =============================================================
   Login Page — UPRD Super App
   United Plantations Berhad · Doiscode Technology
   ============================================================= */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Inter', sans-serif;
}

body {
    display: flex;
    background: #e3f2fb;
    overflow: hidden;
}

/* =============================================================
   LEFT PANEL
   ============================================================= */
.lp {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding: 36px 48px 28px;
    background: linear-gradient(150deg, #daeef8 0%, #ecf7fd 55%, #f4fbff 100%);
    position: relative;
}

/* — Watermark — */
.lp-watermark {
    position: absolute;
    top: 0;
    right: 0;
    width: 340px;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.lp-watermark svg {
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100%;
    height: 100%;
    opacity: 0.11;
}

/* — Brand — */
.lp-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(41, 171, 226, 0.12);
}
.lp-brand img { height: 42px; }
.lp-brand-divider {
    width: 1px;
    height: 32px;
    background: rgba(41, 171, 226, 0.2);
    flex-shrink: 0;
}
.lp-brand-text strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0d3350;
    line-height: 1.3;
}
.lp-brand-text span {
    font-size: 0.8rem;
    font-weight: 400;
    color: #6a9cb8;
}

/* — Middle (hero + modules, vertically centered) — */
.lp-middle {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 32px;
    position: relative;
    z-index: 1;
}

/* — Hero — */
.lp-hero-welcome {
    font-size: 0.98rem;
    color: #5a8fab;
    font-weight: 400;
    margin-bottom: 6px;
}
.lp-hero-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0b2d45;
    line-height: 1.18;
    letter-spacing: -0.5px;
}
.lp-hero-sub {
    margin-top: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #6a9cb8;
    display: flex;
    align-items: center;
    gap: 8px;
}
.lp-hero-sub::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 2px;
    background: #29abe2;
    border-radius: 2px;
    flex-shrink: 0;
}

/* — Modules — */
.lp-modules {
    position: relative;
    z-index: 1;
}

.main-modules {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Module card */
.mm {
    background: #fff;
    border: 1.5px solid #c8e8f6;
    border-radius: 18px;
    padding: 28px 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: border-color 0.22s, transform 0.18s, box-shadow 0.22s, background 0.22s;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.mm:hover {
    border-color: #29abe2;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(41, 171, 226, 0.18);
}

/* Selected state */
.mm.selected {
    border-color: #29abe2;
    border-width: 2px;
    background: linear-gradient(160deg, #f0faff 0%, #e4f5fd 100%);
    box-shadow: 0 4px 18px rgba(41, 171, 226, 0.22);
    transform: translateY(-2px);
}
.mm.selected .mm-icon {
    background: linear-gradient(145deg, #b8e3f8 0%, #96d5f2 100%);
}
.mm.selected .mm-label { color: #0a6da0; }

/* Selected checkmark badge */
.mm.selected::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    background: #29abe2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/12px no-repeat;
    border-radius: 50%;
}

/* Coming-soon card */
.mm.coming-soon {
    cursor: default;
    opacity: 0.72;
    background: #f7fbfe;
}
.mm.coming-soon:hover {
    transform: none;
    box-shadow: none;
    border-color: #c8e8f6;
}
.mm.coming-soon .mm-icon {
    background: linear-gradient(145deg, #eef5f9 0%, #e4eff5 100%);
    filter: grayscale(0.3);
}

/* "Coming Soon" ribbon on the card */
.mm-badge {
    display: none;
    position: absolute;
    top: 10px;
    right: -1px;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 3px 8px 3px 6px;
    border-radius: 6px 0 0 6px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.35);
}
.mm.coming-soon .mm-badge { display: block; }

/* ── Toast notification ── */
.portal-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a2d3f;
    color: #fff;
    padding: 13px 20px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 9999;
    white-space: nowrap;
}
.portal-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.portal-toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(249, 115, 22, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.portal-toast-icon svg { width: 15px; height: 15px; color: #f97316; }
.portal-toast-text strong {
    display: block;
    font-size: 0.93rem;
    font-weight: 700;
    color: #fff;
}
.portal-toast-text span {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.6);
}
.mm-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(145deg, #dff3fd 0%, #c8eaf8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mm-icon svg { width: 30px; height: 30px; }
.mm-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0d2d45;
    line-height: 1.35;
}
.mm-desc {
    font-size: 0.76rem;
    color: #7aaccb;
    font-weight: 400;
    line-height: 1.4;
    margin-top: -6px;
}

/* — Security Trust Bar — */
.lp-security {
    display: flex;
    gap: 10px;
}
.sec-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(41, 171, 226, 0.15);
    border-radius: 12px;
    padding: 11px 13px;
}
.sec-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sec-icon svg { width: 17px; height: 17px; }
.sec-icon.green  { background: rgba(16, 185, 129, 0.12); color: #059669; }
.sec-icon.blue   { background: rgba(41, 171, 226, 0.13); color: #0e8fc4; }
.sec-icon.orange { background: rgba(251, 146, 60, 0.12);  color: #ea7c2b; }
.sec-text strong {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #0d2d45;
    line-height: 1.25;
}
.sec-text span {
    font-size: 0.71rem;
    color: #7aacc0;
    font-weight: 400;
    line-height: 1.3;
}

/* — Footer — */
.lp-footer {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    margin-top: 14px;
    text-align: center;
    font-size: 0.75rem;
    color: #90bad0;
}
.lp-footer a {
    color: #5aabcc;
    text-decoration: none;
    font-weight: 600;
}

/* =============================================================
   RIGHT PANEL
   ============================================================= */
.rp {
    width: 390px;
    min-width: 390px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 40px 36px;
    box-shadow: -2px 0 24px rgba(41, 171, 226, 0.09);
    position: relative;
    overflow: hidden;
}
.rp::before {
    content: '';
    position: absolute;
    bottom: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, #e3f6fd 0%, transparent 70%);
    pointer-events: none;
}

.rp-inner {
    width: 100%;
    animation: fadeUp 0.4s ease;
    position: relative;
    z-index: 1;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* — Logo — */
.rp-logo {
    text-align: center;
    margin-bottom: 22px;
}
.rp-logo img { height: 48px; }

/* — Heading — */
.rp-heading {
    text-align: center;
    margin-bottom: 28px;
}
.rp-heading h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0b2d45;
    margin-bottom: 4px;
}
.rp-heading p {
    font-size: 0.88rem;
    color: #8cb4c8;
}

/* — Form Fields — */
.field { margin-bottom: 15px; }
.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #3d6a7d;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.iw { position: relative; }
.iw .fi {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #a8cfe0;
    display: flex;
    pointer-events: none;
}
.iw .fi svg { width: 15px; height: 15px; }
.iw input {
    width: 100%;
    height: 44px;
    border: 1.5px solid #d6edf8;
    border-radius: 11px;
    padding: 0 38px;
    font-size: 0.955rem;
    color: #0b2d45;
    background: #f6fbfe;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.iw input::placeholder { color: #b0d5e5; }
.iw input:focus {
    border-color: #29abe2;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(41, 171, 226, 0.11);
}

.btn-eye {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #a8cfe0;
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: color 0.2s;
}
.btn-eye:hover { color: #29abe2; }
.btn-eye svg { width: 15px; height: 15px; }

/* — Cloudflare Turnstile — */
.cf-wrap {
    display: flex;
    justify-content: center;
    margin: 14px 0;
}

/* — Error Alert — */
.alert-err {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff5f5;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 0.88rem;
    margin-bottom: 12px;
}
.alert-err svg { flex-shrink: 0; width: 14px; height: 14px; }

/* — Submit Button — */
.btn-submit {
    width: 100%;
    height: 46px;
    background: linear-gradient(135deg, #1598cc, #29abe2);
    color: #fff;
    border: none;
    border-radius: 11px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(41, 171, 226, 0.38);
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    letter-spacing: 0.2px;
}
.btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(41, 171, 226, 0.48);
}
.btn-submit:active:not(:disabled) { transform: translateY(0); }
.btn-submit:disabled { opacity: 0.65; cursor: not-allowed; }

/* — Loading Spinner — */
.spin {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sp 0.7s linear infinite;
    display: none;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* — Right Panel Footer — */
.rp-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 0.77rem;
    color: #a8cfe0;
}
.rp-footer strong { color: #7aafcc; }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 900px) {
    .lp { display: none; }
    .rp {
        width: 100%;
        min-width: unset;
        background: linear-gradient(160deg, #daeef8, #f4fbff);
        box-shadow: none;
    }
    .rp-inner {
        background: #fff;
        border-radius: 22px;
        padding: 36px 28px;
        box-shadow: 0 4px 30px rgba(41, 171, 226, 0.14);
        max-width: 380px;
    }
}
