/* Custom Properties */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --success: #10b981;
    --surface: #ffffff;
    --background: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    padding: 1rem;
}

/* Animated Background */
@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Container Styles */
.container {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    animation: slideUp 0.6s ease forwards;
    position: relative;
    overflow: hidden;
}

/* Container Animation */
@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Decorative Element */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: borderFlow 3s linear infinite;
}

@keyframes borderFlow {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    animation: fadeIn 0.6s ease forwards 0.3s;
    opacity: 0;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Label Styles */
label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transform: translateY(10px);
    opacity: 0;
    animation: slideUp 0.4s ease forwards;
}

label:nth-child(2) {
    animation-delay: 0.2s;
}

/* Input Styles */
input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(10px);
    opacity: 0;
    animation: slideUp 0.4s ease forwards;
}

input:nth-of-type(1) {
    animation-delay: 0.3s;
}

input:nth-of-type(2) {
    animation-delay: 0.4s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Floating Label Animation */
input:focus + label,
input:not(:placeholder-shown) + label {
    transform: translateY(-1.5rem) scale(0.9);
    color: var(--primary);
}

/* Button Styles */
button {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    transform: translateY(10px);
    opacity: 0;
    animation: slideUp 0.4s ease forwards 0.5s;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.6s;
}

button:hover::before {
    transform: translate(-50%, -50%) scale(2);
}

button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

button:active {
    transform: translateY(0);
}

/* Loading State */
button.loading {
    position: relative;
    color: transparent;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Shake Animation for Error */
.error {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
    10%, 90% {
        transform: translateX(-1px);
    }
    20%, 80% {
        transform: translateX(2px);
    }
    30%, 50%, 70% {
        transform: translateX(-4px);
    }
    40%, 60% {
        transform: translateX(4px);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .container {
        background: rgba(31, 41, 55, 0.9);
    }

    h1, label {
        color: #f9fafb;
    }

    input {
        background: rgba(55, 65, 81, 0.9);
        border-color: #4b5563;
        color: #f9fafb;
    }

    input:focus {
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 2rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    input {
        padding: 0.875rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: none;
    }

    .container {
        box-shadow: none;
        max-width: 100%;
    }
}