/* ============================================
   Agent AI Fotopolis.pl - Full Page Styles
   ============================================ */

:root {
    --fp-accent: #6e52cf;
    --fp-accent-hover: #5d43b8;
    --fp-accent-light: #f1edfb;
    --fp-bg: #ffffff;
    --fp-text: #111111;
    --fp-text-muted: #444444;
    --fp-text-light: #8a8a8a;
    --fp-border: #111111;
    --fp-border-light: #bdbdbd;
    --fp-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(--fp-font);
    background: var(--fp-bg);
    color: var(--fp-text);
    overflow-x: hidden;
}

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

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

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

#fp-app.chat-mode .fp-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(--fp-border);
}

.fp-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--fp-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--fp-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.fp-back:hover {
    border-color: var(--fp-accent);
}

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

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

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

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

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

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

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

.fp-logo-site {
    margin-top: -6px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--fp-text);
    text-decoration: none;
}

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

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

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

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

.fp-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(--fp-text);
    background: transparent;
}

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

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

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

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

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

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

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

.fp-sources-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fp-source-chip {
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--fp-border-light);
    border-radius: 999px;
    background: #ffffff;
    color: var(--fp-text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
}

.fp-source-chip:hover {
    border-color: var(--fp-accent);
}

.fp-source-chip.active {
    background: var(--fp-accent);
    border-color: var(--fp-accent);
    color: #ffffff;
}

#fp-app.chat-mode .fp-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(--fp-border);
    padding: 16px max(24px, calc((100% - 880px) / 2));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.fp-typing-dots span {
    animation: fpBlink 1.4s infinite both;
    font-size: 16px;
}
.fp-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.fp-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)
   ========================================== */
.fp-sources-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--fp-border-light);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    .fp-topbar {
        top: 16px;
        left: 16px;
    }
    #fp-app.chat-mode .fp-topbar {
        padding: 10px 16px;
    }
    .fp-back {
        height: 32px;
        padding: 0 12px;
        font-size: 12px;
    }

    .fp-main {
        padding: 48px 20px 20px;
    }
    .fp-container {
        gap: 28px;
    }
    .fp-hero {
        gap: 10px;
    }
    .fp-logo-title {
        font-size: 56px;
    }
    .fp-logo-site {
        margin-top: -4px;
        font-size: 17px;
    }
    .fp-hero-subtitle {
        margin-top: 8px;
        font-size: 15px;
    }

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

    .fp-sources {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 0 2px;
    }
    .fp-sources-label {
        float: none;
        font-size: 11px;
    }
    .fp-source-chip {
        font-size: 11px;
    }

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

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

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