
:root {
    --primary: #6B73FF;
    --primary-dark: #000DFF;
    --text-primary: #2C3E50;
    --text-secondary: #6C7A89;
    --background: #F8FAFC;
    --white: #FFFFFF;
    --danger: #dc3545;
    --success: #28a745;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --gradient: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);
    --border-radius: 10px;
    --transition: all 0.3s ease;
    --input-height: 45px;
    --input-bg: #FFFFFF;
    --input-border: rgba(107, 115, 255, 0.2);
    --card-bg: #FFFFFF;
}

[data-theme="dark"] {
    --primary: #8B92FF;
    --primary-dark: #4B51FF;
    --text-primary: #FFFFFF;
    --text-secondary: #B0B0B0;
    --background: #121212;
    --white: #1E1E1E;
    --danger: #ff4757;
    --success: #2ecc71;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, #8B92FF 0%, #4B51FF 100%);
    --input-bg: #2D2D2D;
    --input-border: rgba(139, 146, 255, 0.2);
    --card-bg: #2D2D2D;
}

.auth-page {
    --auth-gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --auth-gradient-hover: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    --auth-shadow: 0 25px 50px -12px rgba(107, 115, 255, 0.25);
    --auth-glow: 0 0 100px rgba(107, 115, 255, 0.15);
    --auth-border: rgba(107, 115, 255, 0.1);
    --auth-accent: rgba(107, 115, 255, 0.5);
    position: relative;
    min-height: calc(100vh - var(--nav-height));
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.auth-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.auth-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--auth-accent);
    border-radius: 50%;
    filter: blur(1px);
    animation: floatParticle 20s linear infinite;
}

.auth-particle:nth-child(2n) {
    width: 8px;
    height: 8px;
    animation-duration: 25s;
}

.auth-particle:nth-child(3n) {
    width: 4px;
    height: 4px;
    animation-duration: 30s;
}

.auth-page::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150vmax;
    height: 150vmax;
    background: radial-gradient(
        circle at center,
        rgba(107, 115, 255, 0.08) 0%,
        transparent 70%
    );
    z-index: 0;
    animation: pulseBackground 15s ease-in-out infinite;
}

.auth-page::after {
    content: '';
    position: fixed;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3z' fill='currentColor' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E") repeat;
    opacity: 0.5;
    z-index: 0;
    animation: backgroundShift 60s linear infinite;
}

.auth-container {
    width: 90%;
    max-width: 450px;
    margin: 3rem auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md), var(--auth-glow);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--auth-border);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.5s ease;
}

.auth-container:hover {
    transform: translateY(-5px);
    box-shadow: var(--auth-shadow), 
                var(--auth-glow),
                0 0 0 1px var(--auth-accent);
}

.card-title,
h1,
h3 {
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: fadeInText 1.2s ease-out forwards, enlargeText 1s ease-out;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .card-title,
[data-theme="dark"] h1,
[data-theme="dark"] h3 {
    text-shadow: 2px 2px 5px rgba(139, 146, 255, 0.2);
}

form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    align-items: stretch;
    margin-bottom: 1rem;
}

.input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    border: none;
    color: var(--white);
    padding: 0 1rem;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    height: var(--input-height);
}

.form-control {
    height: var(--input-height);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    width: 100%;
    color: var(--text-primary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 146, 255, 0.1);
}

[data-theme="dark"] .form-control:focus {
    box-shadow: 0 0 0 3px rgba(139, 146, 255, 0.2);
}

.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

.btn {
    height: var(--input-height);
    padding: 0 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.btn-primary {
    background: var(--gradient);
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--auth-gradient-hover);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:hover::after {
    opacity: 1;
}

.btn-telegram {
    background: linear-gradient(135deg, #00aaff, #0088cc);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 6px rgba(0, 136, 204, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-telegram::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(250, 247, 247, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.btn-telegram:hover {
    background: linear-gradient(135deg, #0099cc, #006f8c);
    transform: translateY(-3px);
    box-shadow: 0 8px 12px rgba(0, 136, 204, 0.4);
}

.btn-telegram:hover::after {
    opacity: 1;
}

.btn-telegram:active {
    transform: translateY(1px);
    box-shadow: 0 4px 6px rgba(0, 136, 204, 0.2);
}

.btn-telegram i {
    font-size: 1.25rem;
    position: relative;
    z-index: 1;
}

.btn-telegram span {
    position: relative;
    z-index: 1;
}

.btn-primary::before,
.btn-primary::after {
    z-index: 0;
}

.btn-primary > * {
    position: relative;
    z-index: 1;
}

.text-danger {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

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

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

@keyframes floatParticle {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx, 100px), var(--ty, -100px));
        opacity: 0;
    }
}

@keyframes backgroundShift {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 100% 100%;
    }
}

@keyframes pulseBackground {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

@keyframes enlargeText {
    0% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

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

@keyframes shake {
    10%, 90% {
        transform: translateX(-1px);
    }
    20%, 80% {
        transform: translateX(2px);
    }
    30%, 50%, 70% {
        transform: translateX(-4px);
    }
    40%, 60% {
        transform: translateX(4px);
    }
}

[data-theme="dark"] .auth-container {
    background-color: rgba(30, 30, 30, 0.8);
    border-color: rgba(107, 115, 255, 0.2);
}

[data-theme="dark"] .auth-page::before {
    opacity: 0.15;
}

[data-theme="dark"] .auth-particle {
    opacity: 0.6;
}

@media (max-width: 768px) {
    :root {
        --input-height: 42px;
    }
    .auth-container {
        width: 95%;
        padding: 1.5rem;
        margin: 2rem auto;
    }
    .card-title,
    h1,
    h3 {
        font-size: 1.75rem;
    }
    .form-control {
        font-size: 0.95rem;
    }
    .auth-particles {
        display: none;
    }
}

@media (max-width: 480px) {
    :root {
        --input-height: 40px;
    }
    .auth-container {
        width: 100%;
        margin: 1rem auto;
        padding: 1.25rem;
    }
    .card-title,
    h1,
    h3 {
        font-size: 1.5rem;
    }
    .form-control {
        font-size: 0.875rem;
    }
    .btn {
        font-size: 0.875rem;
    }
}

@media print {
    .auth-page::before,
    .auth-page::after,
    .auth-particles {
        display: none;
    }
    
    .auth-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .btn-telegram {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.divider-text {
    position: relative;
    display: inline-block;
    padding: 0 10px;
    color: var(--text-secondary);
}

.divider-text::before,
.divider-text::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 50px;
    height: 1px;
    background: var(--input-border);
}

.divider-text::before {
    right: 100%;
}

.divider-text::after {
    left: 100%;
}

.auth-links {
    font-size: 0.9rem;
}

.auth-links a {
    color: var(--primary);
    transition: color 0.3s ease;
}

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

.password-strength {
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease-out;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

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

.toggle-password {
    cursor: pointer;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-left: none;
    color: var(--text-secondary);
    transition: var(--transition);
}

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

.toggle-password:focus {
    outline: none;
    box-shadow: none;
}

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

.password-strength {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.input-group {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

.input-group .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}