/* ========================================
   ADVANCED PREMIUM DESIGN SYSTEM
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables */
:root {
    --primary: #10b981;
    --primary-dark: #0d9488;
    --primary-light: #34d399;
    --accent: #14b8a6;
    --bg-dark: #0f0f23;
    --bg-card: rgba(255, 255, 255, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #0a2e26;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --success: #22c55e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-dark);
    overflow: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   ANIMATED BACKGROUND
   ======================================== */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(16, 185, 129, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(59, 130, 246, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 50%);
    animation: bgShift 15s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes bgShift {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(-5%, 3%) rotate(1deg);
    }

    50% {
        transform: translate(3%, -2%) rotate(-0.5deg);
    }

    75% {
        transform: translate(-3%, -5%) rotate(0.5deg);
    }

    100% {
        transform: translate(5%, 2%) rotate(-1deg);
    }
}

/* Floating Orbs */
body::after {
    content: '';
    position: fixed;
    top: 10%;
    right: 15%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.15), transparent 70%);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
    z-index: 0;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-30px) scale(1.05);
    }
}

/* ========================================
   GLASS CARD CONTAINER
   ======================================== */
.container {
    position: relative;
    z-index: 1;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 48px 40px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        var(--shadow-xl),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    width: 100%;
    max-width: 440px;
    animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
    margin: 20px;
}

@keyframes cardEntrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Top gradient accent bar */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary-light));
    background-size: 200% 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {

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

    50% {
        background-position: 100% 50%;
    }
}

/* ========================================
   LOGO / BRAND AREA
   ======================================== */
.brand-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3);
    animation: iconPulse 2s ease-in-out infinite;
}

.brand-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

@keyframes iconPulse {

    0%,
    100% {
        box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3);
    }

    50% {
        box-shadow: 0 8px 48px rgba(16, 185, 129, 0.5);
    }
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h2 {
    color: var(--text-primary);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
    line-height: 1.5;
}

p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========================================
   FORM STYLES
   ======================================== */
.form-group {
    margin-bottom: 22px;
    text-align: left;
    position: relative;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Input with icon wrapper */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    z-index: 2;
    transition: color 0.3s;
    pointer-events: none;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 14px 16px 14px 46px;
    /* Extra left padding for icon */
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--text-primary);
    background: #f9fafb;
    transition: var(--transition);
    outline: none;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover {
    border-color: #d1d5db;
    background: #fff;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

input[type="text"]:focus~.input-icon,
input[type="email"]:focus~.input-icon,
input[type="password"]:focus~.input-icon {
    color: var(--primary);
}

/* Invalid state */
input.is-invalid {
    border-color: var(--danger);
}

input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

/* Password toggle */
.toggle-password {
    position: absolute;
    right: 14px;
    cursor: pointer;
    color: var(--text-muted);
    z-index: 2;
    transition: color 0.3s;
    background: none;
    border: none;
    padding: 4px;
}

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

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px 24px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.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.5s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45);
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

/* ========================================
   DIVIDER
   ======================================== */
.divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
    gap: 16px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.divider span {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* ========================================
   LINKS
   ======================================== */
a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Bottom link text */
.bottom-text {
    margin-top: 28px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: 14px 16px;
    margin-bottom: 24px;
    border-radius: 12px;
    font-size: 14px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: shakeIn 0.5s ease;
    border: 1px solid transparent;
}

.alert-danger {
    color: #991b1b;
    background: var(--danger-bg);
    border-color: var(--danger-border);
}

.alert-danger::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background: var(--danger);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z'/%3E%3C/svg%3E") center/contain no-repeat;
    flex-shrink: 0;
}

@keyframes shakeIn {
    0% {
        transform: translateX(-10px);
        opacity: 0;
    }

    30% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-3px);
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Error text */
.error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 6px;
    display: block;
    font-weight: 500;
}

/* ========================================
   WELCOME PAGE
   ======================================== */
.welcome-container {
    max-width: 550px;
    text-align: center;
    padding: 60px 48px;
}

.welcome-container h2 {
    font-size: 28px;
    margin-bottom: 16px;
}

.welcome-message {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 36px;
}

.logout-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
    width: auto;
    min-width: 220px;
    display: inline-flex;
}

.logout-btn:hover {
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.45);
}

/* ========================================
   PASSWORD STRENGTH INDICATOR
   ======================================== */
.password-strength {
    margin-top: 8px;
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
    width: 0;
}

.strength-weak {
    width: 33%;
    background: var(--danger);
}

.strength-medium {
    width: 66%;
    background: #f59e0b;
}

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

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 480px) {
    .container {
        margin: 16px;
        padding: 36px 24px;
    }

    h2 {
        font-size: 22px;
    }

    .welcome-container {
        padding: 40px 24px;
    }
}

/* ========================================
   LOADING SPINNER
   ======================================== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

.btn:disabled {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}