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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #0f172a;
    --accent: #06b6d4;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-card: rgba(255, 255, 255, 0.85);
    --border: rgba(226, 232, 240, 0.8);
    --shadow: 0 25px 60px rgba(0, 0, 0, 0.18);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(.4, 0, .2, 1);
}

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #d9ebfb 0%, #a9d0f2 45%, #4f93de 100%);
    background-attachment: fixed;
    position: relative;
    overflow: hidden;
}

/* ========== SILK WAVE BACKGROUND ========== */
.bg-silk {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-silk svg {
    width: 100%;
    height: 100%;
    display: block;
}

.silk {
    transform-origin: center;
    animation: silkWave 16s ease-in-out infinite;
    will-change: transform;
}

.silk-2 {
    animation-duration: 20s;
    animation-delay: -4s;
}

.silk-3 {
    animation-duration: 24s;
    animation-delay: -8s;
    opacity: 0.75;
}

@keyframes silkWave {

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

    50% {
        transform: translate(-2%, 1.5%) scale(1.04);
    }
}

/* ========== MAIN CONTAINER ========== */
.login-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius);
    box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    width: 100%;
    max-width: 440px;
    padding: 48px 40px;
    animation: cardSlideUp 0.7s cubic-bezier(.34, 1.56, .64, 1) both;
}

@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========== LOGO & HEADER ========== */
.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
    margin-bottom: 20px;
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {

    0%,
    100% {
        box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
    }

    50% {
        box-shadow: 0 8px 36px rgba(37, 99, 235, 0.65);
    }
}

.logo-wrap svg {
    width: 34px;
    height: 34px;
    fill: white;
}

.login-logo {
    display: block;
    width: 220px;
    max-width: 80%;
    height: auto;
    margin: 0 auto 18px;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ========== ALERTS ========== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.855rem;
    margin-bottom: 20px;
    animation: alertIn 0.4s ease both;
}

@keyframes alertIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

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

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #b91c1c;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #065f46;
}

.alert svg {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ========== FORM ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}

.input-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
}

.form-input {
    width: 100%;
    padding: 12px 44px 12px 44px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input:focus+.input-icon,
.input-wrap:focus-within .input-icon {
    color: var(--primary);
}

.form-input::placeholder {
    color: #b0bec5;
}

/* Password toggle */
.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

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

.form-error-msg {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 5px;
    display: none;
}

.form-error-msg.show {
    display: block;
}

/* ========== REMEMBER & FORGOT ========== */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.83rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.forgot-link {
    font-size: 0.83rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.forgot-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ========== SUBMIT BUTTON ========== */
.btn-login {
    width: 100%;
    padding: 13px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    opacity: 0;
    transition: opacity 0.3s;
}

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

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login .btn-text,
.btn-login .btn-icon {
    position: relative;
    z-index: 1;
}

/* Ripple */
.btn-login .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Loading spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}

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

.btn-login.loading .spinner {
    display: block;
}

.btn-login.loading .btn-text {
    display: none;
}

.btn-login.loading .btn-icon {
    display: none;
}

/* ========== DIVIDER ========== */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ========== FOOTER INFO ========== */
.login-footer {
    text-align: center;
    margin-top: 24px;
}

.login-footer p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 12px;
}

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

    .login-title {
        font-size: 1.4rem;
    }
}

/* ========== FLOATING LABEL ANIMATION ========== */
.input-wrap .form-input:not(:placeholder-shown)~.input-icon,
.input-wrap .form-input:focus~.input-icon {
    color: var(--primary);
}

/* Input shake on error */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

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

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

.shake {
    animation: shake 0.4s ease;
}