/* Login Page Styles */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;

    /* overridden by dynamic-colors.php */
    --login-background: #e6f4ea;
    --login-text: #000000;
    --login-text-secondary: #4b5563;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--login-background);
    color: var(--login-text);
    min-height: 100vh;
}

main {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

nav { display: none; }

/* ── Two-panel container ─────────────────────────── */
.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ── Left: Brand Panel ───────────────────────────── */
.login-brand-panel {
    width: 42%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 44px;
    background: linear-gradient(145deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
    color: white;
    position: relative;
    overflow: hidden;
    animation: slideInLeft 0.6s ease-out both;
}

.login-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 15% 15%, rgba(255,255,255,0.10) 0%, transparent 55%),
        radial-gradient(circle at 85% 85%, rgba(255,255,255,0.06) 0%, transparent 55%);
    pointer-events: none;
}

.login-brand-panel::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: -100px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.10);
    pointer-events: none;
}

.brand-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 300px;
}

.brand-logo-wrap {
    width: 88px;
    height: 88px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    padding: 10px;
    backdrop-filter: blur(6px);
    animation: logo-glow 3.5s ease-in-out infinite;
}

@keyframes logo-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
    50%       { box-shadow: 0 0 26px 6px rgba(255,255,255,0.10); }
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ── Brand name ─────────────────────── */
.brand-name {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: -1.2px;
    margin-bottom: 5px;
    line-height: 1.05;
    color: white;
    text-shadow: 0 2px 12px rgba(0,0,0,0.20);
}

/* Color-coded spans — same palette as sidebar & hero */
.brand-hl { color: #f39c12; font-weight: 900; }
.brand-ac { color: #e74c3c; font-weight: 900; }

/* Inline brand on white backgrounds (subtitle, footer) */
.brand-inline            { font-weight: 700; }
.brand-inline .brand-hl  { color: #f39c12; }
.brand-inline .brand-ac  { color: #e74c3c; }

.brand-tagline {
    font-size: 13px;
    color: rgba(255,255,255,0.70);
    margin-bottom: 0;
    font-weight: 400;
    line-height: 1.5;
}

/* Separator line between tagline & feature list */
.brand-divider {
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.15);
    margin: 16px 0;
}

/* "Powered by" pill — sits below features */
.brand-powered {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 18px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 999px;
    font-size: 10.5px;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.brand-powered strong {
    font-size: 12.5px;
    font-weight: 800;
    color: white;
    letter-spacing: -0.3px;
    text-transform: none;
}

/* "Powered by" in the form-panel footer */
.footer-powered {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--gray-400);
}

.footer-powered-name {
    font-weight: 700;
    color: var(--gray-600);
    font-size: 11.5px;
}

.brand-features {
    list-style: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.brand-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.92;
}

.brand-feature-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.brand-feature-icon svg {
    width: 14px;
    height: 14px;
    color: white;
}

/* ── Right: Form Panel ───────────────────────────── */
.login-form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 56px;
    background: white;
    overflow-y: auto;
    animation: fadeInRight 0.6s ease-out 0.1s both;
}

/* Mobile-only logo row (hidden on desktop) */
.login-mobile-header {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.mobile-logo-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: contain;
}

.mobile-company-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

/* ── Company name display (form panel top) ─────────── */
/* ── Company name card (form panel) ────────────────── */
.company-name-header {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    width: fit-content;
    margin-bottom: 26px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(99,102,241,0.07);
}

.company-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    color: white;
    flex-shrink: 0;
    letter-spacing: -0.5px;
    box-shadow: 0 4px 12px rgba(99,102,241,0.30);
    text-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.company-name-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.company-name-value {
    font-size: 17px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.company-name-label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--gray-400);
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 0;
}

/* Header */
.login-header {
    margin-bottom: 28px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 5px;
    letter-spacing: -0.3px;
}

.login-subtitle {
    color: var(--gray-500);
    font-size: 14px;
}

/* ── Form ────────────────────────────────────────── */
.login-form {
    max-width: 400px;
}

.form-group {
    margin-bottom: 20px;
}

/* Label row: label + forgot-password side by side */
.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.form-group > label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.label-row > label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.required { color: var(--danger); }

.input-wrapper { position: relative; }

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-400);
    pointer-events: none;
}

.form-control {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--gray-50);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.form-control::placeholder { color: var(--gray-400); }

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    line-height: 0;
    transition: color 0.2s;
}

.password-toggle:hover { color: var(--gray-600); }

.forgot-link {
    font-size: 13px;
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Alert */
.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideDown 0.3s ease-out;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Remember Me */
.form-bottom-row {
    margin-bottom: 24px;
}

.remember-me-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.remember-me-label input[type="checkbox"] { display: none; }

.remember-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 5px;
    background: #fff;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.remember-me-label input:checked + .remember-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.remember-me-label input:checked + .remember-checkbox::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.remember-me-label:hover .remember-checkbox { border-color: var(--primary); }

.remember-text {
    font-size: 14px;
    color: var(--gray-600);
}

/* Button */
.btn {
    width: 100%;
    max-width: 400px;
    padding: 13px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-icon { width: 18px; height: 18px; }

.btn-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin: -9px 0 0 -9px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Footer */
.login-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-100);
    max-width: 400px;
    text-align: center;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.footer-link-small {
    color: var(--gray-500);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.footer-link-small:hover { color: var(--primary); }

.divider { color: var(--gray-300); font-size: 12px; }

.footer-copyright p {
    font-size: 12px;
    color: var(--gray-400);
    margin: 3px 0;
}

.footer-version-mini {
    margin-top: 6px;
    font-size: 11px;
    color: var(--gray-400);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── DB Status pill (fixed) ──────────────────────── */
.db-status {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.db-status:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 22px rgba(0,0,0,0.25);
}

.db-connected {
    background: rgba(16,185,129,0.95);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.25);
    animation: pulse-green 2.5s ease-in-out infinite;
}

.db-disconnected {
    background: rgba(239,68,68,0.95);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.25);
    animation: pulse-red 1.2s ease-in-out infinite;
}

.db-icon { width: 18px; height: 18px; }
.db-connected .db-icon { animation: rotate 4s linear infinite; }
.db-disconnected .db-icon { animation: shake 0.5s ease-in-out infinite; }
.db-text { line-height: 1; font-weight: 700; }

/* ── Animations ──────────────────────────────────── */
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes shake {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-3px); }
    75%      { transform: translateX(3px); }
}

@keyframes pulse-green {
    0%,100% { box-shadow: 0 4px 16px rgba(16,185,129,0.35); }
    50%      { box-shadow: 0 4px 24px rgba(16,185,129,0.65); }
}

@keyframes pulse-red {
    0%,100% { box-shadow: 0 4px 16px rgba(239,68,68,0.35); }
    50%      { box-shadow: 0 4px 24px rgba(239,68,68,0.65); }
}

/* ── Alert variants ─────────────────────────────── */
.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

/* ── Footer "Sign in" link row ───────────────────── */
.footer-text {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.footer-link {
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ── Secondary button (modal cancel) ─────────────── */
.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1.5px solid var(--gray-200);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--gray-200);
    transform: none;
    box-shadow: none;
}

/* ── Countdown box ───────────────────────────────── */
.reset-countdown {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    font-size: 14px;
    color: var(--gray-700);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 860px) {
    .login-brand-panel { width: 36%; padding: 40px 28px; }
    .brand-name        { font-size: 22px; }
    .login-form-panel  { padding: 40px 36px; }
}

@media (max-width: 640px) {
    .login-brand-panel    { display: none; }
    .login-mobile-header  { display: flex; }

    .login-form-panel {
        padding: 32px 24px;
        justify-content: flex-start;
        padding-top: 60px;
    }

    .db-status {
        top: 12px;
        right: 12px;
        padding: 6px 10px;
        font-size: 11px;
    }

    .db-text  { display: none; }
    .db-icon  { width: 16px; height: 16px; }

    .login-title { font-size: 24px; }
}

@media (max-width: 400px) {
    .login-form-panel { padding: 24px 16px; padding-top: 52px; }
}

/* ── Floating Countdown Card ────────────────────────── */
.alert-floating {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    width: 380px;
    max-width: calc(100% - 48px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-left: 5px solid #ef4444;
    border-radius: 12px;
    padding: 16px 20px 16px 16px;
    color: #1f2937;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05), 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 14px;
    animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.alert-floating .alert-icon {
    color: #ef4444;
    width: 24px;
    height: 24px;
}

.alert-floating div {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

@keyframes toastSlideIn {
    from {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

