/* Lyvra Energy - UX Redesign 2025 - Authentication Pages */

:root {
    /* Updated color palette from UX redesign proposal */
    --lyvra-primary: #5840ff;
    --lyvra-success: #20c997;
    --lyvra-warning: #ffc107;
    --lyvra-danger: #dc3545;
    --lyvra-info: #3498db;

    /* Energy flow colors */
    --lyvra-solar: #f39c12;
    --lyvra-grid: #34495e;
    --lyvra-battery: #27ae60;
    --lyvra-ev: #3498db;

    /* Neutral colors */
    --lyvra-gray: #6c757d;
    --lyvra-gray-light: #e9ecef;
    --lyvra-gray-lighter: #f8f9fa;
    --lyvra-dark: #212529;

    /* Typography */
    --lyvra-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing */
    --lyvra-card-padding: 32px;
    --lyvra-card-gap: 20px;

    /* Border radius */
    --lyvra-radius-sm: 8px;
    --lyvra-radius-md: 12px;
    --lyvra-radius-lg: 16px;

    /* Shadows */
    --lyvra-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --lyvra-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --lyvra-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Auth page container */
.lyvra-auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5E5BFF 0%, #3A86FF 50%, #00D1D1 100%);
    padding: 20px;
    font-family: var(--lyvra-font-family);
    position: relative;
    overflow: hidden;
}

/* Animated background elements */
.lyvra-auth-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(94, 91, 255, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(0, 209, 209, 0.2) 0%, transparent 50%);
    animation: floatBackground 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes floatBackground {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(-5%, 5%) rotate(5deg);
    }
    66% {
        transform: translate(5%, -5%) rotate(-5deg);
    }
}

/* Dark mode support */
.lyvra-auth-container.dark-mode {
    background: #0E0433;
    background: linear-gradient(135deg, #0E0433 0%, #1a1a3e 50%, #0a2342 100%);
}

.lyvra-auth-container.dark-mode::before {
    background: radial-gradient(circle at 30% 50%, rgba(94, 91, 255, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(0, 209, 209, 0.1) 0%, transparent 50%);
}

/* Auth card */
.lyvra-auth-card {
    background: white;
    border-radius: var(--lyvra-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.lyvra-auth-card.dark-mode {
    background: rgba(30, 30, 46, 0.95);
    color: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(94, 91, 255, 0.2);
}

/* Logo section */
.lyvra-auth-logo {
    text-align: center;
    padding: var(--lyvra-card-padding) var(--lyvra-card-padding) 24px;
}

.lyvra-auth-logo img {
    max-width: 180px;
    height: auto;
}

/* Header section */
.lyvra-auth-header {
    text-align: center;
    padding: 0 var(--lyvra-card-padding) 24px;
}

.lyvra-auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--lyvra-dark);
}

.dark-mode .lyvra-auth-header h1 {
    color: #ffffff;
}

.lyvra-auth-header p {
    font-size: 15px;
    color: var(--lyvra-gray);
    margin: 0;
}

.dark-mode .lyvra-auth-header p {
    color: #a0a0a0;
}

/* Form section */
.lyvra-auth-form {
    padding: 0 var(--lyvra-card-padding) var(--lyvra-card-padding);
}

/* Form groups */
.lyvra-form-group {
    margin-bottom: var(--lyvra-card-gap);
}

.lyvra-form-group:last-of-type {
    margin-bottom: 24px;
}

.lyvra-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--lyvra-dark);
    margin-bottom: 8px;
}

.dark-mode .lyvra-form-label {
    color: #e0e0e0;
}

/* Form inputs */
.lyvra-form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--lyvra-gray-light);
    border-radius: var(--lyvra-radius-sm);
    transition: all 0.2s ease;
    font-family: var(--lyvra-font-family);
    background: white;
    color: var(--lyvra-dark);
    box-sizing: border-box;
}

.dark-mode .lyvra-form-input {
    background: #2a2a2a;
    border-color: #404040;
    color: #ffffff;
}

.lyvra-form-input:focus {
    outline: none;
    border-color: var(--lyvra-primary);
    box-shadow: 0 0 0 3px rgba(88, 64, 255, 0.1);
}

.dark-mode .lyvra-form-input:focus {
    border-color: var(--lyvra-primary);
    box-shadow: 0 0 0 3px rgba(88, 64, 255, 0.2);
}

.lyvra-form-input::placeholder {
    color: var(--lyvra-gray);
}

.dark-mode .lyvra-form-input::placeholder {
    color: #707070;
}

/* Password input with toggle */
.lyvra-password-wrapper {
    position: relative;
}

.lyvra-password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--lyvra-gray);
    font-size: 18px;
    transition: color 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lyvra-password-toggle:hover {
    color: var(--lyvra-primary);
}

/* Error messages */
.lyvra-error-message {
    color: var(--lyvra-danger);
    font-size: 13px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lyvra-error-message i {
    font-size: 14px;
}

/* Alerts */
.lyvra-alert {
    padding: 14px 16px;
    border-radius: var(--lyvra-radius-sm);
    margin-bottom: var(--lyvra-card-gap);
    display: flex;
    align-items: start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.lyvra-alert i {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.lyvra-alert-success {
    background: rgba(32, 201, 151, 0.1);
    color: #0a6e4c;
    border-left: 3px solid var(--lyvra-success);
}

.dark-mode .lyvra-alert-success {
    background: rgba(32, 201, 151, 0.15);
    color: #20c997;
}

.lyvra-alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #842029;
    border-left: 3px solid var(--lyvra-danger);
}

.dark-mode .lyvra-alert-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #f8bbbb;
}

.lyvra-alert-info {
    background: rgba(52, 152, 219, 0.1);
    color: #055160;
    border-left: 3px solid var(--lyvra-info);
}

.dark-mode .lyvra-alert-info {
    background: rgba(52, 152, 219, 0.15);
    color: #9ed7f2;
}

/* Checkbox */
.lyvra-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lyvra-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--lyvra-primary);
}

.lyvra-checkbox-label {
    font-size: 14px;
    color: var(--lyvra-gray);
    cursor: pointer;
    user-select: none;
}

.dark-mode .lyvra-checkbox-label {
    color: #a0a0a0;
}

/* Links */
.lyvra-link {
    color: #5E5BFF;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #5E5BFF 0%, #3A86FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lyvra-link:hover {
    background: linear-gradient(135deg, #3A86FF 0%, #00D1D1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

/* Buttons */
.lyvra-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--lyvra-radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--lyvra-font-family);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
}

.lyvra-btn-primary {
    background: linear-gradient(135deg, #5E5BFF 0%, #3A86FF 50%, #00D1D1 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.lyvra-btn-primary::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 ease;
}

.lyvra-btn-primary:hover::before {
    left: 100%;
}

.lyvra-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(94, 91, 255, 0.4);
}

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

.lyvra-btn-secondary {
    background: transparent;
    color: var(--lyvra-primary);
    border: 2px solid var(--lyvra-gray-light);
}

.lyvra-btn-secondary:hover {
    background: rgba(88, 64, 255, 0.05);
    border-color: var(--lyvra-primary);
}

/* Form row (remember me + forgot password) */
.lyvra-form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.lyvra-form-row .lyvra-link {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

/* Divider */
.lyvra-divider {
    position: relative;
    text-align: center;
    margin: 28px 0;
}

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

.dark-mode .lyvra-divider::before {
    background: #404040;
}

.lyvra-divider span {
    position: relative;
    background: white;
    padding: 0 16px;
    color: var(--lyvra-gray);
    font-size: 14px;
}

.dark-mode .lyvra-divider span {
    background: #1e1e1e;
    color: #a0a0a0;
}

/* Footer */
.lyvra-auth-footer {
    text-align: center;
    padding: 24px var(--lyvra-card-padding);
    background: var(--lyvra-gray-lighter);
    border-top: 1px solid var(--lyvra-gray-light);
}

.dark-mode .lyvra-auth-footer {
    background: #2a2a2a;
    border-top-color: #404040;
}

.lyvra-auth-footer p {
    font-size: 14px;
    color: var(--lyvra-gray);
    margin: 0;
}

.dark-mode .lyvra-auth-footer p {
    color: #a0a0a0;
}

/* Dark mode toggle */
.lyvra-dark-mode-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--lyvra-shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    z-index: 1000;
}

.lyvra-dark-mode-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--lyvra-shadow-lg);
}

.dark-mode .lyvra-dark-mode-toggle {
    background: #2a2a2a;
}

.lyvra-dark-mode-toggle i {
    font-size: 20px;
    color: var(--lyvra-primary);
}

/* Loading state */
.lyvra-btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.lyvra-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: lyvra-spinner 0.6s linear infinite;
}

@keyframes lyvra-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive design */
@media (max-width: 480px) {
    .lyvra-auth-card {
        max-width: 100%;
    }

    .lyvra-auth-logo,
    .lyvra-auth-header,
    .lyvra-auth-form {
        padding-left: 24px;
        padding-right: 24px;
    }

    .lyvra-auth-footer {
        padding-left: 24px;
        padding-right: 24px;
    }

    .lyvra-auth-header h1 {
        font-size: 24px;
    }

    .lyvra-form-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Accessibility */
.lyvra-form-input:focus-visible,
.lyvra-btn:focus-visible,
.lyvra-checkbox:focus-visible {
    outline: 2px solid var(--lyvra-primary);
    outline-offset: 2px;
}

/* Screen reader only */
.lyvra-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}