/* ============================================
   Agent AI Audio.com.pl - Full Page Styles
   ============================================ */

:root {
    --au-accent: #d9261c;
    --au-accent-hover: #b81f16;
    --au-bg: #ffffff;
    --au-text: #111111;
    --au-text-muted: #444444;
    --au-text-light: #8a8a8a;
    --au-text-gray: #6b6b6b;
    --au-border: #111111;
    --au-border-light: #bdbdbd;
    --au-font: 'Manrope', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    min-height: 100%;
    font-family: var(--au-font);
    background: var(--au-bg);
    color: var(--au-text);
    overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; }
textarea { font-family: inherit; }
a { color: var(--au-text); }
a:hover { color: var(--au-accent); }

.au-mobile-only { display: none; }

/* ==========================================
   Top bar (Powrót do serwisu)
   ========================================== */
.au-topbar {
    position: absolute;
    top: 24px;
    left: 32px;
    z-index: 110;
}

#au-app.chat-mode .au-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 32px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--au-border);
}

.au-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--au-text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

/* ==========================================
   Welcome
   ========================================== */
.au-welcome {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.au-welcome.hidden {
    display: none;
}

.au-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 88px 64px 72px;
}

.au-container {
    width: 100%;
    max-width: 880px;
    display: flex;
    flex-direction: column;
    gap: 44px;
}

.au-hero {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    text-align: center;
}

.au-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.au-logo-title {
    font-size: 84px;
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1;
    color: var(--au-text);
}

.au-logo-site {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: -4px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--au-text);
    text-decoration: none;
}

.au-logo-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--au-accent);
}

.au-hero-subtitle {
    margin-top: 14px;
    max-width: 660px;
    font-size: 19px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--au-text);
}

/* ==========================================
   Controls (input + sources) - inline on welcome, fixed on chat
   ========================================== */
.au-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.au-input-box {
    display: flex;
    flex-direction: column;
    border: 2px solid var(--au-border);
    border-radius: 8px;
    background: #ffffff;
}

.au-input-label {
    padding: 18px 22px 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--au-text);
}

.au-input-box textarea {
    display: block;
    width: 100%;
    min-height: 180px;
    padding: 12px 22px 16px;
    border: 0;
    outline: 0;
    resize: vertical;
    font-size: 19px;
    line-height: 1.5;
    color: var(--au-text);
    background: transparent;
}

.au-input-box textarea::placeholder {
    color: var(--au-text-light);
}

.au-input-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 22px 16px;
    border-top: 1px solid var(--au-border);
}

.au-input-hint {
    font-size: 13px;
    color: var(--au-text-muted);
}

.au-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    padding: 0 28px;
    border: 0;
    border-radius: 6px;
    background: var(--au-accent);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.15s, opacity 0.15s;
}
.au-send-btn:hover { background: var(--au-accent-hover); }
.au-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.au-chat-note {
    display: none;
}

/* Source picker */
.au-sources {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0 4px;
    border: 0;
}

.au-sources-label {
    float: left;
    margin-right: 4px;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--au-text-gray);
}

.au-sources-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.au-source-chip {
    height: 32px;
    padding: 0;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--au-text-gray);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.au-source-chip:hover {
    color: var(--au-text);
}

.au-source-chip.active {
    border-bottom-color: var(--au-accent);
    color: var(--au-text);
}

#au-app.chat-mode .au-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--au-border);
    padding: 16px max(24px, calc((100% - 880px) / 2));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

#au-app.chat-mode .au-input-label {
    display: none;
}

#au-app.chat-mode .au-input-box textarea {
    min-height: 0;
    max-height: 120px;
    padding: 12px 22px;
    font-size: 16px;
    resize: none;
}

#au-app.chat-mode .au-input-bar {
    padding: 8px 22px 10px;
}

#au-app.chat-mode .au-send-btn {
    height: 40px;
    padding: 0 22px;
}

#au-app.chat-mode .au-chat-note {
    display: block;
    font-size: 11px;
    color: var(--au-text-muted);
    text-align: center;
}

/* Prompts section */
.au-prompts-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: -4px;
}

.au-section-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--au-text);
}

.au-prompts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.au-prompt-card {
    min-height: 56px;
    padding: 12px 16px;
    text-align: left;
    border: 1px solid var(--au-border);
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--au-text);
    transition: border-color 0.15s, color 0.15s;
}

.au-prompt-card:hover {
    border-color: var(--au-accent);
    color: var(--au-accent);
}

/* Footer */
.au-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 64px 28px;
    border-top: 1px solid var(--au-border);
    font-size: 13px;
    color: var(--au-text-muted);
}

.au-footer-links {
    display: flex;
    gap: 20px;
    flex-shrink: 0;
}

.au-footer-links a {
    color: var(--au-text-muted);
    text-decoration: none;
}
.au-footer-links a:hover { color: var(--au-accent); }

/* ==========================================
   Chat view
   ========================================== */
.au-chat-view {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.au-chat-view.active {
    display: block;
}

.au-messages {
    max-width: 880px;
    width: 100%;
    margin: 0 auto;
    padding: 88px 24px 260px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* User message */
.au-msg-user {
    align-self: flex-end;
    max-width: 80%;
    background: var(--au-text);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Agent message */
.au-msg-agent {
    align-self: flex-start;
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--au-border);
    border-radius: 8px;
    padding: 18px 22px;
}

.au-msg-agent-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--au-text);
}

.au-msg-agent-text strong {
    font-weight: 700;
}

.au-msg-agent-text em {
    font-style: italic;
}

.au-msg-agent-text ul,
.au-msg-agent-text ol {
    margin: 8px 0;
    padding-left: 22px;
}

.au-msg-agent-text li {
    margin-bottom: 4px;
    line-height: 1.6;
}

.au-msg-agent-text li::marker {
    color: var(--au-accent);
}

/* Status / typing */
.au-msg-status {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid var(--au-border-light);
    border-radius: 8px;
    padding: 14px 18px;
    color: var(--au-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.au-typing-dots span {
    animation: fpBlink 1.4s infinite both;
    font-size: 16px;
}
.au-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.au-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes fpBlink {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* ==========================================
   Source references (in agent response)
   ========================================== */
.au-sources-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--au-border-light);
}

.au-sources-heading {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--au-text);
    margin-bottom: 10px;
}

.au-source-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.au-source-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #ffffff;
    border: 1px solid var(--au-border-light);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s;
}

.au-source-card:hover {
    border-color: var(--au-accent);
    color: inherit;
}

.au-source-card-img {
    width: 88px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #eeeeee;
}

.au-source-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.au-source-card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--au-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.au-source-card:hover .au-source-card-title {
    color: var(--au-accent);
}

.au-source-card-meta {
    font-size: 12px;
    color: var(--au-text-muted);
}

.au-source-card-cat {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 11px;
}

/* ==========================================
   Product cards (products_info), wzór: lewa kolumna strony testu
   ========================================== */
.au-products {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.au-product {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 22px;
    padding: 18px;
    border: 1px solid var(--au-border);
    border-radius: 8px;
}

.au-product-img {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.au-product-img img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.au-product-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.au-product-name {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.au-product-name a {
    text-decoration: none;
}

.au-info,
.au-rating dl {
    display: flex;
    flex-direction: column;
}

.au-info-row,
.au-rating-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--au-border-light);
    font-size: 14px;
    line-height: 1.5;
}

.au-info-row dt,
.au-rating > summary {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--au-text-gray);
    padding-top: 2px;
}

.au-info-row dd a,
.au-rating-row dd a {
    font-weight: 600;
}

.au-info-strong {
    font-weight: 800 !important;
}

.au-info-price {
    font-weight: 800;
    white-space: nowrap;
}

.au-info-muted {
    display: block;
    font-size: 12px;
    color: var(--au-text-gray);
}

.au-info-link {
    color: var(--au-accent);
}

.au-shops {
    margin-top: 4px;
}

.au-shops summary,
.au-rating > summary {
    cursor: pointer;
    width: fit-content;
}

.au-shops summary {
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
}

.au-shops ul {
    list-style: none;
    margin-top: 8px;
    max-height: 240px;
    overflow-y: auto;
    columns: 2;
    column-gap: 16px;
}

.au-shops-all {
    display: inline-block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
}

.au-shops li {
    break-inside: avoid;
    padding: 3px 0;
    font-size: 13px;
}

.au-rating {
    border-top: 2px solid var(--au-text);
    padding-top: 10px;
}

.au-rating > summary {
    padding: 0 0 4px;
    color: var(--au-text);
}

.au-rating-row dt {
    font-weight: 700;
}

.au-product-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
}

.au-product-link {
    font-size: 14px;
    font-weight: 600;
}

.au-product-link--main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border-radius: 6px;
    background: var(--au-accent);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.au-product-link--main:hover {
    background: var(--au-accent-hover);
    color: #ffffff;
}

/* Podobne produkty, pasaż Top Hi-Fi */
.au-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--au-border-light);
}

.au-similar {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.au-similar li {
    padding: 7px 12px;
    border: 1px solid var(--au-border-light);
    border-radius: 6px;
    font-size: 13px;
}

.au-similar a {
    text-decoration: none;
}

.au-ak {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.au-ak-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--au-border-light);
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.35;
}

.au-ak-card:hover {
    border-color: var(--au-accent);
    color: var(--au-text);
}

.au-ak-img {
    height: 140px;
}

.au-ak-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.au-ak-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    margin-top: auto;
}

.au-ak-price span {
    color: var(--au-accent);
    font-size: 16px;
    font-weight: 800;
}

.au-ak-price s {
    color: var(--au-text-gray);
    font-size: 13px;
}

/* Suggestions */
.au-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.au-suggestion-chip {
    padding: 7px 14px;
    background: #ffffff;
    border: 1px solid var(--au-accent);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--au-accent);
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.au-suggestion-chip:hover {
    background: var(--au-accent);
    color: #ffffff;
}

/* Show more */
.au-show-more {
    display: block;
    width: 100%;
    padding: 9px;
    margin-top: 8px;
    background: #ffffff;
    color: var(--au-text);
    border: 1px solid var(--au-border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}
.au-show-more:hover {
    border-color: var(--au-accent);
    color: var(--au-accent);
}

/* ==========================================
   Mobile
   ========================================== */
@media (max-width: 640px) {
    .au-desktop-only { display: none; }
    .au-mobile-only { display: inline; }

    .au-topbar {
        top: 16px;
        left: 16px;
    }
    #au-app.chat-mode .au-topbar {
        padding: 4px 16px;
    }
    .au-back {
        font-size: 13px;
    }

    .au-main {
        padding: 64px 20px 20px;
    }
    .au-container {
        gap: 24px;
    }
    .au-hero {
        gap: 10px;
    }
    .au-logo-title {
        font-size: 52px;
    }
    .au-logo-site {
        gap: 6px;
        margin-top: -2px;
        font-size: 17px;
    }
    .au-logo-dot {
        width: 8px;
        height: 8px;
    }
    .au-hero-subtitle {
        margin-top: 6px;
        font-size: 15px;
    }

    .au-controls {
        gap: 14px;
    }
    .au-input-label {
        padding: 14px 16px 0;
        font-size: 11px;
    }
    .au-input-box textarea {
        min-height: 140px;
        padding: 10px 16px 12px;
        font-size: 17px;
        resize: none;
    }
    .au-input-bar {
        padding: 12px 16px 16px;
    }
    .au-input-hint {
        display: none;
    }
    .au-send-btn {
        flex-grow: 1;
    }

    .au-sources {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 0 2px;
    }
    .au-sources-label {
        float: none;
        font-size: 11px;
    }
    .au-sources-chips {
        gap: 18px;
    }
    .au-source-chip {
        height: 30px;
        font-size: 13px;
    }

    .au-prompts-section {
        gap: 8px;
        margin-top: 2px;
    }
    .au-section-label {
        font-size: 11px;
    }
    .au-prompts {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .au-prompt-card {
        min-height: 48px;
        padding: 10px 14px;
    }
    .au-prompt-card.au-desktop-only {
        display: none;
    }

    .au-footer {
        display: block;
        padding: 12px 20px 16px;
        font-size: 11px;
        line-height: 1.4;
    }
    .au-footer-links {
        display: inline;
    }
    .au-footer-links > *::before {
        content: " · ";
    }

    /* Chat mode */
    #au-app.chat-mode .au-controls {
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    #au-app.chat-mode .au-input-box textarea {
        padding: 10px 16px;
    }
    #au-app.chat-mode .au-input-bar {
        padding: 8px 12px 10px;
    }
    #au-app.chat-mode .au-sources-chips {
        gap: 0 14px;
    }
    #au-app.chat-mode .au-source-chip {
        height: 28px;
        font-size: 12px;
    }
    .au-messages {
        padding: 72px 16px 280px;
    }
    .au-msg-user {
        max-width: 90%;
    }
    .au-msg-agent {
        padding: 14px 16px;
    }
    .au-source-card-img {
        width: 64px;
        height: 48px;
    }

    .au-product {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px;
    }
    .au-product-img img {
        width: 160px;
    }
    .au-product-name {
        font-size: 19px;
    }
    .au-info-row,
    .au-rating-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }
    .au-shops ul {
        columns: 1;
    }

    .au-ak {
        gap: 6px;
    }
    .au-ak-card {
        padding: 8px;
        font-size: 11px;
        gap: 6px;
    }
    .au-ak-img {
        height: 70px;
    }
    .au-ak-price span {
        font-size: 13px;
    }
    .au-ak-price s {
        font-size: 11px;
    }
}
