/**
 * SMAI FAQ — Frontend Styles
 */

/* =========================================================================
   Wrapper
   ========================================================================= */

.smai-faq-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    font-family: inherit;
}

/* =========================================================================
   Header (image + description)
   ========================================================================= */

.smai-faq-header {
    margin-bottom: 2em;
}

.smai-faq-header-image {
    margin-bottom: 1em;
}

.smai-faq-header-image img.smai-faq-lista-slika {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.smai-faq-header-opis {
    font-size: 1.05em;
    line-height: 1.6;
    color: #333;
}

/* =========================================================================
   Segments
   ========================================================================= */

.smai-faq-segment {
    margin-bottom: 2em;
}

.smai-faq-segment-title {
    font-size: 1.3em;
    font-weight: 600;
    margin: 0 0 0.8em;
    padding-bottom: 0.4em;
    border-bottom: 2px solid #e0e0e0;
    color: #1d1d1d;
}

/* =========================================================================
   Grid layout
   ========================================================================= */

.smai-faq-grid {
    display: grid;
    gap: 12px;
}

.smai-faq-grid[data-kolone="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.smai-faq-grid[data-kolone="4"] {
    grid-template-columns: repeat(4, 1fr);
}

/* =========================================================================
   FAQ Item (accordion)
   ========================================================================= */

.smai-faq-item {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s ease;
}

.smai-faq-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Question button */
.smai-faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 0.95em;
    font-weight: 500;
    line-height: 1.4;
    color: #1d1d1d;
    font-family: inherit;
    gap: 12px;
}

.smai-faq-question:hover {
    background: #f9f9f9;
}

.smai-faq-question:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

.smai-faq-question-text {
    flex: 1;
}

/* Chevron icon */
.smai-faq-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    position: relative;
    transition: transform 0.25s ease;
}

.smai-faq-icon::before,
.smai-faq-icon::after {
    content: "";
    position: absolute;
    background: #666;
    border-radius: 1px;
}

.smai-faq-icon::before {
    width: 12px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.smai-faq-icon::after {
    width: 2px;
    height: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.25s ease;
}

/* Open state */
.smai-faq-question[aria-expanded="true"] .smai-faq-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

/* Answer panel */
.smai-faq-answer {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.25s ease;
    max-height: 0;
    opacity: 0;
}

.smai-faq-answer[hidden] {
    display: block !important;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
}

.smai-faq-answer.smai-faq-answer--open {
    opacity: 1;
    visibility: visible;
}

.smai-faq-answer-inner {
    padding: 0 16px 16px;
    font-size: 0.92em;
    line-height: 1.7;
    color: #444;
    border-top: 1px solid #f0f0f0;
    padding-top: 14px;
}

.smai-faq-answer-inner p:first-child {
    margin-top: 0;
}

.smai-faq-answer-inner p:last-child {
    margin-bottom: 0;
}

/* Empty state */
.smai-faq-empty {
    text-align: center;
    padding: 2em;
    color: #888;
    font-style: italic;
}

/* =========================================================================
   AI Chatbot
   ========================================================================= */

.smai-faq-chatbot {
    max-width: 700px;
    margin: 2em auto 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    overflow: hidden;
}

.smai-faq-chatbot-header {
    padding: 16px 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.smai-faq-chatbot-title {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #1d1d1d;
}

.smai-faq-chatbot-context {
    margin: 4px 0 0;
    font-size: 0.85em;
    color: #666;
}

/* Messages area */
.smai-faq-chatbot-messages {
    min-height: 40px;
    max-height: 350px;
    overflow-y: auto;
    padding: 16px 20px;
}

.smai-faq-chatbot-messages:empty {
    display: none;
}

.smai-faq-chatbot-msg {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.92em;
    line-height: 1.6;
    max-width: 85%;
}

.smai-faq-chatbot-msg--user {
    background: #0073aa;
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.smai-faq-chatbot-msg--bot {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 2px;
}

.smai-faq-chatbot-loading {
    color: #999;
    font-style: italic;
}

/* Form area */
.smai-faq-chatbot-form {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.smai-faq-chatbot-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
    font-size: 0.92em;
    font-family: inherit;
    resize: none;
    line-height: 1.4;
}

.smai-faq-chatbot-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.smai-faq-chatbot-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.smai-faq-chatbot-submit {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.92em;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    align-self: flex-end;
}

.smai-faq-chatbot-submit:hover {
    background: #005a87;
}

.smai-faq-chatbot-submit:disabled {
    background: #999;
    cursor: not-allowed;
}

/* Status bar */
.smai-faq-chatbot-status {
    padding: 8px 20px 12px;
    font-size: 0.82em;
    color: #666;
    background: #fff;
}

.smai-faq-chatbot-limit-reached {
    color: #dc3232;
}

/* Chatbot placeholder from FAQ shortcode (when chatbot="da") */
.smai-faq-chatbot-placeholder {
    display: none;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 768px) {
    .smai-faq-grid[data-kolone="2"],
    .smai-faq-grid[data-kolone="4"] {
        grid-template-columns: 1fr;
    }

    .smai-faq-question {
        font-size: 0.9em;
        padding: 12px 14px;
    }

    .smai-faq-answer-inner {
        font-size: 0.88em;
        padding: 0 14px 14px;
        padding-top: 12px;
    }

    .smai-faq-chatbot-form {
        flex-direction: column;
    }

    .smai-faq-chatbot-submit {
        align-self: stretch;
    }

    .smai-faq-chatbot-msg {
        max-width: 92%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .smai-faq-grid[data-kolone="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}
