/* =========================================================
   Dolph CRM Pro — Premium Login Page
   File: login.css
   Purpose: responsive, modern, readable login UI
   ========================================================= */

/* ------------------------------
   Design Tokens
------------------------------ */
:root {
    --login-primary: var(--login-accent-color, #2563eb);
    --login-primary-dark: #0f3ea8;
    --login-primary-soft: rgba(37, 99, 235, 0.12);

    --login-bg: var(--login-bg-color, #071426);
    --login-card-bg: var(--login-card-color, #ffffff);

    --login-text: #0f172a;
    --login-muted: #64748b;
    --login-border: rgba(226, 232, 240, 0.92);
    --login-shadow: 0 28px 80px rgba(15, 23, 42, 0.18);

    --login-radius-xl: 34px;
    --login-radius-lg: 24px;
    --login-radius-md: 18px;

    --login-page-padding: clamp(16px, 3vw, 46px);
    --login-card-max-width: 470px;
}

/* ------------------------------
   Reset / Base
------------------------------ */
* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--login-text);
    font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at 12% 14%, rgba(59, 130, 246, 0.32), transparent 28rem),
        radial-gradient(circle at 88% 84%, rgba(6, 182, 212, 0.22), transparent 26rem),
        linear-gradient(135deg, #071426 0%, var(--login-bg) 42%, #eef5ff 100%);
}

/* ------------------------------
   Page Layout
------------------------------ */
.login-shell {
    position: relative;
    display: grid;
    grid-template-columns: var(--login-side-columns, 1.08fr 0.92fr);
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: var(--login-page-padding);
    gap: clamp(18px, 3vw, 38px);
}

.login-shell::before,
.login-shell::after {
    position: fixed;
    z-index: 0;
    width: 320px;
    height: 320px;
    border-radius: 999px;
    pointer-events: none;
    content: "";
    filter: blur(8px);
}

.login-shell::before {
    top: -120px;
    inset-inline-start: -90px;
    background: rgba(37, 99, 235, 0.18);
}

.login-shell::after {
    right: auto;
    bottom: -120px;
    inset-inline-end: -70px;
    background: rgba(20, 184, 166, 0.16);
}

.login-shell > * {
    position: relative;
    z-index: 1;
}

/* Switch form / brand position from settings */
.login-form-position-left .login-shell {
    direction: ltr;
}

.login-form-position-left .brand-side,
.login-form-position-left .form-side {
    direction: rtl;
}

/* Form only layout */
.login-layout-form_only .login-shell {
    grid-template-columns: 1fr;
}

.login-layout-form_only .form-side {
    justify-content: center;
}

/* ------------------------------
   Brand Side Panel
------------------------------ */
.brand-side {
    display: flex;
    align-items: stretch;
    min-height: min(720px, calc(100vh - 90px));
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--login-radius-xl);
    overflow: hidden;
    color: #ffffff;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)),
        linear-gradient(135deg, rgba(8, 20, 42, 0.95), rgba(18, 58, 140, 0.9) 52%, rgba(37, 99, 235, 0.88));
    box-shadow: var(--login-shadow);
    backdrop-filter: blur(18px);
}

.brand-content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    padding: clamp(28px, 5vw, 62px);
}

.brand-content::after {
    position: absolute;
    width: 220px;
    height: 220px;
    top: 34px;
    inset-inline-start: 34px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    content: "";
}

.brand-logo {
    display: inline-grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin-bottom: 24px;
    border-radius: 24px;
    color: #ffffff;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08));
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}

.brand-logo i {
    font-size: 34px;
    line-height: 1;
}

.brand-title {
    max-width: 680px;
    margin-bottom: 16px;
    font-size: clamp(30px, 4.2vw, 58px);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.04em;
}

.brand-text {
    max-width: 640px;
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: clamp(15px, 1.3vw, 18px);
    font-weight: 600;
    line-height: 1.9;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: clamp(26px, 4vw, 44px);
}

.feature {
    min-height: 144px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.09);
    backdrop-filter: blur(12px);
}

.feature i {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    font-size: 20px;
}

.feature h6 {
    margin-bottom: 8px;
    color: #ffffff;
    font-size: 15px;
}

.feature small {
    display: block;
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.8;
}

/* ------------------------------
   Form Side / Card
------------------------------ */
.form-side {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

.login-card {
    width: min(100%, var(--login-card-max-width));
    margin-inline: auto;
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid var(--login-border);
    border-radius: var(--login-radius-xl);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92)),
        var(--login-card-bg);
    box-shadow: var(--login-shadow);
    backdrop-filter: blur(18px);
}

.login-card-header {
    margin-bottom: 28px;
    text-align: center;
}

.login-card-brand-logo {
    display: grid;
    place-items: center;
    width: 82px;
    height: 82px;
    margin: 0 auto 18px;
    border-radius: 26px;
    color: #ffffff;
    background:
        linear-gradient(135deg, var(--login-primary), #06b6d4);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.28);
}

.login-card-brand-logo img {
    max-width: 68px;
    max-height: 68px;
    object-fit: contain;
}

.login-card-brand-logo i {
    font-size: 34px;
}

.login-card h1 {
    margin: 0 0 10px;
    color: var(--login-text);
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 900;
    letter-spacing: -0.035em;
}

.login-card .sub {
    max-width: 360px;
    margin-inline: auto;
    color: var(--login-muted);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.8;
}

/* ------------------------------
   Form Controls
------------------------------ */
.login-form {
    margin-top: 10px;
}

.form-field {
    margin-bottom: 18px;
}

.form-label {
    margin-bottom: 8px;
    color: #1e293b;
    font-size: 14px;
    font-weight: 800;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-wrap .form-control {
    width: 100%;
    min-height: 54px;
    padding: 0 48px 0 16px;
    border: 1px solid #dbe5f2;
    border-radius: 18px !important;
    color: var(--login-text);
    background: #f8fbff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: none;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.login-input-wrap .form-control::placeholder {
    color: #94a3b8;
    font-weight: 600;
}

.login-input-wrap .form-control:focus {
    border-color: var(--login-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.input-icon {
    position: absolute;
    inset-inline-start: 16px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: #64748b;
    pointer-events: none;
}

.password-toggle {
    position: absolute;
    inset-inline-end: 8px;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 14px;
    color: #64748b;
    background: transparent;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.password-toggle:hover {
    color: var(--login-primary);
    background: var(--login-primary-soft);
}

.security-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 11px 13px;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 16px;
    color: #1d4ed8;
    background: rgba(37, 99, 235, 0.08);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.7;
}

.security-note i {
    margin-top: 2px;
}

/* Cloudflare Turnstile responsive wrapper */
.turnstile-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
    overflow-x: auto;
}

/* ------------------------------
   Button
------------------------------ */
.btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 56px;
    border: 0;
    border-radius: 18px;
    color: #ffffff;
    background:
        linear-gradient(135deg, var(--login-primary), var(--login-primary-dark));
    font-size: 16px;
    font-weight: 900;
    box-shadow: 0 18px 34px rgba(37, 99, 235, 0.26);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 44px rgba(37, 99, 235, 0.32);
}

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

.btn-login:disabled {
    cursor: not-allowed;
    opacity: 0.72;
    transform: none;
}

/* ------------------------------
   SweetAlert Improvements
------------------------------ */
.swal2-popup {
    border-radius: 22px !important;
    font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif !important;
}

.swal2-title {
    line-height: 1.6 !important;
}

/* ------------------------------
   Responsive Design
------------------------------ */
@media (max-width: 1199.98px) {
    :root {
        --login-card-max-width: 460px;
    }

    .brand-title {
        font-size: clamp(30px, 4.8vw, 48px);
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    body {
        background:
            radial-gradient(circle at 30% 0%, rgba(59, 130, 246, 0.28), transparent 24rem),
            linear-gradient(180deg, #071426 0%, #0b1b36 34%, #eef5ff 100%);
    }

    .login-shell {
        grid-template-columns: 1fr;
        align-items: start;
        min-height: 100svh;
    }

    .brand-side {
        min-height: auto;
    }

    .brand-content {
        padding: 28px;
    }

    .brand-content::after {
        display: none;
    }

    .brand-title {
        font-size: clamp(25px, 6vw, 36px);
    }

    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-side {
        align-items: flex-start;
    }

    .login-card {
        width: min(100%, 520px);
    }
}

@media (max-width: 767.98px) {
    :root {
        --login-page-padding: 14px;
    }

    .login-shell {
        gap: 14px;
    }

    .brand-side,
    .login-card {
        border-radius: 26px;
    }

    .brand-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 16px;
        border-radius: 20px;
    }

    .brand-logo i {
        font-size: 27px;
    }

    .brand-text {
        font-size: 14px;
    }

    .feature-grid {
        display: none;
    }

    .login-card {
        padding: 24px;
    }

    .login-card-brand-logo {
        width: 72px;
        height: 72px;
        border-radius: 22px;
    }
}

@media (max-width: 575.98px) {
    .brand-side {
        display: none;
    }

    .login-shell {
        align-items: center;
        padding: 14px;
    }

    .login-card {
        padding: 22px;
        border-radius: 24px;
    }

    .login-card h1 {
        font-size: 25px;
    }

    .login-card .sub {
        font-size: 14px;
    }

    .login-input-wrap .form-control {
        min-height: 52px;
        font-size: 14px;
    }

    .btn-login {
        min-height: 54px;
        font-size: 15px;
    }
}

@media (max-width: 380px) {
    .login-card {
        padding: 18px;
    }

    .login-card-brand-logo {
        width: 66px;
        height: 66px;
    }
}

/* ------------------------------
   Accessibility
------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
    }
}
