/* CentraMEDKIT Login Styles - Advanced UI */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #f8fafc;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.auth-page {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #06b6d4 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body.auth-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 3rem;
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.container:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Custom Scrollbar Styling */
.container::-webkit-scrollbar {
    width: 8px;
}

.container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 10px;
    transition: var(--transition);
}

.container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}


h1 {
    text-align: center;
    color: var(--text-primary);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Auth screens only. Scoping this avoids forcing every form in the app
   (report filters, toolbars, etc.) into a vertical stack. */
body.auth-page form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    position: relative;
}

label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

label .required {
    color: var(--danger-color);
    margin-left: 3px;
}

body.auth-page input[type="text"],
body.auth-page input[type="email"],
body.auth-page input[type="password"] {
    width: 100%;
    padding: 1rem 3rem 1rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: #fff;
    position: relative;
}

body.auth-page input[type="text"]:focus,
body.auth-page input[type="email"]:focus,
body.auth-page input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 4px;
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

body.auth-page input[type="text"]::placeholder,
body.auth-page input[type="email"]::placeholder,
body.auth-page input[type="password"]::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-top: 0.5rem;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.3);
}

button:active {
    transform: translateY(0);
}

.message {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    min-width: 300px;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        top: -100px;
        opacity: 0;
    }
    to {
        top: 20px;
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        top: 20px;
        opacity: 1;
    }
    to {
        top: -100px;
        opacity: 0;
    }
}

.message::before {
    content: '⚠️';
    font-size: 1.2rem;
}

.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
    border: 1px solid #6ee7b7;
}

.success::before {
    content: '✅';
}

.forgot-password {
    text-align: center;
    margin-top: 2rem;
}

.forgot-password a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.forgot-password a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.legal-links {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.legal-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.legal-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.divider {
    text-align: center;
    position: relative;
    margin: 2rem 0;
    color: var(--text-secondary);
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    background: rgba(255, 255, 255, 0.95);
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

.social-login {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.social-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.social-btn:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-1px);
}

.signup-link {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
}

.signup-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.signup-link a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"] {
        padding: 0.875rem 1rem;
    }

    button {
        padding: 0.875rem 1.5rem;
    }
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Multi-Step Form Styles */
.step-indicators {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    position: relative;
    --progress-width: 0%;
}

.step-indicators::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 1;
    transition: var(--transition);
}

.step-indicators::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    width: var(--progress-width);
    height: 2px;
    background: var(--primary-color);
    z-index: 1;
    transition: var(--transition);
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
    opacity: 0.5;
    transition: var(--transition);
}

.step-indicator.active {
    opacity: 1;
}

.step-indicator.completed {
    opacity: 1;
}

.step-indicator.completed .step-number::before {
    content: '✓';
    background: var(--accent-color);
    color: white;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition);
    position: relative;
}

.step-indicator.active .step-number {
    background: var(--primary-color);
    color: white;
}

.step-indicator.completed .step-number {
    background: var(--accent-color);
    color: white;
}

.step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

.step-indicator.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.step-indicator.completed .step-label {
    color: var(--accent-color);
}

.form-step {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

.form-step.active {
    display: flex;
}

.step-navigation {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 1rem;
}

.btn-next,
.btn-prev {
    background: var(--secondary-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
}

.btn-next:hover,
.btn-prev:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-prev {
    background: transparent;
    color: var(--text-secondary);
}

.btn-prev:hover {
    background: var(--text-secondary);
    color: white;
    border-color: var(--text-secondary);
}

/* Manage Roles button styling (used in admin users page) */
.btn-manage-roles {
    display: inline-block;
    padding: 0.45rem 0.85rem;
    font-size: 0.95rem;
    color: var(--primary-color);
    background: transparent;
    border: 1px solid var(--primary-color);
    border-radius: 0;
    text-decoration: none;
    transition: background 120ms ease, color 120ms ease, transform 80ms ease;
}

.btn-manage-roles:hover,
.btn-manage-roles:focus {
    background: var(--primary-color);
    color: #ffffff;
    text-decoration: none;
}

/* Responsive adjustments for multi-step form */
@media (max-width: 480px) {
    .step-indicators {
        gap: 1rem;
    }

    .step-label {
        font-size: 0.75rem;
    }

    .step-navigation {
        flex-direction: column;
    }

    .btn-next,
    .btn-prev {
        width: 100%;
    }
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0.75rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition);
}

.password-strength.visible {
    opacity: 1;
    transform: translateY(0);
}

.strength-meter {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-bar {
    height: 100%;
    width: 0%;
    transition: var(--transition);
    border-radius: 3px;
}

.strength-bar.weak {
    background: linear-gradient(90deg, var(--danger-color), #f97316);
    width: 33%;
}

.strength-bar.medium {
    background: linear-gradient(90deg, #f97316, #eab308);
    width: 66%;
}

.strength-bar.strong {
    background: linear-gradient(90deg, var(--accent-color), #22c55e);
    width: 100%;
}

.strength-text {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.strength-text.weak {
    color: var(--danger-color);
}

.strength-text.medium {
    color: #f97316;
}

.strength-text.strong {
    color: var(--accent-color);
}

.strength-requirements {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.requirement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    transition: var(--transition);
}

.requirement.met {
    color: var(--accent-color);
}

.requirement.met::before {
    content: '✓';
    color: var(--accent-color);
}

/* Password Match Indicator */
.password-match {
    margin-top: 0.75rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition);
}

.password-match.visible {
    opacity: 1;
    transform: translateY(0);
}

.match-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.match-indicator.match {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
    border: 2px solid #6ee7b7;
    animation: matchSuccess 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.match-indicator.no-match {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #dc2626;
    border: 2px solid #fca5a5;
}

.match-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.match-indicator.match .match-icon::before {
    content: '✅';
}

.match-indicator.no-match .match-icon::before {
    content: '❌';
}

@keyframes matchSuccess {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Database Connection Indicator */
.db-status-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.db-status-indicator:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.db-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    animation: blink 2s ease-in-out infinite;
}

.db-status-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.db-status-indicator.connected .db-icon {
    color: var(--accent-color);
}

.db-status-indicator.disconnected .db-icon {
    color: var(--danger-color);
    animation: pulse 1.5s ease-in-out infinite;
}

.db-status-indicator.connected .db-status-text {
    color: var(--accent-color);
}

.db-status-indicator.disconnected .db-status-text {
    color: var(--danger-color);
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* Responsive adjustments for db indicator */
@media (max-width: 480px) {
    .db-status-indicator {
        top: 10px;
        right: 10px;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .db-status-text {
        display: none;
    }

    .db-icon {
        width: 20px;
        height: 20px;
        font-size: 1rem;
    }
}

/* Success Modal Popup */
.success-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.success-modal {
    background: white;
    border-radius: 20px;
    padding: 3rem 2.5rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease-out;
    position: relative;
}

.success-icon {
    margin: 0 auto 1.5rem;
    width: 100px;
    height: 100px;
}

.checkmark {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: block;
    stroke-width: 3;
    stroke: #10b981;
    stroke-miterlimit: 10;
    box-shadow: inset 0 0 0 #10b981;
    animation: fillCheckmark 0.4s ease-in-out 0.4s forwards, scaleCheckmark 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke-miterlimit: 10;
    stroke: #10b981;
    fill: none;
    animation: strokeCheckmark 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: #10b981;
    stroke-width: 3;
    animation: strokeCheckmark 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

.success-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #10b981, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.success-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.success-details {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 2px solid #bbf7d0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-item:last-child {
    margin-bottom: 0;
}

.detail-icon {
    font-size: 1.2rem;
    animation: popIn 0.3s ease-out backwards;
}

.detail-item:nth-child(1) .detail-icon {
    animation-delay: 1.2s;
}

.detail-item:nth-child(2) .detail-icon {
    animation-delay: 1.4s;
}

.detail-item:nth-child(3) .detail-icon {
    animation-delay: 1.6s;
}

.redirect-info {
    margin-bottom: 1.5rem;
}

.redirect-info p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

#countdown {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
    width: 0%;
}

.btn-login-now {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-login-now:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes strokeCheckmark {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scaleCheckmark {

    0%,
    100% {
        transform: none;
    }

    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fillCheckmark {
    100% {
        box-shadow: inset 0 0 0 30px #10b981;
    }
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fillProgress {
    from {
        width: 0%;
    }

    to {
        width: 100%;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 2rem;
        max-width: 100%;
        margin: 1rem;
    }

    body.auth-page {
        padding: 10px;
    }

    h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1rem;
    }
}

/* Responsive for success modal */
@media (max-width: 480px) {
    .success-modal {
        padding: 2rem 1.5rem;
    }

    .success-title {
        font-size: 1.5rem;
    }

    .success-message {
        font-size: 1rem;
    }

    .success-icon {
        width: 80px;
        height: 80px;
    }

    .checkmark {
        width: 80px;
        height: 80px;
    }
}
.error-message {
    text-align: center;
    padding: 0.9rem 1rem;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    color: #b91c1c;
    font-size: 0.9rem;
}

/* ============================================================
   Auth Pages — Login & Password Reset (split-panel UI)
   Scoped to body.auth-page so app pages sharing login.css
   are unaffected.
   ============================================================ */

body.auth-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
    background-image: none;
    background-attachment: fixed;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
}

body.auth-page .auth-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    width: 100%;
    max-width: 1080px;
    height: calc(100vh - 48px);
    min-height: 500px;
    max-height: 720px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 30px 70px -20px rgba(15, 23, 42, 0.35);
    overflow: hidden;
}

/* ── Brand panel (left) ─────────────────────────────── */
body.auth-page .brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem 2.75rem;
    color: #ffffff;
    background: linear-gradient(160deg, #122c6b 0%, #1d4ed8 55%, #0891b2 100%);
    min-height: 0;
    height: 100%;
    overflow-y: auto;
}

body.auth-page .brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.14), transparent 42%),
        radial-gradient(circle at 12% 90%, rgba(255, 255, 255, 0.10), transparent 40%);
    pointer-events: none;
}

body.auth-page .brand-grid-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
    background-size: 42px 42px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 35%, transparent 75%);
    mask-image: radial-gradient(ellipse at 50% 40%, #000 35%, transparent 75%);
    pointer-events: none;
}

body.auth-page .brand,
body.auth-page .brand-message,
body.auth-page .brand-footer {
    position: relative;
    z-index: 1;
}

body.auth-page .brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

body.auth-page .brand-mark {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
    font-size: 1.45rem;
    font-weight: 800;
    backdrop-filter: blur(6px);
    object-fit: cover;
}

body.auth-page .brand-message {
    margin: 1.75rem 0;
    max-width: 430px;
}

body.auth-page .brand-kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.9rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
}

body.auth-page .license-badge {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4rem 0.65rem;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 1.2rem;
    padding: 0.55rem 0.85rem;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-left: 3px solid rgba(186, 230, 253, 0.95);
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(8, 47, 115, 0.18);
    backdrop-filter: blur(8px);
}

body.auth-page .license-label {
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

body.auth-page .license-company {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #ffffff;
}

body.auth-page .brand-message h2 {
    font-size: 2rem;
    line-height: 1.2;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.9rem;
    background: none;
    -webkit-text-fill-color: currentColor;
    text-align: left;
}

body.auth-page .brand-message p {
    font-size: 0.98rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

body.auth-page .brand-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1.75rem;
}

body.auth-page .feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 0.42rem 0.85rem;
    backdrop-filter: blur(4px);
}

body.auth-page .feature-pill svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

body.auth-page .brand-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

body.auth-page .brand-note {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

body.auth-page .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25), 0 0 10px rgba(52, 211, 153, 0.7);
    animation: authPulse 2s ease-in-out infinite;
}

body.auth-page .two-factor-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
}

body.auth-page .two-factor-badge svg {
    width: 14px;
    height: 14px;
}

body.auth-page .brand-footer-tags {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

body.auth-page .app-version-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-variant-numeric: tabular-nums;
}

@keyframes authPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* ── Auth panel (right) ─────────────────────────────── */
body.auth-page .auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 3rem 2.5rem;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
}

body.auth-page .auth-panel-inner {
    width: 100%;
    max-width: 400px;
}

body.auth-page .mobile-brand {
    display: none;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

body.auth-page .mobile-brand .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: #ffffff;
}

body.auth-page .eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

body.auth-page h1 {
    text-align: left;
    color: var(--text-primary);
    font-size: 1.9rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    background: none;
    -webkit-text-fill-color: currentColor;
}

body.auth-page .subtitle {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0 0 1.75rem;
}

/* In-panel notification banners */
body.auth-page .message {
    position: static;
    transform: none;
    top: auto;
    left: auto;
    min-width: 0;
    max-width: none;
    width: 100%;
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: none;
    animation: none;
}

body.auth-page .message::before {
    content: none;
}

body.auth-page .message svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

body.auth-page .message.warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #b45309;
    border: 1px solid #fcd34d;
}

body.auth-page .attempt-warning {
    display: none;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 1.25rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

body.auth-page .attempt-warning.visible {
    display: flex;
}

body.auth-page .attempt-warning svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

/* Form fields with leading icons */
body.auth-page .input-wrap {
    position: relative;
}

body.auth-page .field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

body.auth-page input[type="text"],
body.auth-page input[type="email"],
body.auth-page input[type="password"] {
    padding: 0.95rem 3rem 0.95rem 2.85rem;
    border-radius: 10px;
}

body.auth-page input[type="text"]:focus,
body.auth-page input[type="email"]:focus,
body.auth-page input[type="password"]:focus {
    transform: none;
}

body.auth-page .password-toggle {
    right: 8px;
}

body.auth-page .password-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Password strength */
body.auth-page .password-strength {
    opacity: 1;
    transform: none;
    margin-top: 0.6rem;
}

body.auth-page .strength-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
    width: 100%;
    margin-bottom: 0.4rem;
}

body.auth-page .strength-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
}

body.auth-page .strength-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Remember me / forgot password row */
body.auth-page .form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.25rem 0 1.25rem;
}

body.auth-page .remember-me {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    margin: 0;
}

body.auth-page .remember-me input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

body.auth-page .form-link a {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
}

body.auth-page .form-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* CAPTCHA (hidden until required) */
body.auth-page .captcha-group {
    display: none;
    margin-bottom: 1.25rem;
}

body.auth-page .captcha-group.visible {
    display: block;
}

body.auth-page .captcha-challenge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

body.auth-page .captcha-question {
    flex: 1;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    text-align: center;
    letter-spacing: 1px;
}

body.auth-page .captcha-refresh {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    background: var(--secondary-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

body.auth-page .captcha-refresh:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: rotate(180deg);
    box-shadow: none;
}

body.auth-page .captcha-refresh svg {
    width: 18px;
    height: 18px;
}

body.auth-page .otp-input {
    width: 100%;
    padding: 0.95rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    letter-spacing: 0.35em;
    text-align: center;
    font-weight: 600;
    background: #fff;
    color: var(--text-primary);
    transition: var(--transition);
}

body.auth-page .otp-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Primary submit button */
body.auth-page .primary-button {
    width: 100%;
    margin: 0.25rem 0 0;
    padding: 0.95rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #ffffff;
    box-shadow: 0 8px 20px -6px rgba(37, 99, 235, 0.45);
}

body.auth-page .primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -6px rgba(37, 99, 235, 0.55);
}

body.auth-page .primary-button.loading::after {
    content: none;
}

body.auth-page .primary-button .spinner {
    display: none;
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

body.auth-page .primary-button.loading .spinner {
    display: inline-block;
}

body.auth-page .security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

body.auth-page .security-note svg {
    width: 14px;
    height: 14px;
}

/* Reset-password helpers */
body.auth-page .session-info {
    display: none;
    margin: 0 0 1.25rem;
    padding: 0.9rem 1.1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

body.auth-page .session-info.visible {
    display: block;
}

body.auth-page .reset-status {
    padding: 1.25rem;
    border-radius: 10px;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 1.25rem;
}

body.auth-page .back-to-login {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

body.auth-page .back-to-login a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

body.auth-page .back-to-login a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

body.auth-page .legal-links {
    margin-top: 1.5rem;
    font-size: 0.8rem;
}

/* DB indicator dot (new markup) */
body.auth-page .db-status-indicator .db-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

body.auth-page .db-status-indicator.disconnected .db-dot {
    background: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
    body.auth-page .auth-shell {
        grid-template-columns: 1fr;
        min-height: 0;
        max-height: none;
        margin: 16px;
        width: auto;
        border-radius: 20px;
    }

    body.auth-page .brand-panel {
        display: none;
    }

    body.auth-page .auth-panel {
        padding: 2.25rem 1.5rem;
    }

    body.auth-page .mobile-brand {
        display: flex;
    }
}

@media (max-width: 480px) {
    body.auth-page .auth-shell {
        margin: 8px;
        border-radius: 16px;
    }

    body.auth-page .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
}
