/*
Theme Name: Nae
Theme URI: https://nae.ge
Author: Giorgi Dolidze
Description: Minimal full-screen conversational WordPress theme for Nae.
Version: 2.1.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: nae
*/


/* v1.0: unified outline icon system, compact titles, robust font uploads */
.nae-brand {
    width: clamp(92px, 9vw, 132px) !important;
    height: 54px !important;
    overflow: hidden !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
}
.nae-logo {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 48px !important;
    object-fit: contain !important;
    object-position: left center !important;
    flex: 0 0 auto !important;
}
.nae-page h1,
.nae-page .entry-title,
body.woocommerce-account .nae-page h1 {
    font-size: clamp(28px, 2.6vw, 38px) !important;
    line-height: 1.15 !important;
    margin: 0 0 24px !important;
    font-weight: 300 !important;
    letter-spacing: -0.01em !important;
}
.nae-page-content h2 { font-size: clamp(23px, 2.2vw, 31px) !important; }
.nae-page-content h3 { font-size: clamp(20px, 1.8vw, 26px) !important; }

@media (max-width: 640px) {
    .nae-brand { width: 84px !important; height: 46px !important; }
    .nae-logo { max-height: 40px !important; }
    .nae-page h1, .nae-page .entry-title, body.woocommerce-account .nae-page h1 {
        font-size: 28px !important;
        margin-bottom: 20px !important;
    }
}


/* v1.0 unified outline icon system */
.nae-icon {
    width: 21px;
    height: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0 !important;
    line-height: 0;
    transform: none !important;
}
.nae-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}
.nae-icon-theme-sun { display: none; }
html[data-nae-theme="night"] .nae-icon-theme-moon { display: none; }
html[data-nae-theme="night"] .nae-icon-theme-sun { display: inline-flex; }
.nae-icon-button,
.nae-icon-button:hover,
.nae-icon-button:focus,
.nae-icon-button:active,
.nae-icon-button:visited {
    color: var(--nae-text) !important;
    -webkit-text-fill-color: currentColor !important;
}


/* v1.1: WooCommerce-powered pricing plans */
.nae-pricing-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
    align-items: stretch;
    margin-top: 34px;
}
.nae-plan {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: clamp(24px, 3vw, 34px);
    overflow: hidden;
}
.nae-plan-heading h2 {
    margin: 0 0 16px !important;
    font-size: clamp(24px, 2.4vw, 34px) !important;
    font-weight: 300 !important;
}
.nae-plan-price {
    min-height: 47px;
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1.15;
    font-weight: 300;
}
.nae-plan-price del {
    display: block;
    color: var(--nae-muted);
    font-size: .48em;
    opacity: .75;
}
.nae-plan-price ins { text-decoration: none; }
.nae-plan-description {
    margin: 26px 0 30px;
    color: var(--nae-muted);
    font-size: 16px;
    line-height: 1.65;
}
.nae-plan-description p:last-child { margin-bottom: 0; }
.nae-plan-description ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 11px;
}
.nae-plan-description li {
    position: relative;
    padding-left: 22px;
}
.nae-plan-description li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--nae-text);
}
.nae-plan-button,
.woocommerce a.nae-plan-button.button {
    width: 100%;
    margin-top: auto !important;
    padding: 13px 20px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--nae-text) !important;
    border-radius: 999px !important;
    background: transparent !important;
    color: var(--nae-text) !important;
    text-decoration: none !important;
    font-size: 16px !important;
    font-weight: 300 !important;
    line-height: 1.2 !important;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.nae-plan-button:hover,
.woocommerce a.nae-plan-button.button:hover {
    background: var(--nae-text) !important;
    color: var(--nae-bg) !important;
    transform: translateY(-1px);
}
.nae-plan-badge {
    align-self: flex-start;
    margin: -5px 0 22px;
    padding: 6px 11px;
    border: 1px solid var(--nae-line);
    border-radius: 999px;
    color: var(--nae-muted);
    font-size: 12px;
    line-height: 1;
}
.nae-pricing-notice {
    margin-top: 34px;
    padding: 24px;
    border: 1px solid var(--nae-line);
    border-radius: 22px;
    color: var(--nae-muted);
}
.nae-pricing-notice p { margin: 0; }

@media (max-width: 640px) {
    .nae-pricing-grid { margin-top: 26px; }
    .nae-plan { padding: 24px; }
}


/* v1.3: native page scrolling while preserving the fixed Nae interface */
body.nae-page-view {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}
body.nae-page-view .nae-page-shell {
    height: auto;
    min-height: 100svh;
    overflow: visible;
    display: block;
}
body.nae-page-view .nae-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nae-bg);
    padding-block: 6px;
}
body.nae-page-view .nae-page-scroll {
    min-height: auto;
    overflow: visible;
    overscroll-behavior: auto;
    -webkit-overflow-scrolling: auto;
}
body.nae-chat-view {
    height: 100%;
    overflow: hidden;
}
body.nae-chat-view .nae-composer {
    position: sticky;
    bottom: 0;
    z-index: 50;
    background: var(--nae-bg);
}

/* Compact plan introductions; feature lists retain their readable size. */
.nae-page-content .nae-plan-description > p:first-child {
    margin: 0 0 20px !important;
    font-size: 18px !important;
    line-height: 1.55 !important;
    font-weight: 300 !important;
}
.nae-page-content .nae-plan-description ul {
    font-size: 16px;
    line-height: 1.65;
}

@media (max-width: 640px) {
    body.nae-page-view .nae-header { padding-block: 4px; }
    .nae-page-content .nae-plan-description > p:first-child {
        font-size: 16px !important;
        line-height: 1.5 !important;
        margin-bottom: 17px !important;
    }
    .nae-page-content .nae-plan-description ul { font-size: 15px; }
}


/* v1.4: live Nae conversation interface */
.nae-message-typing p {
    color: var(--nae-muted);
    font-size: clamp(16px, 1.7vw, 20px);
    animation: nae-soft-pulse 1.25s ease-in-out infinite;
}
.nae-message-error p {
    color: var(--nae-muted);
    font-size: clamp(15px, 1.6vw, 18px);
}
.nae-composer.is-busy { opacity: .72; }
.nae-composer textarea:disabled,
.nae-send:disabled {
    cursor: default;
    opacity: .55;
}
@keyframes nae-soft-pulse {
    0%, 100% { opacity: .45; }
    50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .nae-message-typing p { animation: none; }
}

/* v1.5: refined conversation bubbles */
:root {
    --nae-bubble-nae: rgba(255, 255, 255, .34);
    --nae-bubble-user: rgba(218, 202, 180, .34);
    --nae-bubble-border: rgba(23, 32, 42, .11);
}
html[data-nae-theme="night"] {
    --nae-bubble-nae: rgba(255, 255, 255, .055);
    --nae-bubble-user: rgba(244, 235, 221, .105);
    --nae-bubble-border: rgba(244, 235, 221, .13);
}

.nae-conversation {
    width: min(100%, 920px);
    padding: 8px 10px 34px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.nae-conversation::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.nae-message {
    width: 100%;
    margin: 0 0 20px;
    animation: nae-message-in .16s ease-out both;
}
.nae-message p {
    display: inline-block;
    width: auto;
    max-width: min(76%, 660px);
    margin: 0;
    padding: 13px 17px;
    border: 1px solid var(--nae-bubble-border);
    border-radius: 20px;
    font-size: clamp(16px, 1.35vw, 19px);
    line-height: 1.55;
    font-weight: 300;
    letter-spacing: 0;
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    box-shadow: none;
}
.nae-message-nae {
    justify-content: flex-start;
    text-align: left;
}
.nae-message-nae p {
    background: var(--nae-bubble-nae);
    border-bottom-left-radius: 7px;
}
.nae-message-user {
    justify-content: flex-end;
    text-align: right;
}
.nae-message-user p {
    background: var(--nae-bubble-user);
    border-bottom-right-radius: 7px;
}
.nae-message-typing p,
.nae-message-error p {
    font-size: clamp(15px, 1.25vw, 17px);
}

@keyframes nae-message-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
    .nae-chat { padding-top: 22px; }
    .nae-conversation { padding: 6px 4px 26px; }
    .nae-message { margin-bottom: 15px; }
    .nae-message p {
        max-width: 84%;
        padding: 11px 14px;
        border-radius: 18px;
        font-size: 16px;
        line-height: 1.5;
    }
    .nae-message-nae p { border-bottom-left-radius: 6px; }
    .nae-message-user p { border-bottom-right-radius: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .nae-message { animation: none; }
}


/* Nae V1.7 — decorative typing cursor; reply rendering remains fail-safe. */
.nae-message-being-typed p::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 1em;
    margin-inline-start: 3px;
    vertical-align: -0.12em;
    background: currentColor;
    opacity: .5;
    animation: nae-caret-blink .8s steps(1, end) infinite;
}

@keyframes nae-caret-blink {
    0%, 48% { opacity: .5; }
    49%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .nae-message-being-typed p::after {
        display: none;
        animation: none;
    }
}


/* v1.8: real conversations archive and linked login state */
.nae-initial-message a {
    color: inherit;
    text-underline-offset: 4px;
}
.nae-conversations-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 24px;
}
.nae-primary-action,
.nae-secondary-action,
.nae-card-action {
    appearance: none;
    border: 1px solid var(--nae-line);
    border-radius: 999px;
    padding: 10px 16px;
    background: transparent;
    color: var(--nae-text) !important;
    text-decoration: none !important;
    font: inherit;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .18s ease, transform .18s ease, border-color .18s ease;
}
.nae-primary-action {
    background: var(--nae-text);
    color: var(--nae-bg) !important;
    border-color: var(--nae-text);
}
.nae-primary-action:hover,
.nae-secondary-action:hover,
.nae-card-action:hover { transform: translateY(-1px); }
.nae-secondary-action:hover,
.nae-card-action:hover { background: var(--nae-soft); }
.nae-conversation-archive { margin-top: 0; }
.nae-archive-card {
    padding: 22px 24px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--nae-bg) 96%, var(--nae-soft));
}
.nae-archive-content { min-width: 0; flex: 1; }
.nae-archive-card strong {
    margin: 0 0 7px;
    font-size: 18px;
    line-height: 1.35;
    font-weight: 400;
}
.nae-archive-card p {
    margin: 0 0 8px;
    color: var(--nae-muted);
    font-size: 15px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nae-archive-card span { display: block; font-size: 13px; }
.nae-card-actions { flex-wrap: wrap; justify-content: flex-end; }
.nae-card-action { padding: 8px 13px; }
.nae-card-action-primary { border-color: var(--nae-text); }
.nae-card-action-danger { color: #a64242 !important; }
.nae-archive-loading,
.nae-conversations-empty {
    border: 1px solid var(--nae-line);
    border-radius: 20px;
    padding: 28px;
    color: var(--nae-muted);
}
.nae-conversations-empty strong { display: block; color: var(--nae-text); font-size: 19px; font-weight: 400; margin-bottom: 7px; }
.nae-conversations-empty p { margin: 0; }
.nae-dialog-wrap {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 20px;
}
.nae-dialog-wrap[hidden] { display: none; }
.nae-dialog-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, .32);
}
.nae-dialog {
    position: relative;
    width: min(100%, 470px);
    border: 1px solid var(--nae-line);
    border-radius: 24px;
    padding: 26px;
    background: var(--nae-bg);
    color: var(--nae-text);
    box-shadow: var(--nae-shadow);
}
.nae-dialog h2 { margin: 0 0 20px; font-size: 25px; font-weight: 300; }
.nae-dialog p { margin: 0 0 12px; font-size: 16px; line-height: 1.55; }
.nae-dialog-note { color: var(--nae-muted); }
.nae-dialog-label { display: grid; gap: 9px; color: var(--nae-muted); font-size: 14px; }
.nae-dialog-input {
    width: 100%;
    border: 1px solid var(--nae-line);
    border-radius: 14px;
    padding: 12px 14px;
    background: transparent;
    color: var(--nae-text);
    font: inherit;
    font-size: 16px;
    outline: none;
}
.nae-dialog-input:focus { border-color: var(--nae-text); }
.nae-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.nae-dialog-confirm.is-danger,
.nae-primary-action.is-danger { background: #a64242; border-color: #a64242; color: #fff !important; }
.nae-dialog-error { margin-top: 14px !important; color: #a64242; }
@media (max-width: 640px) {
    .nae-conversations-toolbar { justify-content: stretch; }
    .nae-conversations-toolbar .nae-primary-action { width: 100%; text-align: center; }
    .nae-archive-card { padding: 19px; }
    .nae-card-actions { width: 100%; justify-content: flex-start; }
    .nae-card-action { flex: 1 1 auto; text-align: center; }
    .nae-dialog { padding: 22px; border-radius: 20px; }
}

/* v1.9: editor content on conversations page and removal of obsolete API placeholder */
