/* File: static/css/auth.css */
/* Auth page styles (login, phone OTP, Google OAuth) */
/* Version: 1.5.0 */
/* Last Modified: 2026-02-08 */
/* Change: Add Home back link on login page - Fixes #54 */

.auth-page {
    background: linear-gradient(135deg, #1a5f3c 0%, #0d3320 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.auth-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.auth-header {
    background: var(--primary);
    color: white;
    padding: 30px;
    text-align: center;
}

.auth-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.auth-header p {
    opacity: 0.9;
    font-size: 14px;
}

.auth-body {
    padding: 30px;
}

/* Tab Switcher */
.tab-switcher {
    display: flex;
    margin-bottom: 24px;
    border-radius: 8px;
    background: #f5f5f5;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-btn.active {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: var(--primary);
}

/* Auth form fields */
.auth-body .form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.auth-body .form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-body .form-group input::placeholder {
    color: #aaa;
}

/* Password visibility toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 48px !important;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: #333;
}

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

.rtl .password-wrapper input {
    padding-right: 16px !important;
    padding-left: 48px !important;
}

.rtl .password-toggle {
    right: auto;
    left: 12px;
}

.forgot-link {
    text-align: right;
    margin-top: -12px;
    margin-bottom: 20px;
}

.forgot-link a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
}

.auth-body .btn-submit {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-body .btn-submit:hover {
    background: var(--primary-dark);
}

.auth-body .btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #888;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.divider span {
    padding: 0 16px;
    font-size: 14px;
}

/* Social Buttons */
.social-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.social-unavailable {
    color: #6c757d;
    font-size: 13px;
    margin: 0;
}

.btn-social {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-social:hover {
    border-color: var(--primary);
    background: #f9fdf9;
}

.btn-social svg {
    width: 20px;
    height: 20px;
}

.phone-login {
    text-align: center;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-top: 16px;
}

.phone-login a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* Home back link on auth pages */
.auth-home-link {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.85;
    transition: opacity 0.2s, background 0.2s;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.auth-home-link:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* Language selector on auth pages */
.auth-lang-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.auth-lang-selector select {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    font-size: 14px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='white' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.auth-lang-selector select option {
    color: #333;
    background: white;
}

/* Required field indicator */
.required {
    color: #c62828;
    font-weight: 600;
}

/* Error message */
.auth-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-left: 4px solid #c62828;
    animation: fadeIn 0.3s ease-in-out;
}

.auth-error.show {
    display: flex;
}

.auth-error-text {
    flex: 1;
}

.auth-error-dismiss {
    background: none;
    border: none;
    color: #c62828;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.auth-error-dismiss:hover {
    opacity: 1;
}

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

/* Phone OTP specific */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 24px;
}

.back-link:hover {
    color: var(--primary);
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}

.step {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: all 0.3s;
}

.step.active {
    background: var(--primary);
    width: 30px;
    border-radius: 5px;
}

.phone-input-group {
    display: flex;
    gap: 10px;
}

.country-select {
    width: 100px;
    padding: 14px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.phone-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.phone-input:focus,
.country-select:focus {
    outline: none;
    border-color: var(--primary);
}

.otp-input-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.otp-digit {
    width: 50px;
    height: 60px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 24px;
    text-align: center;
    font-weight: 600;
}

.otp-digit:focus {
    outline: none;
    border-color: var(--primary);
}

.info-text {
    background: #f0f7f3;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 14px;
    text-align: center;
}

.phone-display {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.edit-phone {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    margin-inline-start: 10px;
}

.resend-section {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

.resend-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.resend-link.disabled {
    color: #999;
    cursor: not-allowed;
}

.timer {
    color: var(--primary);
    font-weight: 600;
}

/* RTL */
.rtl .forgot-link {
    text-align: left;
}

.rtl .auth-home-link {
    left: auto;
    right: 20px;
}

.rtl .auth-home-link svg {
    transform: scaleX(-1);
}

.rtl .auth-lang-selector {
    right: auto;
    left: 20px;
}

.rtl .back-link {
    flex-direction: row-reverse;
}

.rtl .phone-input-group {
    flex-direction: row-reverse;
}
