/* ===================================
   Login Page - Minimalist Pastel
   Built on top of Bulma v1.0.4
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Custom Properties --- */
:root {
    --bg: #f4f1ee;
    --surface: #ffffff;
    --surface-hover: #faf9f8;
    --border: #e8e4e0;
    --border-focus: #b8b0c8;

    --pastel-purple: #c9b8e8;
    --pastel-purple-light: #ece5f6;
    --pastel-blue: #b8d4e8;
    --pastel-blue-light: #e5f0f6;
    --pastel-pink: #e8b8c8;
    --pastel-pink-light: #f6e5ec;
    --pastel-green: #b8e8c9;
    --pastel-green-light: #e5f6ec;
    --pastel-yellow: #e8ddb8;
    --pastel-yellow-light: #f6f2e5;

    --text-primary: #2d2a33;
    --text-secondary: #6b6573;
    --text-muted: #9e96a8;
    --text-link: #7c6b9e;

    --danger: #d98a8a;
    --danger-bg: #f6e5e5;
    --success: #8ab8a0;
    --success-bg: #e5f2ec;
    --brand-red: #d98a8a;
    --brand-red-hover: #cf7e7e;
    --brand-red-active: #c17171;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151c;
        --surface: #1b212b;
        --surface-hover: #242c39;
        --border: #2e3848;
        --border-focus: #8b95a8;

        --pastel-purple: #8e7bb2;
        --pastel-purple-light: #2c2638;
        --pastel-blue: #6c91b3;
        --pastel-blue-light: #223141;
        --pastel-pink: #aa6f8a;
        --pastel-pink-light: #362636;
        --pastel-green: #6d9f84;
        --pastel-green-light: #25372e;
        --pastel-yellow: #a69268;
        --pastel-yellow-light: #3a3324;

        --text-primary: #eef2fa;
        --text-secondary: #c6cedd;
        --text-muted: #9aa6bd;
        --text-link: #b39ddb;

        --danger: #ef9a9a;
        --danger-bg: #3a2628;
        --success: #9ed4b2;
        --success-bg: #22382d;
        --brand-red: #cf7e7e;
        --brand-red-hover: #d98a8a;
        --brand-red-active: #b96b6b;

        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.45);
    }
}

/* --- Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
}

/* --- Login Layout --- */
.login-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Left Hero Panel --- */
.login-hero {
    flex: 1;
    background: var(--pastel-purple-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

/* Decorative shapes — soft, static circles */
.floating-orb {
    position: absolute;
    border-radius: 50%;
    opacity: 1;
    animation: none;
}

.orb-1 {
    width: 260px;
    height: 260px;
    background: var(--pastel-purple);
    opacity: 0.25;
    top: -60px;
    left: -60px;
}

.orb-2 {
    width: 180px;
    height: 180px;
    background: var(--pastel-blue);
    opacity: 0.2;
    bottom: -40px;
    right: 40px;
}

.orb-3 {
    width: 120px;
    height: 120px;
    background: var(--pastel-pink);
    opacity: 0.2;
    top: 40%;
    right: -30px;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 400px;
}

.hero-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.75rem;
    background: var(--pastel-purple);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: none;
    box-shadow: none;
}

.hero-icon svg {
    width: 40px;
    height: 40px;
    color: #ffffff;
}

.hero-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    display: block;
}

.hero-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.hero-title span {
    color: #7c6b9e;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    font-weight: 400;
}

/* --- Right Form Panel --- */
.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg);
}

.login-form-panel::before {
    display: none;
}

.login-form-container {
    width: 100%;
    max-width: 420px;
}

/* --- Form Card --- */
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    animation: fadeUp 0.4s ease;
    backdrop-filter: none;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-header .form-logo {
    width: 52px;
    height: 52px;
    margin: 0 auto 1.25rem;
    background: var(--pastel-purple);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.form-header .form-logo svg {
    width: 26px;
    height: 26px;
    color: #ffffff;
}

.form-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    letter-spacing: -0.01em;
}

.form-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

/* --- Progress Bar --- */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--pastel-purple-light);
    border-radius: 3px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--pastel-purple);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* --- Form Steps --- */
.form-step {
    animation: fadeUp 0.3s ease;
}

/* --- Input Fields --- */
.field-group {
    margin-bottom: 1.25rem;
}

.field-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
    z-index: 2;
}

.input-wrapper .input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.6rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.925rem;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    transition: var(--transition);
    outline: none;
    box-shadow: none;
}

.input-wrapper .input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.input-wrapper .input:hover {
    border-color: var(--pastel-purple);
    background: var(--surface-hover);
}

.input-wrapper .input:focus {
    border-color: var(--border-focus);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--pastel-purple-light);
}

.input-wrapper .input:focus~.input-icon,
.input-wrapper .input:not(:placeholder-shown)~.input-icon {
    color: var(--text-link);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 2;
    border-radius: 6px;
}

.password-toggle:hover {
    color: var(--text-secondary);
    background: var(--pastel-purple-light);
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

/* --- Form Options Row --- */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    background: var(--surface);
    flex-shrink: 0;
}

.checkmark svg {
    width: 11px;
    height: 11px;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition);
}

.custom-checkbox input[type="checkbox"]:checked~.checkmark {
    background: var(--pastel-purple);
    border-color: var(--pastel-purple);
}

.custom-checkbox input[type="checkbox"]:checked~.checkmark svg {
    opacity: 1;
    transform: scale(1);
}

.custom-checkbox .checkbox-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.forgot-link {
    font-size: 0.85rem;
    color: var(--text-link);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.forgot-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* --- Submit Button --- */
.login-btn {
    width: 100%;
    padding: 0.72rem 1.2rem;
    background: var(--brand-red);
    color: #ffffff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
    box-shadow: none;
}

.login-btn::before {
    display: none;
}

.login-btn:hover {
    background: var(--brand-red-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.login-btn:active {
    transform: translateY(0);
    background: var(--brand-red-active);
}

.social-btn {
    width: 100%;
    padding: 0.72rem 1.2rem;
    background: var(--brand-red);
    color: #ffffff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.01em;
    box-shadow: none;
}

.social-btn:hover {
    background: var(--brand-red-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.social-btn:active {
    transform: translateY(0);
    background: var(--brand-red-active);
}

.login-btn .btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-btn .btn-spinner {
    display: none;
}

.login-btn.is-loading .btn-content {
    display: none;
}

.login-btn.is-loading .btn-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.quick-nav .back-home-btn {
    width: 100%;
    margin-top: 0;
    padding: 0.8rem 0.95rem;
    min-height: 46px;
    border: none !important;
    border-radius: var(--radius);
    background: var(--brand-red) !important;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.quick-nav .back-home-btn:hover {
    background: var(--brand-red-hover) !important;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.quick-nav .back-home-btn:active {
    transform: translateY(0);
    background: var(--brand-red-active) !important;
}

.quick-nav .back-home-btn:visited {
    color: #ffffff;
}

.quick-nav .back-home-btn:hover:visited {
    color: #ffffff;
}

.quick-nav .back-home-btn:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.back-home-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    flex-shrink: 0;
    transition: var(--transition);
}

.back-home-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    line-height: 1;
}

.back-home-title {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.back-home-arrow {
    margin-left: auto;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.back-home-icon svg,
.back-home-arrow svg {
    display: block;
}

.quick-nav .back-home-btn:hover .back-home-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.quick-nav .back-home-btn:hover .back-home-arrow {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(1px);
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Divider --- */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* --- Quick Navigation --- */
.quick-nav {
    display: block;
}

/* --- Footer --- */
.form-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.form-footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-footer a {
    color: var(--text-link);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.form-footer a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* --- Error State --- */
.field-group.has-error .input {
    border-color: var(--danger);
}

.field-group.has-error .input:focus {
    box-shadow: 0 0 0 3px var(--danger-bg);
}

.field-group.has-error .input-icon {
    color: var(--danger);
}

.error-message {
    display: none;
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 0.35rem;
    padding-left: 0.25rem;
    align-items: center;
    gap: 0.3rem;
}

.error-message svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.field-group.has-error .error-message {
    display: flex;
}

/* --- Toast Notification --- */
.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.9rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.35s ease;
    max-width: 360px;
}

.toast.is-active {
    transform: translateX(0);
}

.toast.toast-success {
    border-left: 3px solid var(--success);
}

.toast.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error .toast-icon {
    color: var(--danger);
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* --- Responsive --- */
@media screen and (max-width: 1024px) {
    .login-hero {
        display: none;
    }

    .login-form-panel {
        flex: 1;
    }
}

@media screen and (max-width: 480px) {
    .login-form-panel {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 2.5rem;
    }

    .login-card {
        padding: 2rem 1.25rem;
        border-radius: 14px;
    }

    .form-header h2 {
        font-size: 1.35rem;
    }

    .social-buttons {
        grid-template-columns: 1fr;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }

    .toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

/* --- Accessibility --- */
:focus-visible {
    outline: 2px solid var(--pastel-purple);
    outline-offset: 2px;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Back Home Button Final Override --- */
.login-card .quick-nav a.button.back-home-btn {
    background: var(--brand-red) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: var(--radius) !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    min-height: 46px;
    padding: 0.65rem 0.85rem;
    gap: 0.6rem;
}

.login-card .quick-nav a.button.back-home-btn .back-home-icon,
.login-card .quick-nav a.button.back-home-btn .back-home-text,
.login-card .quick-nav a.button.back-home-btn .back-home-arrow {
    display: flex;
    align-items: center;
}

.login-card .quick-nav a.button.back-home-btn .back-home-arrow {
    margin-left: auto;
}

.login-card .quick-nav a.button.back-home-btn:hover {
    background: var(--brand-red-hover) !important;
}

.login-card .quick-nav a.button.back-home-btn:active {
    background: var(--brand-red-active) !important;
}