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

:root {
    --primary:     #696CFF;
    --primary-dark:#5a5de8;
    --icon-bg:     #e41c1c;
    --text-head:   #444465;
    --text-sub:    #a1a1b5;
    --text-input:  #6c6c84;
    --border:      #e4e4f0;
    --bg:          #f4f5fa;
    --card-bg:     #ffffff;
    --error-bg:    #fff1f0;
    --error-text:  #d94040;
    --shadow:      0 8px 40px rgba(105,108,255,.12), 0 2px 12px rgba(0,0,0,.06);
    --radius:      14px;
}

html, body {
    height: 100%;
    font-family: 'Sora', sans-serif;
    background: var(--bg);
    color: var(--text-head);
}

/* ── Background decorations ── */
.bg-wrap {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .45;
}
.blob-1 {
    width: 520px; height: 520px;
    background: radial-gradient(circle, #c7c9ff 0%, #e8e9ff 60%);
    bottom: -120px; left: -120px;
}
.blob-2 {
    width: 380px; height: 380px;
    background: radial-gradient(circle, #d4d5ff 0%, #eeeeff 60%);
    top: -80px; right: -80px;
}

/* 3-D orb (bottom-left, matches screenshot) */
.orb {
    position: absolute;
    bottom: 80px; left: 120px;
    width: 64px; height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #7a7a8a, #2c2c38 70%);
    box-shadow: 8px 10px 28px rgba(0,0,0,.35), inset -4px -4px 10px rgba(255,255,255,.06);
}

/* Ellipse shadow under orb */
.orb::after {
    content: '';
    position: absolute;
    bottom: -20px; left: -28px;
    width: 120px; height: 26px;
    background: radial-gradient(ellipse, rgba(0,0,0,.18) 0%, transparent 70%);
    border-radius: 50%;
}

/* ── Layout ── */
.login-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

/* ── Card ── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 40px 44px;
    width: 100%;
    max-width: 460px;
    animation: cardIn .5s cubic-bezier(.22,.68,0,1.2) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(28px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.card-header {
    margin-bottom: 28px;
}

.card-header h1 {
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--text-head);
    line-height: 1.3;
}

.wave {
    display: inline-block;
    animation: wave 1.8s ease-in-out infinite;
    transform-origin: 70% 70%;
}
@keyframes wave {
    0%,100% { transform: rotate(0deg); }
    20%      { transform: rotate(-15deg); }
    40%      { transform: rotate(12deg); }
    60%      { transform: rotate(-8deg); }
    80%      { transform: rotate(6deg); }
}

.card-header p {
    margin-top: 6px;
    font-size: .875rem;
    color: var(--text-sub);
    font-weight: 400;
}

/* ── Error alert ── */
.alert-error {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #ffd6d6;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: 20px;
    animation: shake .3s ease;
}
.alert-error svg {
    width: 18px; height: 18px;
    flex-shrink: 0;
}
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(3px); }
}

/* ── Field group ── */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
}

/* ── Input wrap ── */
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap input {
    width: 100%;
    height: 48px;
    padding: 0 56px 0 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: .9rem;
    color: var(--text-input);
    background: #fff;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.input-wrap input::placeholder {
    color: #b0b0c8;
}

.input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(105,108,255,.15);
}

/* Password field has two icons */
.input-actions {
    position: absolute;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Single icon for username */
.input-wrap > .input-icon {
    position: absolute;
    right: 10px;
}

/* ── Icon buttons ── */
.input-icon,
.toggle-pass {
    background: var(--icon-bg);
    border: none;
    border-radius: 6px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background .15s, transform .1s;
    flex-shrink: 0;
}
.input-icon:hover,
.toggle-pass:hover { background: #c01515; }
.input-icon:active,
.toggle-pass:active { transform: scale(.93); }
.input-icon svg,
.toggle-pass svg {
    width: 14px; height: 14px;
}

.toggle-pass {
    background: transparent;
    color: var(--text-sub);
    border: 1.5px solid var(--border);
}
.toggle-pass:hover { background: #f4f4ff; color: var(--primary); border-color: var(--primary); }

/* ── Sign In button ── */
.btn-signin {
    width: 100%;
    height: 50px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 700;
    letter-spacing: .08em;
    cursor: pointer;
    transition: background .2s, transform .1s, box-shadow .2s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-signin:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(105,108,255,.35);
}
.btn-signin:active { transform: scale(.98); }
.btn-signin:disabled {
    opacity: .75;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.spin {
    width: 16px; height: 16px;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 500px) {
    .card { padding: 32px 24px 36px; }
    .card-header h1 { font-size: 1.25rem; }
    .orb { display: none; }
}
