/* ===========================================
   FullCRM Login — Enterprise Design System
   =========================================== */

/* === Design Tokens === */
:root {
    --login-bg: #F8FAFC;
    --login-card-bg: #FFFFFF;
    --login-text: #0F172A;
    --login-text-muted: #64748B;
    --login-border: #E2E8F0;
    --login-radius: 20px;
    --login-shadow: 0 20px 45px -15px rgba(15, 23, 42, 0.12), 0 0 1px 1px rgba(15, 23, 42, 0.04);
    --login-transition: 0.15s ease;
}

[data-theme="dark"] {
    --login-bg: #0B1120;
    --login-card-bg: #111E38;
    --login-text: #F1F5F9;
    --login-text-muted: #94A3B8;
    --login-border: rgba(255, 255, 255, 0.1);
    --login-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* === Base Page with Ambient Mesh Lighting === */
.login-page body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: #f8fafc;
    background-image: 
        radial-gradient(at 0% 0%, rgba(2, 132, 199, 0.08) 0px, transparent 55%),
        radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.07) 0px, transparent 50%),
        radial-gradient(at 50% 30%, rgba(245, 158, 11, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; margin: 0;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease;
}

[data-theme="dark"].login-page body {
    background-color: #0b1120;
    background-image: 
        radial-gradient(at 0% 0%, rgba(2, 132, 199, 0.15) 0px, transparent 55%),
        radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.10) 0px, transparent 50%);
}

/* === Card Container === */
.login-wrapper {
    width: 100%; max-width: 450px;
}
.login-card {
    background: var(--login-card-bg);
    border-radius: var(--login-radius);
    box-shadow: var(--login-shadow);
    border: 1px solid rgba(226, 232, 240, 0.95);
    overflow: hidden;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
[data-theme="dark"] .login-card {
    border-color: rgba(255, 255, 255, 0.1);
}
.login-card:has(.broker-login-card) {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

/* === Executive Card Header === */
.executive-login-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 34px 28px 26px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.executive-login-header::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.22) 0%, rgba(56, 189, 248, 0) 70%);
    border-radius: 50%;
}
.executive-login-header::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: -40px;
    width: 130px;
    height: 130px;
    background: radial-gradient(circle, rgba(2, 132, 199, 0.18) 0%, rgba(2, 132, 199, 0) 70%);
    border-radius: 50%;
}
.executive-brand-icon {
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.3);
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}
.executive-company-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 800;
    font-size: 21px;
    letter-spacing: -0.4px;
    color: #ffffff;
    margin-bottom: 4px;
    position: relative;
    z-index: 2;
}
.executive-portal-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: #38bdf8;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}
.executive-header-subtext {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 0;
    line-height: 1.45;
    position: relative;
    z-index: 2;
}

/* === Legacy Header compatibility === */
.login-card-header {
    padding: 32px 28px 24px;
    text-align: center;
}
.login-card-header .login-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #FFF;
    margin-bottom: 16px;
}
.login-card-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700; font-size: 1.25rem;
    color: var(--login-text); margin: 0;
}
.login-card-header p {
    color: var(--login-text-muted); font-size: 0.85rem;
    margin: 6px 0 0; line-height: 1.5;
}

/* === Card Body === */
.login-card-body {
    padding: 24px 28px 28px;
}

/* === Form Inputs with Icon Wrapping === */
.input-icon-wrap {
    position: relative;
}
.input-icon-wrap .form-control {
    padding-left: 40px !important;
    font-size: 13px !important;
    height: 44px;
    border-radius: 10px;
    border-color: #cbd5e1;
    color: #0f172a;
    transition: all 0.2s;
}
[data-theme="dark"] .input-icon-wrap .form-control {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
}
.input-icon-wrap .form-control:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.15);
}
.input-icon-wrap .icon-prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 15px;
    pointer-events: none;
}
.pw-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pw-toggle-btn:hover { color: #334155; }

/* === Global Placeholder Text Size Standardization === */
::placeholder,
::-webkit-input-placeholder,
::-moz-placeholder,
:-ms-input-placeholder {
    font-size: 11.5px !important;
    color: #94a3b8 !important;
    font-weight: 400 !important;
}

/* === Tenant ID Box === */
.login-tenant-box {
    background: #f8fafc; border: 1px solid var(--login-border);
    border-radius: 10px; padding: 12px 14px; margin-bottom: 18px;
}
[data-theme="dark"] .login-tenant-box {
    background: #0f172a;
}
.login-tenant-box label {
    font-weight: 600; font-size: 0.75rem; color: var(--login-text);
    margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.login-tenant-box .hint {
    font-size: 0.68rem; color: var(--login-text-muted);
    display: block; margin-top: 5px;
}

/* === Submit Button === */
.login-submit-btn, .login-btn {
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    border: 1px solid #0284c7;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}
.login-submit-btn:hover, .login-btn:hover {
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45);
    color: #ffffff;
}
.login-submit-btn:active, .login-btn:active {
    transform: translateY(0);
}

/* === Extra Row === */
.login-extra {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px; font-size: 0.8rem;
}
.login-extra label {
    display: flex; align-items: center; gap: 6px;
    color: var(--login-text-muted); cursor: pointer; font-weight: 500;
}
.login-extra input[type="checkbox"] { accent-color: #0284c7; }
.login-forgot-link {
    color: #0284c7; text-decoration: none; font-weight: 600;
}
.login-forgot-link:hover { text-decoration: underline; }

/* === Alerts === */
.login-alert {
    border-radius: 10px; padding: 11px 14px; margin-bottom: 16px;
    font-size: 0.82rem; font-weight: 500; display: flex; align-items: center; gap: 8px;
}
.login-alert-danger {
    background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA;
}
[data-theme="dark"] .login-alert-danger {
    background: #3B1515; color: #FCA5A5; border-color: #7F1D1D;
}
.login-alert-success {
    background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0;
}
[data-theme="dark"] .login-alert-success {
    background: #0A2E15; color: #86EFAC; border-color: #14532D;
}

/* === Portal Quick Directory === */
.portal-quick-directory {
    border-top: 1px solid #f1f5f9;
    padding: 18px 28px 24px;
    background: #fafbfc;
}
[data-theme="dark"] .portal-quick-directory {
    background: #0b1329;
    border-color: rgba(255, 255, 255, 0.08);
}
.portal-quick-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}
.portal-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.portal-quick-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 7px 11px;
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: #334155;
    font-size: 11.5px;
    font-weight: 600;
    transition: all 0.2s ease;
}
[data-theme="dark"] .portal-quick-pill {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}
.portal-quick-pill:hover {
    border-color: #0284c7;
    color: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.portal-quick-pill.highlight {
    background: rgba(2, 132, 199, 0.06);
    border-color: rgba(2, 132, 199, 0.25);
    color: #0284c7;
}
.portal-quick-pill.highlight:hover {
    background: rgba(2, 132, 199, 0.12);
}

.login-copyright-text {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    margin-top: 14px;
}

/* === Legacy Footer Links === */
.login-footer {
    text-align: center; padding: 0 28px 20px;
    font-size: 0.8rem; color: var(--login-text-muted);
}
.login-footer a {
    color: #0284c7; text-decoration: none; font-weight: 600;
}
.login-footer a:hover { text-decoration: underline; }

.login-portal-links {
    display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
    padding: 0 28px 24px; font-size: 0.72rem;
}
.login-portal-links a {
    color: var(--login-text-muted); text-decoration: none; font-weight: 500;
}
.login-portal-links a:hover { color: #0284c7; }
.login-portal-links span { color: var(--login-border); }

/* === Theme Toggle === */
.login-theme-btn {
    position: fixed; top: 20px; right: 20px; z-index: 10;
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--login-card-bg); border: 1px solid var(--login-border);
    color: var(--login-text-muted); font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.login-theme-btn:hover { border-color: #0284c7; color: #0284c7; }

/* === Animations === */
@keyframes loginFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-stagger-1 { animation: loginFadeUp 0.35s ease both; animation-delay: 0.04s; }
.login-stagger-2 { animation: loginFadeUp 0.35s ease both; animation-delay: 0.10s; }
.login-stagger-3 { animation: loginFadeUp 0.35s ease both; animation-delay: 0.16s; }
.login-stagger-4 { animation: loginFadeUp 0.35s ease both; animation-delay: 0.22s; }
.login-stagger-5 { animation: loginFadeUp 0.35s ease both; animation-delay: 0.28s; }

/* === Responsive === */
@media (max-width: 480px) {
    .executive-login-header { padding: 28px 20px 22px; }
    .login-card-body { padding: 20px 20px 24px; }
    .portal-quick-directory { padding: 16px 20px 20px; }
    .login-wrapper { max-width: 100%; }
}

[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px #0f172a inset !important;
    -webkit-text-fill-color: #f1f5f9 !important;
}
