/**
 * Healody™ - New Authentication System Styles
 * Matches existing PWA design: glassmorphism, blue/teal palette, monochromatic icons
 */

/* Inherit design tokens from styles.css */
/* Uses: --primary-dark, --accent-teal, --bg-glass, --text-primary, etc. */

/* ============================================
   Password Setup & Login Screens
   ============================================ */

/* Container uses same structure as existing auth-container */
.auth-new-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* Card matches existing auth-card glassmorphism */
.auth-new-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-medium);
}

.auth-new-card h2 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    font-size: 1.75rem;
    font-weight: 600;
}

.auth-new-card .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-lg);
    line-height: 1.5;
}

/* ============================================
   Form Groups - Match existing login.css
   ============================================ */
.form-group-new {
    margin-bottom: var(--spacing-md);
    position: relative;
}

.form-group-new label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    letter-spacing: 0.5px;
}

.form-group-new input,
.form-group-new select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all var(--transition-normal);
}

.form-group-new input::placeholder,
.form-group-new select option {
    color: var(--text-muted);
}

.form-group-new input:focus,
.form-group-new select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-teal);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 178, 255, 0.2);
    outline: none;
}

.form-group-new select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23b2bac2' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-group-new select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-group-new small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: var(--spacing-xs);
}

/* ============================================
   Password Input with Toggle - Monochromatic
   ============================================ */
.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.85rem;
    transition: color var(--transition-fast);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.password-toggle:hover {
    color: var(--accent-teal);
}

.password-input-wrapper input {
    padding-right: 70px;
}

/* ============================================
   Password Strength Indicator
   ============================================ */
.password-strength {
    margin-top: var(--spacing-sm);
}

.password-strength-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
    font-size: 0.85rem;
}

.password-strength-label span:first-child {
    color: var(--text-secondary);
}

.password-strength-value {
    font-weight: 600;
}

.password-strength-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.password-strength-fill {
    height: 100%;
    width: 0%;
    transition: all var(--transition-normal);
    border-radius: 3px;
}

/* Strength colors - using existing palette */
.strength-weak .password-strength-fill {
    width: 33%;
    background: var(--error);
}

.strength-weak .password-strength-value {
    color: var(--error);
}

.strength-medium .password-strength-fill {
    width: 66%;
    background: var(--warning);
}

.strength-medium .password-strength-value {
    color: var(--warning);
}

.strength-strong .password-strength-fill {
    width: 100%;
    background: var(--accent-teal);
}

.strength-strong .password-strength-value {
    color: var(--accent-teal);
}

/* ============================================
   Password Requirements Checklist
   ============================================ */
.password-requirements {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.password-requirements ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.password-requirements li {
    display: flex;
    align-items: center;
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: color var(--transition-fast);
}

.password-requirements li::before {
    content: '○';
    margin-right: var(--spacing-xs);
    font-size: 1.2rem;
    transition: all var(--transition-fast);
}

.password-requirements li.met {
    color: var(--accent-teal);
}

.password-requirements li.met::before {
    content: '●';
    color: var(--accent-teal);
}

/* ============================================
   Security Questions Cards
   ============================================ */
.security-question-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.security-question-card h3 {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
}

.security-question-card h3::before {
    content: '';
    width: 24px;
    height: 24px;
    margin-right: var(--spacing-xs);
    background: var(--accent-gradient);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.security-question-card:nth-child(1) h3::before {
    content: '1';
}

.security-question-card:nth-child(2) h3::before {
    content: '2';
}

.security-question-card:nth-child(3) h3::before {
    content: '3';
}

/* ============================================
   Checkbox - Match PWA style
   ============================================ */
.checkbox-group {
    display: flex;
    align-items: center;
    margin: var(--spacing-md) 0;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: var(--spacing-sm);
    cursor: pointer;
    accent-color: var(--accent-teal);
}

.checkbox-group label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

/* ============================================
   Alert Messages - Match existing error styles
   ============================================ */
.alert {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    animation: slideDown 0.3s ease-out;
    border-left: 4px solid;
}

.alert::before {
    margin-right: var(--spacing-sm);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.alert-error {
    background: rgba(244, 67, 54, 0.15);
    border-color: var(--error);
    color: var(--error);
}

.alert-error::before {
    content: '⚠';
}

.alert-success {
    background: rgba(102, 178, 255, 0.15);
    border-color: var(--accent-teal);
    color: var(--accent-teal);
}

.alert-success::before {
    content: '✓';
}

.alert-info {
    background: rgba(51, 153, 255, 0.15);
    border-color: var(--info);
    color: var(--info);
}

.alert-info::before {
    content: 'ⓘ';
}

/* ============================================
   Buttons - Match existing btn-primary
   ============================================ */
.btn-auth {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: 'Poppins', sans-serif;
    position: relative;
    overflow: hidden;
}

.btn-auth-primary {
    background: var(--accent-gradient);
    color: var(--text-primary);
    box-shadow: var(--shadow-soft);
}

.btn-auth-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(51, 153, 255, 0.3);
}

.btn-auth-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-auth-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-auth-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.btn-auth-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

/* Button loading state */
.btn-auth.loading {
    pointer-events: none;
}

.btn-auth.loading span {
    opacity: 0;
}

.btn-auth .btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.btn-auth.loading .btn-loader {
    display: block;
}

/* ============================================
   Links - Monochromatic
   ============================================ */
.auth-link {
    color: var(--accent-teal);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
    display: inline-block;
    background: none;
    border: none;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
}

.auth-link:hover {
    color: var(--accent-cyan);
    text-decoration: underline;
}

.text-center {
    text-align: center;
}

.mt-md {
    margin-top: var(--spacing-md);
}

/* ============================================
   Two-Step Process (for password reset)
   ============================================ */
.step-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    gap: var(--spacing-sm);
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all var(--transition-normal);
}

.step-dot.active {
    width: 32px;
    border-radius: 5px;
    background: var(--accent-gradient);
}

/* ============================================
   Hidden utility
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   Animations
   ============================================ */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

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

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .auth-new-container {
        max-width: 100%;
        padding: var(--spacing-sm);
    }

    .auth-new-card {
        padding: var(--spacing-lg);
    }

    .auth-new-card h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .auth-new-card {
        padding: var(--spacing-md);
    }

    .form-group-new input,
    .form-group-new select {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .btn-auth {
        padding: 14px;
        font-size: 1rem;
    }

    .security-question-card {
        padding: var(--spacing-sm);
    }
}
