/* ========================================================================
   AUTH THEME — shared visual language for the login + password-reset flow
   Scoped to .auth-wrapper so it never leaks into the authenticated dashboard.
   Colors are driven by the global --primary-color / --secondary-color
   custom properties (set in templates/base.html from CompanySetup).
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

.auth-wrapper {
    --auth-font: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --auth-radius-lg: 24px;
    --auth-radius-md: 14px;
    --auth-border: #e5e7eb;
    --auth-text-muted: #64748b;
    --auth-text-dark: #0f172a;
    --auth-shadow-card: 0 25px 60px -15px rgba(15, 23, 42, 0.35), 0 8px 20px -8px rgba(15, 23, 42, 0.15);

    min-height: 100vh;
    position: relative;
    overflow: hidden;
    font-family: var(--auth-font);
    background: linear-gradient(160deg, var(--primary-color, #5e72e4) 0%, var(--secondary-color, #825ee4) 55%, #1a1b3a 100%);
}

.auth-wrapper :focus-visible {
    outline: 2px solid var(--primary-color, #5e72e4);
    outline-offset: 2px;
}

/* Dot-grid texture + floating glow, layered behind content */
.auth-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='2' cy='2' r='1.5' fill='rgba(255,255,255,0.14)'/%3E%3C/svg%3E");
    pointer-events: none;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
    animation: authFloat 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes authFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-50px, 50px) rotate(180deg); }
}

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

@keyframes authFadeInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes authFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes authSlideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes authPopIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------------------------------------------------------------------
   Left brand panel
   --------------------------------------------------------------------- */
.auth-brand-panel {
    padding: 3rem;
    position: relative;
    z-index: 1;
}

.auth-brand-content {
    max-width: 460px;
    margin: 0 auto;
}

.auth-brand-badge {
    width: 76px;
    height: 76px;
    border-radius: var(--auth-radius-md);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: authFadeInUp 0.8s ease-out;
    overflow: hidden;
}

.auth-brand-badge i { font-size: 2rem; color: #fff; }

.auth-brand-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-brand-title {
    color: #fff;
    font-weight: 800;
    font-size: 2.5rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
    animation: authFadeInUp 0.8s ease-out 0.1s both;
}

.auth-brand-tagline {
    color: rgba(255, 255, 255, 0.78);
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
    animation: authFadeInUp 0.8s ease-out 0.2s both;
}

.auth-feature-list {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.auth-feature-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    animation: authFadeInLeft 0.7s ease-out both;
}

.auth-feature-item:nth-child(1) { animation-delay: 0.3s; }
.auth-feature-item:nth-child(2) { animation-delay: 0.45s; }
.auth-feature-item:nth-child(3) { animation-delay: 0.6s; }

.auth-feature-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-feature-icon i { color: #fff; font-size: 0.9rem; }

.auth-feature-title { color: #fff; font-weight: 600; font-size: 0.95rem; margin: 0; }
.auth-feature-desc { color: rgba(255, 255, 255, 0.7); font-size: 0.82rem; margin: 0; }

/* ---------------------------------------------------------------------
   Right side / centered form column
   --------------------------------------------------------------------- */
.auth-form-wrapper { padding: 2rem; position: relative; z-index: 1; }
.auth-form-container { max-width: 480px; margin: 0 auto; }
.auth-center-container { width: 100%; max-width: 480px; margin: 0 auto; position: relative; z-index: 1; }

.auth-mobile-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-mobile-brand .auth-brand-badge,
.auth-center-brand .auth-brand-badge {
    margin: 0 auto 0.85rem;
}

.auth-mobile-brand h3,
.auth-center-brand h3 {
    color: #fff;
    font-weight: 700;
    font-size: 1.4rem;
    margin: 0;
}

.auth-center-brand { text-align: center; margin-bottom: 1.5rem; }

.auth-brand-badge-sm { width: 60px; height: 60px; }
.auth-brand-badge-sm i { font-size: 1.5rem; }

/* ---------------------------------------------------------------------
   Card
   --------------------------------------------------------------------- */
.auth-card {
    background: #fff;
    border: none;
    border-radius: var(--auth-radius-lg);
    box-shadow: var(--auth-shadow-card);
    animation: authFadeIn 0.6s ease-out;
    overflow: hidden;
}

.auth-card-body { padding: 2.75rem; }

.auth-card-header { text-align: center; margin-bottom: 1.75rem; }
.auth-card-header h3 { font-weight: 700; color: var(--auth-text-dark); font-size: 1.5rem; margin-bottom: 0.35rem; }
.auth-card-header p { color: var(--auth-text-muted); font-size: 0.92rem; margin: 0; }

.auth-card .alert {
    border-radius: var(--auth-radius-md);
    border: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    animation: authSlideDown 0.4s ease-out;
}

/* ---------------------------------------------------------------------
   Form fields
   --------------------------------------------------------------------- */
.auth-field { margin-bottom: 1.15rem; }

.auth-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--auth-text-dark);
    margin-bottom: 0.45rem;
}

.auth-input-wrap { position: relative; }

.auth-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color, #5e72e4);
    font-size: 0.95rem;
    pointer-events: none;
}

.auth-input {
    width: 100%;
    height: 52px;
    padding: 0 1rem 0 2.75rem;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--auth-text-dark);
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.auth-input.auth-input--plain { padding-left: 1rem; }
.auth-input.pe-icon-right { padding-right: 2.75rem; }

.auth-input::placeholder { color: #94a3b8; }

.auth-input:focus {
    outline: none;
    border-color: var(--primary-color, #5e72e4);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(94, 114, 228, 0.12);
}

.auth-input.is-invalid { border-color: #ef4444; }
.auth-input.is-valid { border-color: #10b981; }

.auth-toggle-btn {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-toggle-btn:hover { color: var(--primary-color, #5e72e4); }

.auth-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--auth-text-muted);
    cursor: pointer;
    margin: 0;
}

.auth-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color, #5e72e4);
    cursor: pointer;
}

.auth-forgot-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color, #5e72e4);
    text-decoration: none;
}

.auth-forgot-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.auth-submit-btn {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: var(--auth-radius-md);
    background: linear-gradient(135deg, var(--primary-color, #5e72e4) 0%, var(--secondary-color, #825ee4) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.98rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 25px -8px rgba(94, 114, 228, 0.55);
}

.auth-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s ease;
}

.auth-submit-btn:hover::before { left: 100%; }

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -8px rgba(94, 114, 228, 0.65);
}

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

.auth-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.auth-submit-btn.auth-submit-btn--success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 10px 25px -8px rgba(16, 185, 129, 0.5);
}

.auth-submit-btn.auth-submit-btn--success:hover {
    box-shadow: 0 14px 30px -8px rgba(16, 185, 129, 0.6);
}

/* ---------------------------------------------------------------------
   Divider / footer / misc
   --------------------------------------------------------------------- */
.auth-divider { position: relative; text-align: center; margin: 1.5rem 0; }

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--auth-border);
}

.auth-divider span {
    position: relative;
    display: inline-block;
    background: #fff;
    padding: 0 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-footer { text-align: center; margin-top: 1.75rem; }
.auth-footer small { display: block; color: rgba(255, 255, 255, 0.85); font-size: 0.78rem; }
.auth-footer small + small { margin-top: 0.5rem; }

.auth-link-row {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--auth-border);
    text-align: center;
}

.auth-link-row a {
    color: var(--primary-color, #5e72e4);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.85rem;
}

.auth-link-row a:hover { text-decoration: underline; }

/* Status circles (password-reset done/confirm/complete pages) */
.auth-status-circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    animation: authPopIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.auth-status-circle.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
}

.auth-status-circle.danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.2);
}

.auth-status-circle i { font-size: 3rem; }
.auth-status-circle.success i { color: #10b981; }
.auth-status-circle.danger i { color: #ef4444; }

.auth-info-box {
    border-radius: var(--auth-radius-md);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    font-size: 0.88rem;
    text-align: left;
}

.auth-info-box p { margin: 0; }

.auth-info-box.warning { background: #fffbeb; border-left: 4px solid #f59e0b; color: #92400e; }
.auth-info-box.info { background: #eff6ff; border-left: 4px solid #3b82f6; color: #1e40af; }
.auth-info-box.success { background: #ecfdf5; border-left: 4px solid #10b981; color: #065f46; }

/* Password requirements + strength meter (reset-confirm page) */
.auth-requirements {
    background: #f8fafc;
    border-left: 4px solid var(--primary-color, #5e72e4);
    border-radius: var(--auth-radius-md);
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--auth-text-muted);
    text-align: left;
}

.auth-requirements ul {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-requirements li { display: flex; align-items: center; gap: 0.5rem; }
.auth-requirements li i { font-size: 6px; color: #cbd5e1; }
.auth-requirements li.requirement-met { color: #10b981; }
.auth-requirements li.requirement-met i { font-size: 0.85rem; color: #10b981; }

.auth-strength {
    margin-top: 0.5rem;
    height: 5px;
    border-radius: 3px;
    background: #e5e7eb;
    overflow: hidden;
    display: none;
}

.auth-strength-bar { height: 100%; width: 0; transition: width 0.3s ease, background-color 0.3s ease; }
.auth-strength-bar.weak { background: #ef4444; width: 33%; }
.auth-strength-bar.medium { background: #f59e0b; width: 66%; }
.auth-strength-bar.strong { background: #10b981; width: 100%; }

.auth-match-message { margin-top: 0.5rem; font-size: 0.85rem; }
.auth-match-message.ok { color: #10b981; }
.auth-match-message.bad { color: #ef4444; }

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .auth-wrapper {
        background: linear-gradient(180deg, var(--primary-color, #5e72e4) 0%, var(--secondary-color, #825ee4) 55%, #1a1b3a 100%);
    }
    .auth-form-wrapper { padding: 1rem; }
    .auth-form-container .auth-card { margin-top: 2rem; margin-bottom: 2rem; }
}

@media (max-width: 575.98px) {
    .auth-card-body { padding: 2rem 1.5rem !important; }
    .auth-input { height: 48px; }
    .auth-submit-btn { height: 48px; }
    .auth-brand-title { font-size: 2rem; }
}
