/* === USER AUTH / MY ACCOUNT PAGE STYLES === */

/* ========== PROFILE PAGE ========== */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-4xl);
}

.stats-box {
    background-color: var(--color-bg-lighter);
    border-radius: var(--radius-xl);
    padding: 20px 30px;
    margin-bottom: var(--spacing-xl);
}

.stats-box h3 {
    margin-top: 0;
    padding-bottom: 10px;
}

#profileDisplayCredits {
    font-size: 1.2em;
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
}

.usage-stats-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.usage-stats-list li {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    font-size: var(--font-size-sm);
}

.usage-stats-list li:last-child {
    border-bottom: none;
}

.usage-stats-list .model-name {
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.usage-stats-list .model-usage {
    color: var(--color-text-secondary);
}

.profile-field-label {
    font-weight: var(--font-weight-bold);
}

/* ========== AUTH FORMS ========== */
#authFormsContainer {
    display: none;
    flex-direction: column;
    gap: var(--spacing-xl);
    padding: var(--spacing-xl);
    background-color: var(--color-bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: opacity var(--transition-base);
}

#authFormsContainer.show {
    display: flex;
    opacity: 1;
}

.no-operations,
.no-transactions {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--spacing-2xl) 0;
    font-size: var(--font-size-sm);
}

.transaction-history-box {
    margin-top: var(--spacing-2xl);
}

.transaction-history-table td:nth-child(2),
.transaction-history-table td:nth-child(3) {
    text-align: right;
}

.transaction-history-table th:nth-child(2),
.transaction-history-table th:nth-child(3) {
    text-align: right;
}

/* === USER AUTH / MY ACCOUNT PAGE STYLES === */

.page-content.h1-background {
    display: grid;
    gap: 1rem;
    margin: 0 auto;
    padding: clamp(3.6rem, 8vw, 6.8rem) 0 clamp(2rem, 5vw, 3.6rem);
    border: 0;
    color: var(--landing-text);
}

.page-content.h1-background h1 {
    max-width: 10ch;
    margin: 0;
    line-height: 0.98;
    letter-spacing: -0.065em;
}

.page-content.h1-background p {
    max-width: 700px;
    margin: 0;
    color: var(--landing-text-soft);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.55;
}

#authFormsContainer,
#userProfileSection,
#profileEditMode {
    color: var(--landing-text);
}

#authFormsContainer {
    max-width: 500px;
    margin: clamp(2.5rem, 6vw, 4.5rem) auto clamp(4rem, 7vw, 6rem);
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid var(--landing-border);
    border-radius: var(--landing-radius-xl);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.76)),
        var(--landing-surface-solid);
    box-shadow: var(--landing-shadow-lg);
}

#authFormsContainer.show {
    display: grid;
    gap: 1rem;
    opacity: 1;
}

#loginSection,
#signupSection,
#authActionSection,
#profileEditMode {
    min-width: 0;
}

#loginSection h2,
#signupSection h2,
#authActionSection h2,
#userProfileSection h3,
#profileEditMode h3 {
    margin: 0 0 1rem;
    color: var(--landing-text);
    line-height: 1.12;
    letter-spacing: -0.035em;
}

#loginSection h2,
#signupSection h2,
#authActionSection h2 {
    font-size: clamp(1.65rem, 4vw, 2.55rem);
}

#userProfileSection h3,
#profileEditMode h3 {
    font-size: 1.05rem;
}

#userProfileSection {
    margin: 0 auto clamp(4rem, 7vw, 6rem);
}

#profileEditMode {
    margin-top: clamp(1.25rem, 3vw, 2rem);
    scroll-margin-top: 6.5rem;
}

#profileTitle {
    position: relative;
    overflow: hidden;
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid var(--landing-border);
    border-radius: var(--landing-radius-xl);
    background:
        radial-gradient(circle at 92% 22%, rgba(255, 140, 0, 0.18), transparent 13rem),
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.82));
    box-shadow: var(--landing-shadow-md);
    font-size: clamp(1.7rem, 4vw, 3rem);
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 2.4vw, 1.5rem);
}

.profile-left,
.profile-right {
    min-width: 0;
}

.stats-box,
.block,
.block-lg {
    border: 1px solid var(--landing-border);
    border-radius: var(--landing-radius-lg);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.74)),
        var(--landing-surface-solid);
    box-shadow: var(--landing-shadow-sm);
}

.stats-box {
    overflow: hidden;
    padding: clamp(1.1rem, 3vw, 1.5rem);
    margin-bottom: clamp(1rem, 2.4vw, 1.5rem);
}

.stats-box h3,
.block-lg h3,
#profileEditMode h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1rem;
    padding: 0;
    color: var(--landing-text);
    font-size: 1.05rem;
    letter-spacing: -0.035em;
}

.stats-box h3 i,
.block-lg h3 i,
#profileEditMode h3 i,
.section-row h3 i {
    color: var(--landing-primary);
}

.profile-value {
    color: var(--landing-text);
    font-weight: var(--font-weight-bold);
}

#profileDisplayCredits {
    display: block;
    margin: 0.15rem 0 1rem;
    color: var(--landing-text);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: var(--font-weight-xbold);
    line-height: 1;
    letter-spacing: -0.055em;
}

.usage-stats-list {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.usage-stats-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(16, 24, 40, 0.08);
    color: var(--landing-text-soft);
    font-size: 0.95rem;
}

.usage-stats-list li:last-child {
    border-bottom: 0;
}

.usage-stats-list .model-name {
    color: var(--landing-text);
    font-weight: var(--font-weight-bold);
}

.usage-stats-list .model-usage {
    color: var(--landing-text-muted);
    font-weight: var(--font-weight-bold);
}

#profileFreeCreditsIneligible {
    justify-content: flex-start;
}

#profileFreeCreditsIneligible span {
    color: var(--landing-text);
    font-weight: var(--font-weight-bold);
    line-height: 1.45;
}

.notice {
    margin: 1rem 0 0;
    color: var(--landing-text-soft);
}

.alert.notice,
.verification-warning {
    padding: 1rem;
    border: 1px solid rgba(255, 140, 0, 0.24);
    border-left: 4px solid var(--landing-accent);
    border-radius: var(--landing-radius-md);
    background: rgba(255, 244, 228, 0.86);
    color: #7a4a00;
    box-shadow: none;
}

.verification-warning p {
    margin: 0;
    color: inherit;
}

.verification-warning .spacer-top {
    margin-top: 1rem;
}

.verification-warning .message {
    margin-top: 0.75rem;
}

.input-icon {
    position: relative;
}

.input-icon__icon {
    position: absolute;
    left: 1rem;
    top: calc(50% - 5px);
    transform: translateY(-50%);
    color: var(--landing-text-muted);
    pointer-events: none;
}

.input-icon input.input-icon__input,
#editName {
    min-height: 48px;
    margin-bottom: 0.85rem;
    border: 1px solid var(--landing-border);
    border-radius: var(--landing-radius-md);
    background: rgba(255, 255, 255, 0.86);
    color: var(--landing-text);
    box-shadow: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.input-icon input.input-icon__input {
    padding: 0.85rem 1rem 0.85rem 2.85rem;
}

#editName {
    padding: 0.85rem 1rem;
}

.input-icon input.input-icon__input:focus,
#editName:focus {
    outline: 0;
    border-color: var(--landing-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 98, 255, 0.13);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.85rem 0 0.35rem;
    color: var(--landing-text-soft);
    font-size: 0.85rem;
    font-weight: var(--font-weight-bold);
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--landing-border);
}

.auth-stack-button {
    width: 100%;
    margin-right: 0;
}

#forgotPasswordLinkContainer {
    margin-top: 2.5rem;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin: 0 0 1rem;
    padding: 0.3rem;
    border: 1px solid var(--landing-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
}

.auth-tab {
    min-height: 42px;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--landing-text-soft);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    cursor: pointer;
}

.auth-tab.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--landing-primary), var(--landing-brand));
    box-shadow: 0 8px 18px rgba(0, 98, 255, 0.18);
}

.auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 1rem 0 1.2rem;
}

.auth-actions .button {
    margin: 0;
}

.page-content .button,
.page-content .button-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-family: var(--landing-font, var(--font-family-base));
    font-weight: var(--font-weight-bold);
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.page-content .button {
    min-height: 46px;
    margin: 0.25rem 0.5rem 0.25rem 0;
    padding: 0.78rem 1.1rem;
    color: #fff;
    background: linear-gradient(135deg, var(--landing-primary), var(--landing-brand));
    box-shadow: 0 12px 26px rgba(0, 98, 255, 0.2);
}

.page-content .button.auth-stack-button {
    width: 100%;
    margin-right: 0;
}

.page-content .button:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--landing-primary-hover), var(--landing-brand-dark));
    box-shadow: 0 16px 34px rgba(0, 98, 255, 0.28);
    text-decoration: none;
    transform: translateY(-1px);
}

.page-content .button.orange {
    background: linear-gradient(135deg, var(--landing-accent), #e07b00);
    box-shadow: 0 12px 26px rgba(255, 140, 0, 0.22);
}

.page-content .button.orange:hover {
    background: linear-gradient(135deg, #e07b00, #b96200);
    box-shadow: 0 16px 34px rgba(255, 140, 0, 0.28);
}

.page-content .button.google {
    background: linear-gradient(135deg, #ea4335, #c0392b);
    box-shadow: 0 12px 26px rgba(234, 67, 53, 0.18);
}

.page-content .button.google:hover {
    background: linear-gradient(135deg, #d93025, #a93226);
    box-shadow: 0 16px 34px rgba(234, 67, 53, 0.24);
}

.page-content .button.red {
    background: linear-gradient(135deg, #dc3545, #b4232f);
    box-shadow: 0 12px 26px rgba(220, 53, 69, 0.18);
}

.page-content .button.red:hover {
    background: linear-gradient(135deg, #c82333, #9f1d29);
    box-shadow: 0 16px 34px rgba(220, 53, 69, 0.24);
}

.page-content .button:disabled,
.page-content .button[disabled],
.page-content .button.disabled,
.page-content .button-small:disabled,
.page-content .button-small[disabled] {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
}

.page-content .button-small {
    min-height: 36px;
    padding: 0.58rem 0.8rem;
    color: var(--landing-text);
    background: #fff;
    border-color: var(--landing-border);
    box-shadow: var(--landing-shadow-sm);
    font-size: 0.82rem;
}

.page-content .button-small:hover {
    border-color: var(--landing-border-strong);
    background: var(--app-surface-soft);
    text-decoration: none;
    transform: translateY(-1px);
}

.terms-consent {
    margin: 0.95rem 0;
    padding: 0.9rem;
    border: 1px solid rgba(26, 86, 116, 0.12);
    border-radius: var(--landing-radius-md);
    background: rgba(255, 255, 255, 0.72);
}

.terms-consent__label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    color: var(--landing-text-soft);
    font-size: 0.92rem;
    line-height: 1.45;
    cursor: pointer;
    user-select: none;
}

.terms-consent__label input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 0.15rem;
    accent-color: var(--landing-primary);
    cursor: pointer;
}

.page-content a,
.terms-consent__label a,
.usage-stats-list a {
    color: var(--landing-primary);
    font-weight: var(--font-weight-bold);
    text-decoration: none;
    text-underline-offset: 4px;
}

.page-content a:hover,
.terms-consent__label a:hover,
.usage-stats-list a:hover {
    color: var(--landing-brand-dark);
    text-decoration: underline;
}

#loginMessage,
#signupMessage,
#changePasswordMessage,
#profileEditMessage {
    color: var(--landing-text-muted);
    font-size: 0.92rem;
}

.section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-row h3 {
    margin: 0;
    font-size: 1.05rem;
}

.block,
.block-lg {
    margin-bottom: clamp(1rem, 2.4vw, 1.5rem);
    padding: clamp(1rem, 3vw, 1.35rem);
}

.block {
    color: var(--landing-text-soft);
    line-height: 1.8;
}

.profile-field-label {
    display: inline-flex;
    min-width: 5rem;
    align-items: center;
    gap: 0.45rem;
    color: var(--landing-text);
    font-weight: var(--font-weight-bold);
}

#operationsAuditContainer,
#transactionHistoryContainer {
    overflow-x: auto;
    margin-inline: -0.25rem;
    padding-inline: 0.25rem;
    scrollbar-color: rgba(26, 86, 116, 0.42) rgba(26, 86, 116, 0.08);
    scrollbar-width: thin;
}

.page-content table {
    width: 100%;
    min-width: 720px;
    margin: 1rem 0 0;
    border-collapse: separate;
    border-spacing: 0 0.55rem;
    background: transparent;
    font-size: 0.88rem;
}

.page-content table thead {
    background: transparent;
}

.page-content table th {
    padding: 0 0.85rem 0.25rem;
    border: 0;
    color: var(--landing-text-muted);
    font-size: 0.76rem;
    font-weight: var(--font-weight-xbold);
    letter-spacing: 0.09em;
    text-align: left;
    text-transform: uppercase;
}

.page-content table td {
    padding: 0.9rem 0.85rem;
    border: 0;
    background: rgba(255, 255, 255, 0.82);
    color: var(--landing-text-soft);
    vertical-align: middle;
}

.page-content table td:first-child {
    border-radius: 16px 0 0 16px;
}

.page-content table td:last-child {
    border-radius: 0 16px 16px 0;
}

.page-content table tbody tr:nth-child(even),
.page-content table tbody tr:hover {
    background: transparent;
}

.page-content table tbody tr:hover td {
    background: rgba(234, 242, 255, 0.78);
}

.transaction-history-table td:nth-child(2),
.transaction-history-table td:nth-child(3),
.transaction-history-table th:nth-child(2),
.transaction-history-table th:nth-child(3) {
    text-align: right;
}

.no-operations,
.no-transactions {
    margin: 0;
    padding: 2rem 1rem;
    border: 1px dashed rgba(26, 86, 116, 0.22);
    border-radius: var(--landing-radius-md);
    background: rgba(255, 255, 255, 0.68);
    color: var(--landing-text-muted);
    font-size: 0.95rem;
    font-style: normal;
    text-align: center;
}

.transaction-history-box {
    margin-top: 0;
}

.operations-audit-note {
    margin: 0 0 0.85rem;
    color: var(--landing-text-muted);
    font-size: 0.82rem;
}

.operations-audit-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 0.85rem;
    margin-bottom: 0.75rem;
}

.operations-audit-filter {
    display: grid;
    gap: 0.25rem;
    min-width: 8.5rem;
    color: var(--landing-text-muted);
    font-size: 0.72rem;
    font-weight: var(--font-weight-xbold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.operations-audit-filter select {
    min-height: 36px;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--landing-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--landing-text);
    font-size: 0.84rem;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0;
    text-transform: none;
}

.operations-audit-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    align-items: center;
    margin: 0 0 0.7rem;
    color: var(--landing-text-soft);
    font-size: 0.8rem;
}

.operations-audit-summary__sep {
    color: var(--landing-text-muted);
}

.operations-audit-summary__hint {
    width: 100%;
    color: var(--landing-text-muted);
    font-size: 0.75rem;
}

.operations-audit-table-wrap {
    max-height: 28rem;
    overflow: auto;
    margin-inline: -0.25rem;
    padding-inline: 0.25rem;
}

.page-content table.operations-audit-table {
    min-width: 640px;
    margin-top: 0;
    border-spacing: 0 0.28rem;
    font-size: 0.8rem;
}

.page-content table.operations-audit-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.35rem 0.6rem 0.3rem;
    background: rgba(247, 250, 255, 0.96);
}

.page-content table.operations-audit-table td {
    padding: 0.4rem 0.6rem;
}

.page-content table.operations-audit-table .operations-audit-filename--failed {
    color: var(--landing-text-muted);
    font-weight: var(--font-weight-semibold);
}

.page-content table.operations-audit-table th:nth-child(5),
.page-content table.operations-audit-table th:nth-child(6),
.page-content table.operations-audit-table td:nth-child(5),
.page-content table.operations-audit-table td:nth-child(6) {
    text-align: right;
    white-space: nowrap;
}

.operations-audit-load-more {
    margin: 0.65rem 0 0;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: var(--font-weight-bold);
    white-space: nowrap;
}

.status--success {
    color: #067647;
}

.status--warning {
    color: #9a5b00;
}

.status--error {
    color: #b4232f;
}

.text-muted {
    color: var(--landing-text-muted);
}

.text-xs {
    font-size: 0.82rem;
}

.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
}

#signupLoadingOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    background: rgba(16, 24, 40, 0.62);
    backdrop-filter: blur(8px);
}

#signupLoadingOverlay.show {
    display: flex;
}

.loading-content {
    width: min(100% - 2rem, 360px);
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: var(--landing-radius-lg);
    background: rgba(255, 255, 255, 0.92);
    color: var(--landing-text);
    text-align: center;
    box-shadow: var(--landing-shadow-lg);
}

.loading-spinner {
    margin-bottom: 1rem;
    color: var(--landing-primary);
    font-size: 3rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    color: var(--landing-text-soft);
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
}

@media (max-width: 900px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .section-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .page-content {
        width: min(100% - 1.25rem, var(--landing-container));
    }

    .page-content.h1-background {
        padding-top: 2.75rem;
    }

    #authFormsContainer {
        padding: 1rem;
        border-radius: var(--landing-radius-lg);
    }

    .auth-actions,
    .page-content .button {
        width: 100%;
    }

    .page-content .button {
        margin-right: 0;
    }

    .profile-field-label {
        min-width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
