/* ======================== SETUP ======================== */

@font-face {
    font-family: "Rubik";
    src: url("../fonts/Rubik.woff") format("woff");
}

@font-face {
    font-family: "PlayfairDisplay";
    src: url("../fonts/PlayfairDisplay.woff") format("woff");
}

:root {
    --font-body: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-heading: "PlayfairDisplay", Georgia, serif;

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-bg: #f0f4ff;
    --color-card: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-input-bg: #f8fafc;
    --color-error: #ef4444;
    --color-success: #22c55e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 60px -12px rgba(37, 99, 235, 0.15), 0 8px 24px -8px rgba(0, 0, 0, 0.08);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

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

html {
    font-size: 16px;
}

/* ======================== BODY ======================== */

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--color-text);
    overflow: hidden;
}

/* ======================== BG GRADIENT ======================== */

.bg-gradient {
    position: fixed;
    top: -40%;
    right: -20%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.bg-gradient::after {
    content: "";
    position: fixed;
    bottom: -30%;
    left: -15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ======================== LOADING SCREEN ======================== */

#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

#loading-screen img {
    width: 80px;
    margin-bottom: 24px;
}

#loading-screen p {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--color-text-muted);
    max-width: 340px;
    text-align: center;
    line-height: 1.5;
}

/* ======================== LOGIN CARD ======================== */

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px 36px;
}

/* ======================== CARD HEADER ======================== */

.card-header {
    text-align: center;
    margin-bottom: 36px;
}

.card-header #Logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 20px;
}

.card-header #heading {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}

.card-header #subtitle {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

.card-header #error {
    font-size: 0.85rem;
    color: var(--color-error);
    font-weight: 500;
    min-height: 20px;
    margin-top: 8px;
    transition: all 0.3s ease;
}

/* ======================== FORM ======================== */

#form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--color-text-muted);
    pointer-events: none;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    font-family: var(--font-body);
    font-size: 0.925rem;
    color: var(--color-text);
    background: var(--color-input-bg);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.2s ease;
}

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

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
    color: var(--color-primary);
}

.input-wrapper:has(input:focus) .input-icon {
    color: var(--color-primary);
}

.input-wrapper input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* ======================== TOGGLE PASSWORD ======================== */

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

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

/* ======================== SUBMIT BUTTON ======================== */

#submit_button {
    width: 100%;
    padding: 13px;
    margin-top: 8px;
    font-family: var(--font-body);
    font-size: 0.925rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #fff;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#submit_button:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

#submit_button:active {
    transform: translateY(0);
    box-shadow: none;
}

#submit_button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

#btn-loader {
    line-height: 0;
}

#btn-loader .login-spinner {
    width: 20px;
    height: 20px;
    display: block;
    transform-origin: 50% 50%;
    transform-box: fill-box;
    animation: btn-loader-spin 0.9s linear infinite;
}

@keyframes btn-loader-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ======================== CARD FOOTER ======================== */

.card-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

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

/* ======================== RESPONSIVE ======================== */

@media (max-width: 480px) {
    .login-card {
        padding: 36px 24px 28px;
        border-radius: var(--radius-md);
    }

    .card-header #heading {
        font-size: 1.5rem;
    }

    .bg-gradient,
    .bg-gradient::after {
        display: none;
    }
}

/* ======================== SHAKE ANIMATION ======================== */

.login-card.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}