/* =============================================================================
 *  auth-modal.css
 *  Clean, minimalistic modal + auth-button styles for the DreamTeam
 *  Lazy-Registration flow.
 *
 *  Theme: deep-green/dark, matches the existing dark builder UI.
 *  Designed to be a self-contained drop-in: every selector is namespaced
 *  with `.dt-auth-*` to avoid clashes.
 * ============================================================================= */

:root {
    --dt-auth-primary:        #28a745;
    --dt-auth-primary-hover:  #2fbd54;
    --dt-auth-bg:             #161b22;
    --dt-auth-surface:        #1f2630;
    --dt-auth-surface-2:      #262d39;
    --dt-auth-border:         rgba(255, 255, 255, 0.10);
    --dt-auth-border-strong:  rgba(255, 255, 255, 0.18);
    --dt-auth-text:           #e6edf3;
    --dt-auth-muted:          #9ba9b7;
    --dt-auth-danger:         #ff6b6b;
    --dt-auth-warning:        #ffc857;
    --dt-auth-radius:         14px;
    --dt-auth-radius-sm:      10px;
    --dt-auth-shadow:         0 24px 60px rgba(0, 0, 0, 0.55), 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* -----------------------------------------------------------------------------
 *  Navbar auth icon + dropdown
 *
 *  The icon is intentionally tiny and unobtrusive: a single person silhouette
 *  embedded into the navbar by nav.js. The colour communicates auth state
 *  (grey = signed out, green = signed in & verified, amber = unverified).
 * --------------------------------------------------------------------------- */
.dt-auth-nav-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.dt-auth-nav-icon {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.dt-auth-nav-icon:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
    transform: translateY(-1px);
}

.dt-auth-nav-icon:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.45);
}

.dt-auth-nav-icon-glyph {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dt-auth-nav-icon-glyph svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Tiny status pip in the corner so the auth state is recognisable even
   when the icon itself is very small (e.g. on mobile).                       */
.dt-auth-nav-icon-status {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #8a96a3;
    border: 2px solid #1b3a27;
    transition: background 0.15s ease, border-color 0.15s ease;
}

/* Signed-out: grey icon, grey pip. */
.dt-auth-nav-icon[data-state="signed-out"] {
    color: rgba(255, 255, 255, 0.55);
}
.dt-auth-nav-icon[data-state="signed-out"] .dt-auth-nav-icon-status {
    background: #8a96a3;
}

/* Signed-in & verified: green accent + green pip. */
.dt-auth-nav-icon[data-state="verified"] {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.55);
    background: rgba(74, 222, 128, 0.12);
}
.dt-auth-nav-icon[data-state="verified"]:hover {
    background: rgba(74, 222, 128, 0.22);
    border-color: rgba(74, 222, 128, 0.75);
    color: #6ee7a0;
}
.dt-auth-nav-icon[data-state="verified"] .dt-auth-nav-icon-status {
    background: #28a745;
}

/* Signed-in but not verified yet: amber accent. */
.dt-auth-nav-icon[data-state="unverified"] {
    color: #ffc857;
    border-color: rgba(255, 200, 87, 0.55);
    background: rgba(255, 200, 87, 0.12);
}
.dt-auth-nav-icon[data-state="unverified"] .dt-auth-nav-icon-status {
    background: #ffc857;
}

/* Dropdown menu shown when a verified user clicks the icon. */
.dt-auth-nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    padding: 6px;
    background: var(--dt-auth-bg, #161b22);
    color: var(--dt-auth-text, #e6edf3);
    border: 1px solid var(--dt-auth-border-strong, rgba(255,255,255,0.18));
    border-radius: var(--dt-auth-radius-sm, 10px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55), 0 4px 10px rgba(0, 0, 0, 0.35);
    z-index: 1200;
    animation: dt-auth-view-in 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}
.dt-auth-nav-dropdown[hidden] { display: none; }

.dt-auth-nav-dropdown-header {
    padding: 10px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dt-auth-nav-dropdown-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--dt-auth-muted, #9ba9b7);
    font-weight: 600;
}

.dt-auth-nav-dropdown-email {
    font-size: 13px;
    font-weight: 600;
    color: var(--dt-auth-text, #e6edf3);
    word-break: break-all;
}

.dt-auth-nav-dropdown-divider {
    height: 1px;
    margin: 4px 6px;
    background: var(--dt-auth-border, rgba(255,255,255,0.10));
}

.dt-auth-nav-dropdown-item {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    color: var(--dt-auth-text, #e6edf3);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, color 0.12s ease;
}

.dt-auth-nav-dropdown-item:hover {
    background: rgba(74, 222, 128, 0.14);
    color: #ffffff;
}

.dt-auth-nav-dropdown-item-danger:hover {
    background: rgba(255, 107, 107, 0.16);
    color: #ffd3d3;
}

.dt-auth-nav-dropdown-icon {
    font-size: 16px;
    line-height: 1;
    width: 18px;
    text-align: center;
}

@media (max-width: 600px) {
    .dt-auth-nav-icon {
        width: 32px;
        height: 32px;
    }
    .dt-auth-nav-icon-glyph {
        width: 16px;
        height: 16px;
    }
    .dt-auth-nav-dropdown {
        right: 0;
        min-width: 200px;
    }
}

/* -----------------------------------------------------------------------------
 *  Modal shell
 * --------------------------------------------------------------------------- */
.dt-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(8, 10, 14, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: dt-auth-fade-in 0.2s ease;
}

.dt-auth-modal.is-open {
    display: flex;
}

.dt-auth-modal[aria-hidden="true"] { display: none; }

.dt-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--dt-auth-bg);
    color: var(--dt-auth-text);
    border: 1px solid var(--dt-auth-border-strong);
    border-radius: var(--dt-auth-radius);
    box-shadow: var(--dt-auth-shadow);
    overflow: hidden;
    animation: dt-auth-pop-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.dt-auth-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 12px;
    border-bottom: 1px solid var(--dt-auth-border);
}

.dt-auth-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.dt-auth-card-subtitle {
    margin: 4px 22px 0;
    color: var(--dt-auth-muted);
    font-size: 13px;
    line-height: 1.4;
}

.dt-auth-close {
    appearance: none;
    background: transparent;
    color: var(--dt-auth-muted);
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}
.dt-auth-close:hover { background: var(--dt-auth-surface-2); color: var(--dt-auth-text); }

.dt-auth-card-body {
    padding: 18px 22px 22px;
}

.dt-auth-card-footer {
    padding: 0 22px 18px;
    color: var(--dt-auth-muted);
    font-size: 12.5px;
    text-align: center;
}

.dt-auth-card-footer a,
.dt-auth-card-footer button.dt-auth-link {
    color: var(--dt-auth-primary);
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

/* -----------------------------------------------------------------------------
 *  Form fields
 * --------------------------------------------------------------------------- */
.dt-auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.dt-auth-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--dt-auth-muted);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.dt-auth-input {
    appearance: none;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    background: var(--dt-auth-surface);
    color: var(--dt-auth-text);
    border: 1px solid var(--dt-auth-border-strong);
    border-radius: var(--dt-auth-radius-sm);
    font-size: 15px;
    line-height: 1.2;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.dt-auth-input:focus {
    outline: none;
    border-color: var(--dt-auth-primary);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.22);
    background: var(--dt-auth-surface-2);
}
.dt-auth-input::placeholder { color: #6b7785; }

.dt-auth-helper {
    margin: -6px 0 12px;
    font-size: 12px;
    color: var(--dt-auth-muted);
}

.dt-auth-error {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: var(--dt-auth-radius-sm);
    background: rgba(255, 107, 107, 0.10);
    color: var(--dt-auth-danger);
    border: 1px solid rgba(255, 107, 107, 0.35);
    font-size: 13px;
    line-height: 1.4;
}
.dt-auth-error[hidden] { display: none; }

/* Cross-provider conflict hint inside .dt-auth-error.
   E.g. "you originally signed in with Google" with a one-click CTA back to
   the right sign-in flow. */
.dt-auth-provider-conflict {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dt-auth-provider-conflict-text {
    margin: 0;
    line-height: 1.45;
}
.dt-auth-provider-conflict-cta {
    align-self: flex-start;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    padding: 0;
    color: var(--dt-auth-primary);
    text-decoration: underline;
}
.dt-auth-provider-conflict-cta:hover {
    text-decoration: none;
}

.dt-auth-info {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: var(--dt-auth-radius-sm);
    background: rgba(40, 167, 69, 0.10);
    border: 1px solid rgba(40, 167, 69, 0.35);
    color: #c9f0d4;
    font-size: 13px;
    line-height: 1.45;
}

/* -----------------------------------------------------------------------------
 *  Buttons / tabs
 * --------------------------------------------------------------------------- */
.dt-auth-tabs {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--dt-auth-surface);
    border: 1px solid var(--dt-auth-border);
    border-radius: 999px;
    margin: 0 22px 18px;
}

.dt-auth-tab {
    flex: 1;
    appearance: none;
    background: transparent;
    color: var(--dt-auth-muted);
    border: none;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.dt-auth-tab:hover { color: var(--dt-auth-text); }

.dt-auth-tab.is-active {
    background: var(--dt-auth-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.35);
}

.dt-auth-submit {
    appearance: none;
    width: 100%;
    padding: 12px 14px;
    background: linear-gradient(135deg, var(--dt-auth-primary), var(--dt-auth-primary-hover));
    color: #ffffff;
    border: none;
    border-radius: var(--dt-auth-radius-sm);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.2s ease;
    box-shadow: 0 6px 18px rgba(40, 167, 69, 0.35);
}
.dt-auth-submit:hover:not(:disabled) { transform: translateY(-1px); }
.dt-auth-submit:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

.dt-auth-secondary {
    appearance: none;
    width: 100%;
    margin-top: 10px;
    padding: 11px 14px;
    background: transparent;
    color: var(--dt-auth-text);
    border: 1px solid var(--dt-auth-border-strong);
    border-radius: var(--dt-auth-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.dt-auth-secondary:hover { background: var(--dt-auth-surface-2); border-color: var(--dt-auth-primary); }

/* -----------------------------------------------------------------------------
 *  View transitions
 *
 *  Views are stacked inside `.dt-auth-card-body`. Only the active one is
 *  visible (`is-visible`), the others are `hidden`. We add a subtle fade /
 *  slide-in for a smooth feel between modes.
 * --------------------------------------------------------------------------- */
.dt-auth-view {
    opacity: 1;
}
.dt-auth-view[hidden] { display: none; }

.dt-auth-view.is-visible {
    animation: dt-auth-view-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes dt-auth-view-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* -----------------------------------------------------------------------------
 *  Chooser view — Google / Email-Link / Email & Password
 * --------------------------------------------------------------------------- */
.dt-auth-chooser {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dt-auth-chooser-helper {
    margin: 6px 0 0;
    text-align: center;
}

.dt-auth-provider {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: var(--dt-auth-surface);
    color: var(--dt-auth-text);
    border: 1px solid var(--dt-auth-border-strong);
    border-radius: var(--dt-auth-radius-sm);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.dt-auth-provider:hover:not(:disabled) {
    background: var(--dt-auth-surface-2);
    border-color: var(--dt-auth-primary);
    transform: translateY(-1px);
}

.dt-auth-provider:disabled {
    opacity: 0.65;
    cursor: progress;
    transform: none;
}

.dt-auth-provider-icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.dt-auth-provider-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    flex: 1 1 auto;
}

.dt-auth-provider-sub {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--dt-auth-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Google button — prominent, light surface so the multicolour G logo pops.   */
.dt-auth-provider-google {
    background: #ffffff;
    color: #1f1f1f;
    border-color: #ffffff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.30);
}

.dt-auth-provider-google:hover:not(:disabled) {
    background: #f5f7fb;
    border-color: #f5f7fb;
    transform: translateY(-1px);
}

.dt-auth-provider-google .dt-auth-provider-sub {
    color: #5f6368;
}

.dt-auth-google-logo {
    width: 20px;
    height: 20px;
    display: block;
}

/* Divider with centred "oder" label between the Google CTA and the rest.     */
.dt-auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 2px;
    color: var(--dt-auth-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.dt-auth-divider::before,
.dt-auth-divider::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: var(--dt-auth-border);
}

.dt-auth-divider-text {
    flex: 0 0 auto;
    padding: 0 4px;
}

/* -----------------------------------------------------------------------------
 *  Email-link form view
 * --------------------------------------------------------------------------- */
.dt-auth-emaillink {
    display: flex;
    flex-direction: column;
}

/* -----------------------------------------------------------------------------
 *  Verify-pending view
 * --------------------------------------------------------------------------- */
.dt-auth-verify {
    text-align: center;
    padding: 6px 6px 4px;
}
.dt-auth-verify-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 8px;
}
.dt-auth-verify-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 6px;
}
.dt-auth-verify-text {
    font-size: 14px;
    color: var(--dt-auth-muted);
    line-height: 1.5;
    margin: 0 0 18px;
}
.dt-auth-verify-email {
    color: var(--dt-auth-text);
    font-weight: 700;
}

/* -----------------------------------------------------------------------------
 *  Spinner (inline on submit button)
 * --------------------------------------------------------------------------- */
.dt-auth-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: -2px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    animation: dt-auth-spin 0.7s linear infinite;
}

/* Dark variant for use on light backgrounds (e.g. the white Google button). */
.dt-auth-spinner-dark {
    border-color: rgba(31, 31, 31, 0.25);
    border-top-color: #1f1f1f;
}

/* -----------------------------------------------------------------------------
 *  Animations
 * --------------------------------------------------------------------------- */
@keyframes dt-auth-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes dt-auth-pop-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

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

/* -----------------------------------------------------------------------------
 *  Reduced motion
 * --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .dt-auth-modal,
    .dt-auth-card { animation: none; }
    .dt-auth-spinner { animation-duration: 1.6s; }
}
