* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0a1628 0%, #0f1b2e 50%, #0a1628 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Animated gradient background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.2) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.25) 0%, transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(96, 165, 250, 0.15) 0%, transparent 50%);
    animation: gradientShift 15s ease infinite;
    z-index: 0;
}

@keyframes gradientShift {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

/* Floating particles */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.15), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(255, 255, 255, 0.15), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(1px 1px at 33% 50%, rgba(255, 255, 255, 0.1), transparent);
    background-size: 200% 200%;
    animation: particleFloat 20s ease-in-out infinite;
    z-index: 0;
}

@keyframes particleFloat {
    0%, 100% { background-position: 0% 0%, 100% 100%, 50% 50%, 80% 20%, 20% 80%, 70% 30%; }
    50% { background-position: 100% 100%, 0% 0%, 30% 70%, 60% 40%, 40% 60%, 90% 10%; }
}

.wrap {
    max-width: 480px;
    width: 100%;
    position: relative;
    z-index: 10;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.card {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-radius: 32px;
    padding: 48px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(37, 99, 235, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

/* Animated gradient border */
.card::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 32px;
    padding: 2px;
    background: linear-gradient(135deg, 
        rgba(37, 99, 235, 0.6),
        rgba(59, 130, 246, 0.5),
        rgba(96, 165, 250, 0.6),
        rgba(37, 99, 235, 0.6));
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderGlow 3s ease infinite;
    z-index: -1;
}

@keyframes borderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Glow effect on top */
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent,
        rgba(139, 92, 246, 0.8),
        transparent);
    filter: blur(8px);
}

.logo {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 50%, #2563eb 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    animation: logoShine 3s ease-in-out infinite;
}

@keyframes logoShine {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.badge {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.15));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 20px;
    color: #4ade80;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 24px;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { transform: scale(1.02); box-shadow: 0 0 20px rgba(34, 197, 94, 0.2); }
}

.card-title {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 32px;
    font-size: 15px;
}

.subtitle.small {
    font-size: 14px;
}

.login-header {
    margin-bottom: 32px;
}

.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.15));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 16px;
    padding: 16px;
    color: #fca5a5;
    margin-bottom: 24px;
    font-size: 14px;
    animation: errorShake 0.5s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.info-box {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.12));
    border: 1px solid rgba(37, 99, 235, 0.4);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    animation: infoGlow 2s ease-in-out infinite;
}

@keyframes infoGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(37, 99, 235, 0.15); }
    50% { box-shadow: 0 0 40px rgba(37, 99, 235, 0.25); }
}

.info-box p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 12px;
}

.code-display {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(37, 99, 235, 0.5);
    border-radius: 16px;
    padding: 20px;
    font-size: 32px;
    font-weight: 800;
    color: #60a5fa;
    letter-spacing: 8px;
    font-family: 'Courier New', monospace;
    text-align: center;
    animation: codeReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes codeReveal {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.login-form {
    margin-top: 24px;
}

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

.field-label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.input-wrap {
    position: relative;
    width: 100%;
}

/* Floating labels для signup формы */
.floating-label {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 15px;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    padding: 0 4px;
    z-index: 2;
}

/* Когда поле в фокусе или заполнено */
.login-form input:focus ~ .floating-label,
.login-form input:not(:placeholder-shown) ~ .floating-label,
.login-form input[value]:not([value=""]) ~ .floating-label {
    top: -10px;
    left: 14px;
    font-size: 12px;
    color: #60a5fa;
    font-weight: 600;
    background: rgba(15, 23, 42, 0.95);
}

/* Стили для всех input полей */
.login-form input[type="text"],
.login-form input[type="password"],
.login-form input[type="email"],
.login-form input[type="tel"],
.login-form textarea,
.login-form select,
.login-form .input {
    display: block !important;
    width: 100% !important;
    padding: 16px 18px !important;
    border: 2px solid rgba(37, 99, 235, 0.4) !important;
    border-radius: 16px !important;
    background: rgba(30, 41, 59, 0.5) !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-family: inherit !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    box-sizing: border-box !important;
}

/* Placeholder стили */
.login-form input::placeholder,
.login-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

/* Focus состояние */
.login-form input:focus,
.login-form textarea:focus,
.login-form select:focus {
    border-color: rgba(59, 130, 246, 0.8) !important;
    background: rgba(30, 41, 59, 0.7) !important;
    box-shadow: 
        0 0 0 4px rgba(37, 99, 235, 0.15),
        0 8px 24px rgba(59, 130, 246, 0.2) !important;
    transform: translateY(-2px);
}

/* Hover состояние */
.login-form input:hover:not(:focus),
.login-form textarea:hover:not(:focus),
.login-form select:hover:not(:focus) {
    border-color: rgba(59, 130, 246, 0.6) !important;
    background: rgba(30, 41, 59, 0.6) !important;
}

/* Django form errors */
.login-form .errorlist {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.login-form .errorlist li {
    color: #fca5a5;
    font-size: 13px;
    padding: 4px 0;
}

.cta {
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #1d4ed8 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 16px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 24px;
    box-shadow: 
        0 4px 16px rgba(37, 99, 235, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    position: relative;
    overflow: hidden;
}

.cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.cta:hover::before {
    transform: translateX(100%);
}

.cta:hover {
    background-position: 100% 50%;
    box-shadow: 
        0 8px 32px rgba(37, 99, 235, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-2px);
}

.cta:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(37, 99, 235, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.link-more {
    color: #60a5fa;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.link-more::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    transition: width 0.3s ease;
}

.link-more:hover {
    color: #93c5fd;
}

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

.note {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    line-height: 1.6;
    margin-top: 16px;
}

a {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 600;
}

a:hover {
    color: #93c5fd;
}

p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .card {
        padding: 32px 24px;
        border-radius: 24px;
    }
    
    .logo {
        font-size: 28px;
    }
    
    .card-title {
        font-size: 24px;
    }
    
    .code-display {
        font-size: 24px;
        letter-spacing: 6px;
    }
}

/* Loading state for buttons */
.cta.loading {
    pointer-events: none;
    opacity: 0.7;
}

.cta.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.6s linear infinite;
}

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

/* Toast notification styles */
.fw-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: all 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
.fw-toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.fw-toast-body {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(37,99,235,0.28);
  font-weight: 700;
  min-width: 220px;
  text-align: center;
}