/* ========================================
   Карманный консультант - Auth Styles
   Turquoise Theme Design System
   ======================================== */

/* Root Variables */
:root {
    --auth-primary: #40E0D0;
    --auth-primary-dark: #2BA5A0;
    --auth-primary-darker: #1E7B7B;
    --auth-background: #0A0F14;
    --auth-background-light: #111922;
    --auth-card-bg: rgba(26, 58, 82, 0.4);
    --auth-card-border: rgba(64, 224, 208, 0.1);
    --auth-text: #FFFFFF;
    --auth-text-muted: rgba(255, 255, 255, 0.7);
    --auth-input-bg: rgba(17, 25, 34, 0.8);
    --auth-input-border: rgba(64, 224, 208, 0.2);
    --auth-error: #FF4757;
    --auth-success: #48C78E;
}

/* Base Styles */
body {
    background: linear-gradient(135deg, var(--auth-background) 0%, var(--auth-background-light) 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    color: var(--auth-text);
    position: relative;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Animated Background */
.auth-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: linear-gradient(135deg, var(--auth-background) 0%, var(--auth-background-light) 100%);
}

/* Removed floating particles - no longer needed */

/* Auth Container */
.auth-container {
    min-height: 100vh; /* Полная высота без навбара */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Auth Card - Glassmorphism Effect */
.auth-card {
    background: var(--auth-card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--auth-card-border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    margin: 20px auto; /* Добавляем margin для отступов */
    box-shadow: 
        0 8px 32px 0 rgba(64, 224, 208, 0.1),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    animation: slideUp 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

/* Removed rotating glow effect */

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

/* Logo Section */
.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo-link {
    display: inline-block;
    transition: transform 0.3s ease;
    text-decoration: none;
}

.logo-link:hover {
    transform: scale(1.05);
}

.auth-logo img {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 6px rgba(64, 224, 208, 0.3));
    cursor: pointer;
}

/* Removed pulse animation */

.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--auth-text);
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--auth-text-muted);
}

/* Form Styles */
.auth-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 10px;
    color: var(--auth-text);
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--auth-primary);
    background: rgba(17, 25, 34, 0.95);
    box-shadow: 
        0 0 0 3px rgba(64, 224, 208, 0.1),
        inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

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

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

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

/* Form Validation */
.form-control.is-invalid {
    border-color: var(--auth-error);
}

.form-control.is-valid {
    border-color: var(--auth-success);
}

.invalid-feedback {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--auth-error);
}

.valid-feedback {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--auth-success);
}

/* Checkbox */
.form-check {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start; /* Изменяем на flex-start для лучшего выравнивания */
}

.form-check-input {
    width: 18px;
    height: 18px;
    min-width: 18px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 4px;
    margin-right: 8px;
    margin-top: 2px; /* Небольшой отступ для выравнивания с текстом */
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0; /* Чтобы чекбокс не сжимался */
}

.form-check-input:checked {
    background: linear-gradient(135deg, var(--auth-primary-darker) 0%, var(--auth-primary-dark) 100%);
    border-color: var(--auth-primary-dark);
}

.form-check-label {
    font-size: 14px;
    color: var(--auth-text-muted);
    cursor: pointer;
    margin-bottom: 0;
    line-height: 1.5;
}

/* Style links in checkboxes */
.form-check-label a {
    color: var(--auth-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.form-check-label a:hover {
    color: var(--auth-primary-dark);
    border-bottom-color: var(--auth-primary-dark);
}

/* Submit Button */
.btn-auth {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(145deg, var(--auth-primary-darker), var(--auth-primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-auth:hover {
    background: linear-gradient(145deg, #0F4C4C, var(--auth-primary-darker));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(64, 224, 208, 0.2);
}

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

/* Loading State */
.btn-auth.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-auth.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.8s linear infinite;
}

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

/* Links */
.auth-links {
    margin-top: 25px;
    text-align: center;
}

.auth-link {
    color: var(--auth-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
}

.auth-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--auth-primary);
    transition: width 0.3s ease;
}

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

.auth-link:hover::after {
    width: 100%;
}

.auth-divider {
    margin: 15px 0;
    color: var(--auth-text-muted);
    font-size: 13px;
}

/* Social Login (Optional) */
.social-login {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.social-login-title {
    text-align: center;
    font-size: 13px;
    color: var(--auth-text-muted);
    margin-bottom: 15px;
}

.social-buttons {
    display: flex;
    gap: 10px;
}

.btn-social {
    flex: 1;
    padding: 10px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 8px;
    color: var(--auth-text);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-social:hover {
    background: rgba(64, 224, 208, 0.1);
    border-color: var(--auth-primary);
}

/* Error Messages */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
    position: relative;
}

.alert-error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: var(--auth-error);
}

.alert-success {
    background: rgba(72, 199, 142, 0.1);
    border: 1px solid rgba(72, 199, 142, 0.3);
    color: var(--auth-success);
}

/* Fix Bootstrap alert close button */
.alert-dismissible .btn-close {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    padding: 0;
    background: transparent;
    border: 0;
    opacity: 0.5;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-dismissible .btn-close::before,
.alert-dismissible .btn-close::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 2px;
    background: currentColor;
}

.alert-dismissible .btn-close::before {
    transform: rotate(45deg);
}

.alert-dismissible .btn-close::after {
    transform: rotate(-45deg);
}

.alert-dismissible .btn-close:hover {
    opacity: 0.8;
}

/* Django messages framework */
.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.messages li {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

.messages .error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: var(--auth-error);
}

.messages .success {
    background: rgba(72, 199, 142, 0.1);
    border: 1px solid rgba(72, 199, 142, 0.3);
    color: var(--auth-success);
}

.messages .warning {
    background: rgba(255, 165, 2, 0.1);
    border: 1px solid rgba(255, 165, 2, 0.3);
    color: #FFA502;
}

.messages .info {
    background: rgba(64, 224, 208, 0.1);
    border: 1px solid rgba(64, 224, 208, 0.3);
    color: var(--auth-primary);
}

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

/* Password Strength Indicator */
.password-strength {
    margin-top: 8px;
    height: 4px;
    background: var(--auth-input-bg);
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.password-strength-bar.weak {
    width: 33%;
    background: var(--auth-error);
}

.password-strength-bar.medium {
    width: 66%;
    background: #FFA502;
}

.password-strength-bar.strong {
    width: 100%;
    background: var(--auth-success);
}

/* Responsive Design */
@media (max-width: 480px) {
    .auth-card {
        padding: 25px 15px;
        border-radius: 15px;
        margin: 10px auto;
        max-width: calc(100% - 30px);
    }
    
    .auth-container {
        padding: 15px;
        min-height: 100vh;
        align-items: center; /* Центрируем без навбара */
    }
    
    .auth-logo {
        margin-bottom: 20px;
    }
    
    .auth-logo img {
        width: 50px;
        height: 50px;
        margin-bottom: 10px;
    }
    
    .auth-form {
        margin-top: 20px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .auth-title {
        font-size: 20px;
    }
    
    .form-control {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn-auth {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    /* Уменьшаем размер заголовков на мобильных */
    .auth-title {
        font-size: 20px;
    }
    
    .auth-subtitle {
        font-size: 13px;
    }
    
    /* Particles removed completely */
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Dark Mode Support (already dark by default) */
@media (prefers-color-scheme: light) {
    /* Keep dark theme even in light mode for consistency */
}

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
}

/* Remove default Bootstrap styles */
.card, .card-header, .card-body {
    background: transparent !important;
    border: none !important;
}

.bg-dark {
    background: var(--auth-background) !important;
}

/* Fix footer styles */
footer, footer.bg-light {
    background: var(--auth-background) !important;
    border-top: 1px solid rgba(64, 224, 208, 0.1);
    margin-top: auto;
}

footer .text-muted {
    color: var(--auth-text-muted) !important;
}

footer a {
    color: var(--auth-primary) !important;
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
    z-index: 10;
}

footer a:hover {
    color: var(--auth-primary-dark) !important;
    text-decoration: underline;
}

/* Fix navbar links */
.navbar-nav .nav-link {
    position: relative;
    z-index: 10;
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-nav .nav-link:hover {
    color: var(--auth-primary) !important;
}

/* Override Crispy Forms Styles */
.form-group label {
    color: var(--auth-text-muted) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 8px !important;
}

/* Translate Password label */
label[for="id_password"]:after {
    content: 'Пароль';
}
label[for="id_password"] {
    font-size: 0 !important;
}
label[for="id_password"]:after {
    font-size: 13px !important;
}

.textinput, .emailinput, .passwordinput {
    width: 100% !important;
    padding: 12px 16px !important;
    background: var(--auth-input-bg) !important;
    border: 1px solid var(--auth-input-border) !important;
    border-radius: 10px !important;
    color: var(--auth-text) !important;
    font-size: 15px !important;
    transition: all 0.3s ease !important;
}

.textinput:focus, .emailinput:focus, .passwordinput:focus {
    border-color: var(--auth-primary) !important;
    background: rgba(17, 25, 34, 0.95) !important;
    box-shadow: 
        0 0 0 3px rgba(64, 224, 208, 0.1),
        inset 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    outline: none !important;
}

.form-text, .help-block {
    color: var(--auth-text-muted) !important;
    font-size: 12px !important;
    margin-top: 5px !important;
}

/* Remove redundant styles from templates */
body, footer, .bg-light, .card {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif !important;
}

/* Hide all help text and labels we don't need */
#id_password1_helptext, 
.helptext,
.form-text.text-muted,
.form-text:not(.invalid-feedback),
small.form-text {
    display: none !important;
}

/* Hide "Required. 150 characters or fewer" text */
#div_id_username .form-text,
#div_id_username small {
    display: none !important;
}

/* Show only on error */
.is-invalid ~ .invalid-feedback {
    display: block !important;
}

/* Fix alert styles in base template */
.alert.alert-dismissible {
    padding-right: 40px; /* Space for close button */
}

/* Override Bootstrap alert close button positioning */
.btn-close {
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat !important;
    opacity: 0.7;
}

.btn-close:hover {
    opacity: 1;
}