/* Auth popup modal — ecommerce style */

.icg-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.35s, opacity 0.35s ease;
}

.icg-auth-modal.is-open {
    align-items: safe center;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
}

.icg-auth-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.icg-auth-modal.is-open .icg-auth-modal__backdrop {
    opacity: 1;
}

.icg-auth-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 440px;
    max-height: min(90dvh, 720px);
    margin: auto 0;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 20px;
    background: #fff;
    box-shadow:
        0 24px 80px rgba(30, 77, 36, 0.22),
        0 0 0 1px rgba(200, 230, 201, 0.8);
    transform: scale(0.92) translateY(24px);
    opacity: 0;
    transition:
        transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1),
        opacity 0.35s ease;
}

.icg-auth-modal.is-open .icg-auth-modal__dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.icg-auth-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--icg-black, #0a0a0a);
    font-size: 16px;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: background 0.2s, transform 0.2s;
}

.icg-auth-modal__close:hover {
    background: #fff;
    transform: scale(1.06);
}

.icg-auth-modal__visual {
    display: none;
}

.icg-auth-modal__main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 28px 24px 20px;
    overflow: hidden;
}

.icg-auth-modal__tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px;
    margin-bottom: 16px;
    flex-shrink: 0;
    background: var(--icg-green-soft, #eef8ee);
    border-radius: 12px;
}

.icg-auth-modal__tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: none;
    border-radius: 9px;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--icg-muted, #3d3d3d);
    cursor: pointer;
    transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}

.icg-auth-modal__tab.is-active {
    background: #fff;
    color: var(--icg-green-dark, #1e4d24);
    box-shadow: 0 2px 10px rgba(30, 77, 36, 0.12);
}

.icg-auth-modal__alert {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
    flex-shrink: 0;
    animation: authAlertIn 0.35s ease;
}

.icg-auth-modal__alert[hidden] {
    display: none !important;
}

.icg-auth-modal__alert.is-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.icg-auth-modal__alert.is-success {
    background: var(--icg-green-soft, #eef8ee);
    color: var(--icg-green-dark, #1e4d24);
    border: 1px solid var(--icg-border, #c8e6c9);
}

.icg-auth-modal__panels {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 4px;
    padding-bottom: 8px;
}

.icg-auth-modal__panels::-webkit-scrollbar {
    width: 6px;
}

.icg-auth-modal__panels::-webkit-scrollbar-thumb {
    background: var(--icg-border, #c8e6c9);
    border-radius: 999px;
}

.icg-auth-modal__panel {
    display: none;
    animation: authPanelIn 0.4s ease backwards;
}

.icg-auth-modal__panel.is-active {
    display: block;
}

.icg-auth-modal__title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    color: var(--icg-black, #0a0a0a);
}

.icg-auth-modal__sub {
    font-size: 13px;
    color: var(--icg-muted, #3d3d3d);
    margin: 0 0 18px;
    line-height: 1.5;
}

.icg-auth-modal__form label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--icg-black, #0a0a0a);
}

.icg-auth-modal__form {
    padding-bottom: 4px;
}

.icg-auth-modal__form input {
    width: 100%;
    padding: 11px 13px;
    margin-bottom: 10px;
    border: 1.5px solid var(--icg-border, #c8e6c9);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.icg-auth-modal__form input:focus {
    outline: none;
    border-color: var(--icg-green, #2d6a35);
    box-shadow: 0 0 0 3px rgba(45, 106, 53, 0.14);
}

.icg-auth-modal__submit {
    width: 100%;
    margin-top: 6px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--icg-green, #2d6a35), var(--icg-green-dark, #1e4d24));
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.icg-auth-modal__submit--signup {
    background: linear-gradient(135deg, var(--icg-yellow, #f5c518), #e0b010);
    color: var(--icg-black, #0a0a0a);
}

.icg-auth-modal__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(30, 77, 36, 0.25);
}

.icg-auth-modal__submit:disabled {
    opacity: 0.75;
    cursor: wait;
}

.icg-auth-modal__submit.is-loading .icg-auth-modal__submit-text {
    opacity: 0;
}

.icg-auth-modal__spinner {
    display: none;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

.icg-auth-modal__submit--signup .icg-auth-modal__spinner {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: var(--icg-black, #0a0a0a);
}

.icg-auth-modal__submit.is-loading .icg-auth-modal__spinner {
    display: block;
}

.icg-auth-modal__switch {
    margin-top: 14px;
    margin-bottom: 4px;
    text-align: center;
    font-size: 13px;
    color: var(--icg-muted, #3d3d3d);
}

.icg-auth-modal__switch button {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--icg-green, #2d6a35);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.icg-auth-modal__google-wrap {
    margin-bottom: 4px;
}

.icg-auth-modal__google-btn {
    display: flex;
    justify-content: center;
    min-height: 44px;
    width: 100%;
}

.icg-auth-modal__google-btn > div {
    width: 100% !important;
}

.icg-auth-modal__google-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--icg-border, #c8e6c9);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: var(--icg-black, #0a0a0a);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.icg-auth-modal__google-fallback:hover:not(:disabled) {
    background: #f8faf8;
    box-shadow: 0 2px 10px rgba(30, 77, 36, 0.1);
}

.icg-auth-modal__google-fallback:disabled {
    opacity: 0.7;
    cursor: wait;
}

.icg-auth-modal__google-fallback img {
    width: 20px;
    height: 20px;
}

.icg-auth-modal__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 14px;
    color: var(--icg-muted, #3d3d3d);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.icg-auth-modal__divider::before,
.icg-auth-modal__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--icg-border, #c8e6c9);
}

/* Header auth buttons */
.icg-header-auth {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.icg-header-auth--ghost {
    background: var(--icg-green-soft, #eef8ee);
    color: var(--icg-green-dark, #1e4d24);
}

.icg-header-auth--primary {
    background: var(--icg-yellow, #f5c518);
    color: var(--icg-black, #0a0a0a);
}

.icg-header-auth--signout {
    background: transparent;
    color: var(--icg-green-dark, #1e4d24);
    border: 1.5px solid var(--icg-border, #c8e6c9);
    text-decoration: none;
    gap: 5px;
}

.icg-header-auth--signout:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
    box-shadow: 0 4px 12px rgba(153, 27, 27, 0.1);
}

.icg-header-auth:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 77, 36, 0.15);
}

.icg-header-user {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    background: var(--icg-green-soft, #eef8ee);
    text-decoration: none;
    color: var(--icg-green-dark, #1e4d24);
    font-size: 12px;
    font-weight: 700;
    max-width: 140px;
}

.icg-header-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icg-header-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--icg-green, #2d6a35);
    color: var(--icg-yellow, #f5c518);
    font-size: 11px;
    font-weight: 800;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

@media (min-width: 480px) {
    .icg-header-auth,
    .icg-header-user {
        display: inline-flex;
    }
}

/* Homepage auth promo */
.icg-auth-promo {
    margin: 0 16px 28px;
    padding: 20px 22px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1e4d24 0%, #2d6a35 60%, #3d8a47 100%);
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 12px 40px rgba(30, 77, 36, 0.2);
    animation: icgFadeUp 0.6s ease 0.2s backwards;
}

.icg-auth-promo-text h3 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
}

.icg-auth-promo-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.icg-auth-promo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.icg-btn--signup-glow {
    background: var(--icg-yellow, #f5c518);
    color: var(--icg-black, #0a0a0a);
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(245, 197, 24, 0.45);
    animation: authGlowPulse 2.5s ease-in-out infinite;
}

.icg-btn--signup-glow:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 28px rgba(245, 197, 24, 0.55);
}

.icg-hero-auth-note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
}

.icg-hero-auth-note button {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--icg-yellow, #f5c518);
    cursor: pointer;
    text-decoration: underline;
}

@media (min-width: 768px) {
    .icg-auth-modal__dialog {
        display: grid;
        grid-template-columns: minmax(240px, 260px) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
        max-width: 720px;
        max-height: min(88dvh, 680px);
    }

    .icg-auth-modal__visual {
        display: block;
        position: relative;
        padding: 24px 18px;
        min-height: 0;
        background: linear-gradient(165deg, #1e4d24, #2d6a35);
        color: #fff;
        overflow: hidden;
    }

    .icg-auth-modal__main {
        max-height: min(88dvh, 680px);
    }

    .icg-auth-modal__orb {
        position: absolute;
        border-radius: 50%;
        filter: blur(40px);
        opacity: 0.4;
    }

    .icg-auth-modal__orb--1 {
        width: 120px;
        height: 120px;
        background: #f5c518;
        top: -20px;
        right: -20px;
    }

    .icg-auth-modal__orb--2 {
        width: 80px;
        height: 80px;
        background: #fff;
        bottom: 20%;
        left: -20px;
    }

    .icg-auth-modal__visual-content {
        position: relative;
        z-index: 1;
        width: 100%;
        min-width: 0;
    }

    .icg-auth-modal__logo-wrap {
        width: 100%;
        margin: 0 0 14px;
        line-height: 0;
    }

    .icg-auth-modal__logo-img {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 52px;
        margin: 0;
        padding: 0;
        object-fit: contain;
        object-position: left center;
    }

    .icg-auth-modal__visual h3 {
        font-size: 17px;
        margin: 0 0 8px;
    }

    .icg-auth-modal__visual p {
        font-size: 12px;
        opacity: 0.88;
        line-height: 1.5;
        margin: 0 0 16px;
    }

    .icg-auth-modal__visual ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .icg-auth-modal__visual li {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        margin-bottom: 8px;
    }

    .icg-auth-modal__visual li i {
        color: var(--icg-yellow, #f5c518);
    }

    .icg-auth-modal__close {
        background: rgba(0, 0, 0, 0.06);
    }

    .icg-auth-promo {
        margin-left: auto;
        margin-right: auto;
        max-width: 1168px;
    }
}

@keyframes authPanelIn {
    from {
        opacity: 0;
        transform: translateX(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes authAlertIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes authSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes authGlowPulse {
    0%,
    100% {
        box-shadow: 0 4px 20px rgba(245, 197, 24, 0.4);
    }
    50% {
        box-shadow: 0 6px 32px rgba(245, 197, 24, 0.65);
    }
}

@media (prefers-reduced-motion: reduce) {
    .icg-auth-modal,
    .icg-auth-modal__dialog,
    .icg-auth-modal__backdrop,
    .icg-auth-modal__panel,
    .icg-btn--signup-glow {
        animation: none;
        transition: none;
    }
}
