:root {
    --primary: #6857a5;
    --primary-dark: #4e4183;
    --primary-light: #8a7bc9;
    --gray: #6b7280;
    --border: #e5e7eb;
    --error: #ef4444;
    --success: #10b981;
}

* {
    box-sizing: border-box;
    font-family: "Segoe UI", system-ui, sans-serif;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg,
    #0a0e17 0%,
    #1a1f3a 25%,
    #2d2563 50%,
    #4e4183 75%,
    #6857a5 100%);
    background-size: 400% 400%;
    animation: gradientMove 15s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

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

/* Subtle Spiral Accents */
.spiral-accent {
    position: fixed;
    width: 800px;
    height: 800px;
    pointer-events: none;
    opacity: 0.05;
    z-index: 1;
}

.spiral-1 {
    top: -400px;
    right: -200px;
    background: radial-gradient(circle, transparent 30%, var(--primary) 70%);
    border-radius: 50%;
    animation: spiralFloat 20s linear infinite;
}

.spiral-2 {
    bottom: -400px;
    left: -200px;
    background: radial-gradient(circle, transparent 30%, var(--primary-light) 70%);
    border-radius: 50%;
    animation: spiralFloat 25s linear infinite reverse;
}

@keyframes spiralFloat {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Subtle Particle Effect */
.particle {
    position: fixed;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

/* Main container */
.container {
    background: rgba(255, 255, 255, 0.95);
    width: 100%;
    max-width: 420px;
    border-radius: 18px;
    padding: 30px 25px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 40px rgba(104, 87, 165, 0.2);
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
    position: relative;
    animation: containerFloat 6s ease-in-out infinite;
}

@keyframes containerFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.logo {
    text-align: center;
    margin-bottom: 10px;
}

.logo a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
}

.logo-box {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 8px 20px rgba(104, 87, 165, 0.3);
    position: relative;
    overflow: hidden;
    animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(104, 87, 165, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(104, 87, 165, 0.5);
    }
}

.logo-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    animation: logoShine 3s ease-in-out infinite;
}

@keyframes logoShine {
    0% {
        transform: translateX(-100%);
    }
    50%, 100% {
        transform: translateX(100%);
    }
}

.logo-image {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: brightness(1.1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    z-index: 1;
}

.logo h1 {
    color: var(--primary);
    font-size: 26px;
    text-transform: uppercase;
    margin: 0 0 4px 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo p {
    color: var(--gray);
    font-size: 14px;
    margin: 0;
    font-weight: 500;
}

.logo-fallback {
    display: none;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 16px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group svg.icon {
    width: 20px;
    height: 20px;
    fill: var(--gray);
    flex-shrink: 0;
    transition: fill 0.3s ease;
}

.form-group input {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 14px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(104, 87, 165, 0.1);
}

.form-group input:focus + .form-group svg.icon {
    fill: var(--primary);
}

.form-group input.input-error {
    border-color: var(--error);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.2s ease;
}

.toggle-password:hover {
    transform: scale(1.1);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
    fill: var(--gray);
    transition: fill 0.2s;
}

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

.btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.7s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(104, 87, 165, 0.3);
}

.btn:hover:not(:disabled)::before {
    left: 100%;
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-disabled {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
    color: #6b7280;
    font-size: 15px;
    cursor: not-allowed;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    position: relative;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 3px 6px rgba(245, 158, 11, 0.3);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.actions {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

.action-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--primary);
    font-size: 14px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
}

.action-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(104, 87, 165, 0.1), transparent);
    transition: left 0.5s ease;
}

.action-link:hover {
    background: #f5f3ff;
    border-color: var(--primary);
    transform: translateX(5px);
}

.action-link:hover::before {
    left: 100%;
}

.action-link svg {
    width: 18px;
    height: 18px;
    fill: var(--primary);
    transition: transform 0.3s ease;
}

.action-link:hover svg {
    transform: translateX(3px);
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 320px;
    max-width: 420px;
    animation: slideIn 0.3s ease-out forwards;
    pointer-events: auto;
    border-left: 4px solid;
    backdrop-filter: blur(10px);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.hide {
    animation: slideOut 0.3s ease-out forwards;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.error .toast-icon {
    color: var(--error);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    color: #1f2937;
}

.toast-message {
    font-size: 13px;
    color: var(--gray);
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--gray);
    padding: 0;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.3s ease;
}

.toast-close:hover {
    color: #1f2937;
}

@media (max-width: 480px) {
    .container {
        padding: 25px 20px;
        border-radius: 15px;
    }

    .logo h1 {
        font-size: 22px;
    }

    .logo p {
        font-size: 13px;
    }

    .logo-box {
        width: 60px;
        height: 60px;
    }

    .logo-image {
        width: 35px;
        height: 35px;
    }

    .form-group input {
        font-size: 13px;
        padding: 10px;
    }

    .btn {
        padding: 12px;
        font-size: 14px;
    }

    .action-link {
        font-size: 13px;
        padding: 10px 12px;
    }

    .toast-container {
        bottom: 10px;
        right: 10px;
    }

    .toast {
        min-width: 280px;
    }
}

/* Performance optimizations */
.spiral-accent, .particle, .logo-box, .logo-box::before {
    will-change: transform, opacity;
}

.container, .btn, .action-link {
    will-change: transform;
}

/* Fallback for logo loading */
.logo-fallback {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary);
    font-size: 14px;
}
