﻿/* =========================================================
   Sign-in Dialog
   ========================================================= */

/* .p-dialog prefix wins specificity ties with PrimeVue's runtime theme styles */
.p-dialog.sign-in-dialog {
    width: min(720px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    overflow: hidden;
}

.sign-in-dialog .p-dialog-header {
    padding: 12px 12px 0;
    background: transparent;
    border: 0;
}

.sign-in-dialog .p-dialog-header-actions {
    margin-left: auto;
}

.sign-in-dialog .p-dialog-header-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

    .sign-in-dialog .p-dialog-header-close:hover {
        background: var(--p-surface-100);
    }

    .sign-in-dialog .p-dialog-header-close:focus-visible {
        outline: none;
        box-shadow: 0 0 0 2px var(--p-surface-0), 0 0 0 4px #14b8a6;
    }

.sign-in-dialog .p-dialog-content {
    padding: 0;
    border-radius: 12px;
    overflow: visible;
}

/* =========================================================
   Sign-in Container
   ========================================================= */

.sign-in-container {
    padding: 18px 44px 28px;
    /*
     * The dialog normally sizes naturally.
     * Scrolling is only used when the viewport is too short.
     */
    max-height: calc(100vh - 76px);
    overflow-y: auto;
    scrollbar-width: thin;
}

/* =========================================================
   Brand
   ========================================================= */

.sign-in-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.axiom-logo {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

    .axiom-logo svg {
        width: 31px;
        height: 31px;
    }

.axiom-wordmark {
    margin: 0;
    color: var(--p-text-color);
    font-size: 1.2rem;
    font-weight: 650;
    letter-spacing: -0.025em;
}

.axiom-wordmark-accent {
    color: #14b8a6;
}

/* =========================================================
   Heading
   ========================================================= */

.sign-in-heading {
    text-align: center;
    margin-bottom: 20px;
}

.sign-in-title {
    margin: 0;
    color: var(--p-text-color);
    font-size: 1.4rem;
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

.sign-in-subtitle {
    margin: 6px 0 0;
    color: var(--p-text-muted-color);
    font-size: 0.88rem;
    line-height: 1.4;
}

/* =========================================================
   Provider Section
   ========================================================= */

.provider-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

/* =========================================================
   Provider Buttons
   ========================================================= */

.provider-button {
    position: relative;
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px 0 48px; /* 48px left = logo (14px + 24px) + breathing room */
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}

    .provider-button:not(:disabled):hover {
        background: var(--p-surface-100);
        border-color: var(--p-surface-400);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    }

    .provider-button:not(:disabled):active {
        transform: translateY(1px);
    }

    /* Keyboard focus */
    .provider-button:focus {
        outline: none;
    }

    .provider-button:focus-visible {
        outline: none;
        border-color: #14b8a6;
        box-shadow: 0 0 0 2px var(--p-surface-0), 0 0 0 4px rgba(20, 184, 166, 0.85);
    }

/* =========================================================
   Provider Loading State
   ========================================================= */

/* Lock the whole group while redirecting (mouse/touch; keyboard is guarded in JS) */
.provider-section.is-redirecting .provider-button {
    pointer-events: none;
}

    /* Fade the buttons that weren't clicked */
    .provider-section.is-redirecting .provider-button:not(.is-loading) {
        opacity: 0.45;
    }

    /* Highlight the one that was clicked */
    .provider-section.is-redirecting .provider-button.is-loading,
    .provider-button.is-loading {
        border-color: #14b8a6;
        background: var(--p-surface-100);
        cursor: progress;
    }

/* Spinner takes the place of the provider logo */
.provider-logo .pi-spinner {
    font-size: 1.1rem;
    color: #14b8a6;
}

.provider-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   Provider Logos
   ========================================================= */

.provider-logo {
    position: absolute;
    left: 14px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .provider-logo svg {
        display: block;
        width: 20px;
        height: 20px;
    }

.provider-logo-google svg {
    width: 20px;
    height: 20px;
}

.provider-logo-microsoft svg {
    width: 20px;
    height: 20px;
}

.provider-logo-apple svg {
    width: 25px;
    height: 25px;
}

.provider-logo-facebook svg {
    width: 20px;
    height: 20px;
}

.provider-label {
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

/* =========================================================
   Divider
   ========================================================= */

.sign-in-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--p-text-muted-color);
    font-size: 0.72rem;
}

    .sign-in-divider::before,
    .sign-in-divider::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--p-surface-300);
    }

/* =========================================================
   Email Button
   ========================================================= */

.email-button {
    width: 100%;
    height: 46px;
    border-radius: 8px;
}

    .email-button:focus {
        outline: none;
    }

    .email-button:focus-visible {
        outline: none;
        border-color: #14b8a6;
        box-shadow: 0 0 0 2px var(--p-surface-0), 0 0 0 4px rgba(20, 184, 166, 0.85);
    }

/* =========================================================
   Terms
   ========================================================= */

.sign-in-terms {
    margin: 16px 8px 0;
    text-align: center;
    color: var(--p-text-muted-color);
    font-size: 0.68rem;
    line-height: 1.5;
}

    .sign-in-terms a {
        color: var(--p-primary-color);
        text-decoration: none;
    }

        .sign-in-terms a:hover {
            text-decoration: underline;
        }

        .sign-in-terms a:focus-visible {
            outline: none;
            border-radius: 3px;
            box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.35);
        }

/* =========================================================
   Narrow Screens
   ========================================================= */

@media (max-width: 560px) {
    .p-dialog.sign-in-dialog {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
    }

    .sign-in-container {
        padding: 16px 24px 24px;
        max-height: calc(100vh - 68px);
    }

    /* Collapse providers to a single column when horizontal space is limited */
    .provider-section {
        grid-template-columns: 1fr;
    }

    .sign-in-brand {
        margin-bottom: 20px;
    }

    .axiom-logo {
        width: 46px;
        height: 46px;
        margin-bottom: 10px;
    }

        .axiom-logo svg {
            width: 29px;
            height: 29px;
        }

    .axiom-wordmark {
        font-size: 1.12rem;
    }

    .sign-in-title {
        font-size: 1.3rem;
    }

    .sign-in-heading {
        margin-bottom: 18px;
    }

    .provider-button {
        height: 44px;
    }

    .sign-in-divider {
        margin: 16px 0;
    }

    .sign-in-terms {
        margin-top: 14px;
    }
}
