/* ============================================================
   AUTH STYLES - Login & Register
   Inspired by Facebook with Spiritual Theme
   ============================================================ */

/* ============================================================
   MAIN CONTAINER
   ============================================================ */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 40px 20px;
    background: var(--bg, #f0f2f5);
    position: relative;
}

/* Декоративный фон */
.auth-container::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(24, 119, 242, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(66, 183, 42, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================================
   AUTH CARD
   ============================================================ */
.auth-card {
    width: 100%;
    max-width: 460px;
    padding: 40px 36px 36px;
    background: var(--bg-card, #ffffff);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-lg, 0 8px 30px rgba(0, 0, 0, 0.12));
    position: relative;
    z-index: 1;
    animation: authSlideUp 0.5s ease;
}

@keyframes authSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary, #1877f2), var(--secondary, #42b72a));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ============================================================
   LOGO
   ============================================================ */
.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.auth-logo a:hover {
    transform: scale(1.02);
}

.auth-logo-img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary, #1877f2);
    padding: 2px;
    transition: border-color 0.3s ease;
}

.auth-logo a:hover .auth-logo-img {
    border-color: var(--primary-dark, #166fe5);
}

.auth-logo span {
    font-family: var(--font-serif, Georgia, serif);
    font-size: 16px;
    font-weight: 700;
    color: var(--primary, #1877f2);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    line-height: 1.2;
}

/* ============================================================
   TITLES
   ============================================================ */
.auth-title {
    font-size: 26px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 6px;
    color: var(--text, #1c1e21);
    letter-spacing: -0.3px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary, #65676b);
    font-size: 14px;
    margin-bottom: 30px;
    line-height: 1.5;
}

/* ============================================================
   FORM
   ============================================================ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ============================================================
   FORM GROUP
   ============================================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #1c1e21);
    letter-spacing: 0.2px;
}

.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-input, #ccd0d5);
    border-radius: var(--radius, 8px);
    font-size: 14px;
    background: var(--bg-input, #f0f2f5);
    color: var(--text, #1c1e21);
    transition: all 0.25s ease;
    font-family: var(--font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
}

.form-group input::placeholder {
    color: var(--text-muted, #8a8d91);
    font-size: 13px;
}

.form-group input:hover {
    background: var(--bg-hover, #f5f6f7);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary, #1877f2);
    background: var(--bg-card, #ffffff);
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.1);
}

.form-group input.error {
    border-color: #e41e3f;
    box-shadow: 0 0 0 3px rgba(228, 30, 63, 0.1);
}

.form-group input.error:focus {
    border-color: #e41e3f;
    box-shadow: 0 0 0 3px rgba(228, 30, 63, 0.15);
}

.form-group input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================
   FORM ROW (для имени и фамилии)
   ============================================================ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ============================================================
   PASSWORD WRAPPER
   ============================================================ */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-muted, #8a8d91);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toggle-password:hover {
    color: var(--text, #1c1e21);
    background: var(--bg-hover, #f5f6f7);
}

.toggle-password:active {
    transform: translateY(-50%) scale(0.9);
}

.toggle-password svg {
    display: block;
}

/* ============================================================
   PASSWORD HINT
   ============================================================ */
.password-hint {
    font-size: 12px;
    color: var(--text-muted, #8a8d91);
    margin-top: 4px;
    padding-left: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.password-hint::before {
    content: 'ℹ️';
    font-size: 12px;
}

/* ============================================================
   FORM OPTIONS (Login)
   ============================================================ */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    padding: 2px 0;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary, #65676b);
    font-weight: 500;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary, #1877f2);
    border-radius: 4px;
    flex-shrink: 0;
}

.remember-me:hover {
    color: var(--text, #1c1e21);
}

.forgot-link {
    color: var(--primary, #1877f2);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    color: var(--primary-dark, #166fe5);
    text-decoration: underline;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-auth {
    width: 100%;
    padding: 13px 20px;
    border: none;
    border-radius: var(--radius, 8px);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: var(--font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.btn-auth::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-auth:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--primary, #1877f2);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-dark, #166fe5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(24, 119, 242, 0.2);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================================
   AUTH MESSAGE
   ============================================================ */
.auth-message {
    display: none;
    padding: 12px 16px;
    border-radius: var(--radius, 8px);
    margin-top: 6px;
    font-size: 14px;
    font-weight: 500;
    animation: authMessageSlide 0.3s ease;
}

@keyframes authMessageSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-message.error {
    display: block;
    background: #fdedf0;
    color: #e41e3f;
    border: 1px solid #f5c6cb;
}

.auth-message.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.auth-message.info {
    display: block;
    background: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #bbdefb;
}

/* ============================================================
   DIVIDER
   ============================================================ */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0 16px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light, #e4e6eb);
}

.auth-divider span {
    color: var(--text-muted, #8a8d91);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   SOCIAL BUTTONS
   ============================================================ */
.auth-social {
    display: flex;
    gap: 12px;
}

.btn-social {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 16px;
    border: 1px solid var(--border-light, #e4e6eb);
    border-radius: var(--radius, 8px);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text, #1c1e21);
    transition: all 0.25s ease;
    cursor: pointer;
    background: var(--bg-card, #ffffff);
}

.btn-social:hover {
    background: var(--bg-hover, #f5f6f7);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.btn-social:active {
    transform: translateY(0);
}

.btn-social svg {
    flex-shrink: 0;
}

.btn-google:hover {
    border-color: #ea4335;
    color: #ea4335;
    background: #fef3f2;
}

.btn-facebook:hover {
    border-color: #1877f2;
    color: #1877f2;
    background: #f0f7ff;
}

/* ============================================================
   FOOTER
   ============================================================ */
.auth-footer {
    text-align: center;
    margin: 18px 0 4px;
    font-size: 14px;
    color: var(--text-secondary, #65676b);
}

.auth-link {
    color: var(--primary, #1877f2);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.auth-link:hover {
    color: var(--primary-dark, #166fe5);
    text-decoration: underline;
    background: var(--primary-light, #e7f3ff);
}

/* ============================================================
   AVATAR UPLOAD (Register)
   ============================================================ */
.avatar-upload {
    margin-top: 2px;
}

.avatar-upload-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px dashed var(--border, #ced0d4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    background: var(--bg-input, #f0f2f5);
    position: relative;
}

.avatar-preview:hover {
    border-color: var(--primary, #1877f2);
    background: var(--bg-hover, #f5f6f7);
    transform: scale(1.02);
}

.avatar-preview:active {
    transform: scale(0.98);
}

.avatar-preview svg {
    color: var(--text-muted, #8a8d91);
    transition: color 0.3s ease;
}

.avatar-preview:hover svg {
    color: var(--primary, #1877f2);
}

.avatar-preview span {
    font-size: 11px;
    color: var(--text-muted, #8a8d91);
    margin-top: 4px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.avatar-preview:hover span {
    color: var(--text, #1c1e21);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-preview.has-image {
    border-color: var(--primary, #1877f2);
    border-style: solid;
}

.avatar-hint {
    font-size: 12px;
    color: var(--text-muted, #8a8d91);
    margin: 0;
}

/* ============================================================
   FORM AGREEMENT (Register)
   ============================================================ */
.form-agreement {
    font-size: 13px;
    color: var(--text-secondary, #65676b);
    padding: 2px 0;
}

.form-agreement label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    line-height: 1.5;
}

.form-agreement input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary, #1877f2);
    border-radius: 4px;
}

.form-agreement label:hover {
    color: var(--text, #1c1e21);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Планшеты и маленькие ноутбуки */
@media (max-width: 768px) {
    .auth-container {
        padding: 30px 16px;
        min-height: calc(100vh - 52px);
    }
    
    .auth-card {
        padding: 32px 24px 28px;
        max-width: 420px;
    }
    
    .auth-title {
        font-size: 22px;
    }
    
    .auth-subtitle {
        font-size: 13px;
        margin-bottom: 24px;
    }
    
    .auth-logo-img {
        width: 44px;
        height: 44px;
    }
    
    .auth-logo span {
        font-size: 14px;
    }
    
    .auth-form {
        gap: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .btn-auth {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* Мобильные устройства */
@media (max-width: 480px) {
    .auth-container {
        padding: 20px 12px;
        min-height: calc(100vh - 48px);
    }
    
    .auth-card {
        padding: 24px 16px 20px;
        border-radius: var(--radius, 8px);
        max-width: 100%;
    }
    
    .auth-card::before {
        height: 3px;
    }
    
    .auth-title {
        font-size: 20px;
    }
    
    .auth-subtitle {
        font-size: 12px;
        margin-bottom: 20px;
    }
    
    .auth-logo {
        margin-bottom: 20px;
    }
    
    .auth-logo-img {
        width: 38px;
        height: 38px;
        border-width: 1.5px;
    }
    
    .auth-logo span {
        font-size: 12px;
        letter-spacing: 1px;
    }
    
    .auth-logo a {
        gap: 10px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-group {
        gap: 4px;
    }
    
    .form-group label {
        font-size: 12px;
    }
    
    .form-group input {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .form-options {
        font-size: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .remember-me {
        font-size: 12px;
    }
    
    .remember-me input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
    
    .btn-auth {
        padding: 11px 14px;
        font-size: 14px;
    }
    
    .auth-divider {
        margin: 16px 0 12px;
        gap: 12px;
    }
    
    .auth-divider span {
        font-size: 11px;
    }
    
    .auth-social {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-social {
        padding: 10px 14px;
        font-size: 13px;
        justify-content: center;
    }
    
    .auth-footer {
        font-size: 13px;
        margin: 14px 0 2px;
    }
    
    /* Avatar upload на мобильных */
    .avatar-preview {
        width: 80px;
        height: 80px;
    }
    
    .avatar-preview svg {
        width: 36px;
        height: 36px;
    }
    
    .avatar-preview span {
        font-size: 10px;
    }
    
    .form-agreement {
        font-size: 12px;
    }
    
    .form-agreement input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    .auth-card {
        padding: 20px 12px 16px;
    }
    
    .auth-title {
        font-size: 18px;
    }
    
    .auth-logo-img {
        width: 32px;
        height: 32px;
    }
    
    .auth-logo span {
        font-size: 10px;
        letter-spacing: 0.5px;
    }
    
    .form-group input {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .btn-auth {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* ============================================================
   ANIMATIONS & EFFECTS
   ============================================================ */

/* Пульсация для кнопки при загрузке */
.btn-auth.loading {
    position: relative;
    color: transparent;
}

.btn-auth.loading::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: buttonSpin 0.8s linear infinite;
}

@keyframes buttonSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Плавное появление элементов формы */
.form-group {
    animation: formFadeIn 0.4s ease forwards;
    opacity: 0;
}

.form-group:nth-child(1) { animation-delay: 0.05s; }
.form-group:nth-child(2) { animation-delay: 0.1s; }
.form-group:nth-child(3) { animation-delay: 0.15s; }
.form-group:nth-child(4) { animation-delay: 0.2s; }
.form-group:nth-child(5) { animation-delay: 0.25s; }
.form-group:nth-child(6) { animation-delay: 0.3s; }

@keyframes formFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover эффект для всей карточки */
.auth-card:hover {
    box-shadow: var(--shadow-hover, 0 2px 12px rgba(0, 0, 0, 0.12));
}

/* ============================================================
   DARK THEME SUPPORT
   ============================================================ */
/* ============================================================
   FIELD ERRORS - Ошибки под полями
   ============================================================ */

.field-error {
    display: none;
    color: #e41e3f;
    font-size: 12px;
    margin-top: 4px;
    padding: 6px 10px;
    background: #fdedf0;
    border-radius: 6px;
    border-left: 3px solid #e41e3f;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group input.error {
    border-color: #e41e3f !important;
    box-shadow: 0 0 0 3px rgba(228, 30, 63, 0.1) !important;
    background: #fff8f8 !important;
}

.form-group input.error:focus {
    border-color: #e41e3f !important;
    box-shadow: 0 0 0 3px rgba(228, 30, 63, 0.15) !important;
}

/* ============================================================
   AUTH MESSAGES - Общие сообщения
   ============================================================ */

.auth-message {
    display: none;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

.auth-message.error {
    display: block;
    background: #fdedf0;
    color: #e41e3f;
    border: 1px solid #f5c6cb;
}

.auth-message.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}