/**
 * Authentication Pages Styles
 * ============================
 */

/* =============================================
   LOGIN PAGE
   ============================================= */

.login-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

.login-background {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.login-bg-pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(212, 175, 125, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 125, 96, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

.login-container {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
    animation: loginSlideUp 0.5s var(--ease-bounce);
}

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

/* Login Header */
.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    color: var(--accent-primary);
}

.login-logo svg {
    width: 100%;
    height: 100%;
}

.login-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.login-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Form Styles */
.login-form {
    margin-bottom: var(--space-6);
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-default);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(212, 175, 125, 0.2);
}

.form-input.filled {
    background: rgba(212, 175, 125, 0.1);
    border-color: var(--accent-primary);
}

/* Password Input */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper .form-input {
    padding-right: var(--space-12);
}

.password-toggle {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-default);
}

.password-toggle:hover {
    color: var(--text-secondary);
    background: var(--bg-elevated);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* Form Error */
.form-error {
    padding: var(--space-3) var(--space-4);
    background: rgba(180, 83, 63, 0.1);
    border: 1px solid rgba(180, 83, 63, 0.3);
    border-radius: var(--radius-lg);
    color: var(--terracotta);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    animation: errorShake 0.3s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.login-form.shake {
    animation: formShake 0.5s ease;
}

@keyframes formShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Button Block */
.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form Footer */
.form-footer {
    text-align: center;
    margin-top: var(--space-4);
}

.form-link {
    color: var(--accent-primary);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-default);
}

.form-link:hover {
    color: var(--ochre);
    text-decoration: underline;
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.login-divider span {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* Demo Accounts */
.login-demo {
    margin-bottom: var(--space-6);
}

.demo-text {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    text-align: center;
    margin-bottom: var(--space-3);
}

.demo-accounts {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.demo-account {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    text-align: left;
}

.demo-account:hover {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

.demo-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
    flex-shrink: 0;
}

.demo-info {
    display: flex;
    flex-direction: column;
}

.demo-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.demo-plan {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* Login Footer */
.login-footer {
    text-align: center;
}

.login-footer p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* =============================================
   PROFILES PAGE
   ============================================= */

.profiles-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

.profiles-background {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.profiles-bg-pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 70%, rgba(212, 175, 125, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(139, 125, 96, 0.08) 0%, transparent 50%),
        var(--bg-primary);
}

.profiles-container {
    width: 100%;
    max-width: 800px;
    text-align: center;
}

/* Profiles Header */
.profiles-header {
    margin-bottom: var(--space-10);
}

.profiles-title {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    animation: fadeInDown 0.5s var(--ease-bounce);
}

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

/* Profiles Grid */
.profiles-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-6);
    margin-bottom: var(--space-10);
}

/* Profile Card */
.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-default);
    opacity: 0;
    transform: scale(0.8);
}

.profile-card.animate-in {
    animation: profilePopIn 0.4s var(--ease-bounce) forwards;
}

@keyframes profilePopIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.profile-card:hover .profile-avatar {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.profile-card:hover .profile-name {
    color: var(--text-primary);
}

.profile-card.selecting {
    pointer-events: none;
    animation: profileSelect 0.4s var(--ease-default) forwards;
}

@keyframes profileSelect {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(0.9); opacity: 0.5; }
}

/* Profile Avatar */
.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--bg-primary);
    transition: all var(--duration-normal) var(--ease-bounce);
    position: relative;
    overflow: hidden;
}

.profile-avatar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
}

.profile-emoji {
    font-size: 48px;
}

.profile-avatar-kids {
    border: 3px solid var(--accent-primary);
}

.profile-kids-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 28px;
    height: 28px;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
}

/* Add Profile */
.profile-card-add .profile-avatar {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-default);
    color: var(--text-tertiary);
}

.profile-card-add:hover .profile-avatar {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.profile-avatar-add svg {
    width: 40px;
    height: 40px;
}

/* Profile Name */
.profile-name {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--duration-fast) var(--ease-default);
}

/* Profile Badge */
.profile-badge {
    font-size: var(--text-xs);
    color: var(--accent-primary);
    padding: var(--space-1) var(--space-2);
    background: rgba(212, 175, 125, 0.1);
    border-radius: var(--radius-full);
}

/* Profiles Footer */
.profiles-footer {
    animation: fadeIn 0.5s var(--ease-default) 0.3s backwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Avatar Colors */
.avatar-sand {
    background: linear-gradient(135deg, var(--sand) 0%, #c9b896 100%);
}

.avatar-olive {
    background: linear-gradient(135deg, var(--olive) 0%, #6b6152 100%);
}

.avatar-terracotta {
    background: linear-gradient(135deg, var(--terracotta) 0%, #a85a45 100%);
}

.avatar-ochre {
    background: linear-gradient(135deg, var(--ochre) 0%, #a88a47 100%);
}

.avatar-sage {
    background: linear-gradient(135deg, var(--sage) 0%, #8a9a7a 100%);
}

/* Responsive */
@media (max-width: 640px) {
    .login-container {
        padding: var(--space-6);
        border-radius: var(--radius-xl);
    }

    .login-title {
        font-size: var(--text-xl);
    }

    .profiles-title {
        font-size: var(--text-2xl);
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
        font-size: var(--text-2xl);
    }

    .profile-emoji {
        font-size: 40px;
    }

    .profiles-grid {
        gap: var(--space-4);
    }
}
