/* ================================================================
   AI PRÁVNÍK
   ================================================================ */
.ai-container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 20px;
}

.ai-header {
    background: var( --color-primary );
    border-radius: 12px;
    padding: var( --space-xl );
    margin-bottom: var( --space-lg );
    color: white;
}

.ai-logo {
    display: flex;
    align-items: flex-start;
    gap: var( --space-md );
}

.ai-scales-icon {
    font-size: 36px;
    flex-shrink: 0;
    line-height: 1;
}

.ai-title-group h1 {
    font-family: var( --font-heading );
    font-size: 26px;
    color: white;
    margin-bottom: 4px;
}

.ai-subtitle {
    font-size: 14px;
    color: rgba( 255, 255, 255, 0.75 );
    margin: 0;
}

.ai-subtitle a {
    color: var( --color-accent-gold );
    text-decoration: underline;
}

/* Chat area */
.ai-chat-area {
    background: var( --color-bg-white );
    border: 1px solid var( --color-border-light );
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba( 0, 0, 0, 0.06 );
    margin-bottom: var( --space-lg );
    overflow: hidden;
}

/* Conversations toolbar */
.ai-status {
    background: var( --color-bg-cream );
    border-bottom: 1px solid var( --color-border-light );
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
    font-size: 13px;
    color: var( --color-text-light );
}

.conversations-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var( --color-primary );
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    font-family: inherit;
    font-weight: 500;
}

.conversations-toggle:hover {
    text-decoration: underline;
}

.dropdown-arrow {
    transition: transform 0.2s ease;
}

.conversations-toggle.open .dropdown-arrow {
    transform: rotate( 180deg );
}

.conversations-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var( --color-bg-white );
    border: 1px solid var( --color-border-light );
    border-top: none;
    z-index: 100;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.1 );
}

.conversations-list.open {
    display: block;
}

.conversations-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var( --color-border-light );
    transition: background 0.15s ease;
}

.conversations-item:hover,
.conversations-item--active {
    background: var( --color-bg-cream );
}

.conversations-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var( --color-primary );
    margin-bottom: 2px;
}

.conversations-item-meta {
    font-size: 12px;
    color: var( --color-text-light );
}

.conversations-empty {
    padding: 16px;
    text-align: center;
    color: var( --color-text-light );
    font-size: 13px;
}

.conversations-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var( --color-border-light );
    border-radius: 6px;
    color: var( --color-primary );
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 10px;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
    margin-left: auto;
}

.conversations-new-btn:hover {
    background: var( --color-primary );
    color: white;
    border-color: var( --color-primary );
}

/* Messages area */
.ai-messages {
    padding: var( --space-xl );
    min-height: 280px;
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var( --space-md );
}

.ai-messages-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var( --space-2xl ) var( --space-lg );
    color: var( --color-text-light );
    flex: 1;
}

.ai-messages-empty.hidden {
    display: none;
}

.ai-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: var( --space-md );
    opacity: 0.5;
}

.ai-empty-hint {
    font-size: 13px;
    color: var( --color-text-light );
}

/* Chat messages (JS-created) */
.ai-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
}

.ai-message.user,
.ai-message.ai-message--user {
    align-self: flex-end;
    background: #4B6382;
    color: white;
    border-radius: 12px 12px 2px 12px;
}

.ai-message.assistant,
.ai-message.ai-message--assistant {
    align-self: flex-start;
    background: var( --color-bg-cream );
    color: var( --color-text-dark );
    border-radius: 2px 12px 12px 12px;
    border: 1px solid var( --color-border-light );
}

.ai-message.ai-message--error {
    align-self: center;
    background: var( --color-error-bg, #fff5f5 );
    color: var( --color-error, #c0392b );
    border: 1px solid var( --color-error, #c0392b );
    max-width: 100%;
    font-size: 14px;
}

/* JS hook: .ai-no-followup — querySelector selektor v ai.js (disable input when follow-up not supported). No styles needed. */

.ai-message.ai-message--info {
    align-self: center;
    background: var( --color-bg-cream );
    color: var( --color-text-medium );
    border: 1px solid var( --color-border-light );
    max-width: 100%;
    font-size: 14px;
    font-style: italic;
}

.ai-message-bubble {
    word-break: break-word;
}

/* Nadpisy vygenerované z markdown uvnitř AI odpovědi — menší než globální h1-h3 */
.ai-message-bubble h1,
.ai-message-bubble h2,
.ai-message-bubble h3,
.ai-message-bubble h4 {
    font-size: 1em;
    font-weight: 700;
    margin: 1em 0 0.3em;
    line-height: 1.4;
    color: var( --color-text-dark );
    letter-spacing: 0;
    text-transform: none;
}
.ai-message-bubble h1 { font-size: 1.05em; }
.ai-message-bubble h2 { font-size: 1em; }
.ai-message-bubble h3,
.ai-message-bubble h4 { font-size: 0.95em; color: var( --color-text-medium ); }

.ai-message--streaming .ai-message-bubble {
    opacity: 0.85;
}

/* .ai-message--done — JS state marker, no visual style (class added programmatically) */

/* Progress indicator */
.ai-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var( --color-text-light );
}

.ai-progress-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var( --color-border-light );
    border-top-color: var( --color-accent-gold );
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.ai-progress-step {
    color: var( --color-text-light );
    font-size: 14px;
}

@keyframes spin {
    to { transform: rotate( 360deg ); }
}

/* Paywall */
.ai-paywall {
    background: var( --color-bg-cream );
    border: 1px solid var( --color-border-gold );
    border-radius: 8px;
    padding: var( --space-md );
    margin-top: var( --space-md );
    text-align: center;
}

.ai-paywall-lock {
    font-size: 24px;
    margin-bottom: 8px;
}

.ai-paywall-summary {
    color: var( --color-text-medium );
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: var( --space-md );
    text-align: left;
}

.ai-paywall-summary::before,
.ai-paywall-preview::before,
.ai-streaming-analysis::before {
    content: attr( data-label );
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var( --color-accent-gold );
    margin-bottom: 6px;
}

.ai-streaming-analysis {
    text-align: left;
}

.ai-paywall-preview {
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
    text-align: left;
}

.ai-paywall-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient( to bottom, transparent, var( --color-bg-cream ) );
    pointer-events: none;
}

.ai-paywall-content-wrap {
    display: none;
}

.ai-paywall-btn {
    background: var( --color-accent-gold );
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-family: var( --font-body );
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ai-paywall-btn:hover {
    background: var( --color-accent-gold-dark );
}

/* Input area */
.ai-input-area {
    padding: var( --space-md ) var( --space-lg );
    border-top: 1px solid var( --color-border-light );
}

.ai-input-row {
    display: flex;
    gap: var( --space-sm );
    align-items: flex-end;
}

.ai-input {
    flex: 1;
    padding: 12px 16px;
    font-family: var( --font-body );
    font-size: 15px;
    border: 1px solid var( --color-border-light );
    border-radius: 8px;
    resize: none;
    min-height: 48px;
    max-height: 200px;
    background: var( --color-bg-white );
    color: var( --color-text-dark );
    transition: border-color 0.2s ease;
    line-height: 1.5;
}

.ai-input:focus {
    outline: none;
    border-color: var( --color-accent-gold );
}

.ai-input:disabled {
    background: var( --color-bg-cream );
    color: var( --color-text-light );
    cursor: not-allowed;
}

.ai-send-btn {
    padding: 12px 24px;
    background: var( --color-accent-gold );
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var( --font-body );
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
    height: 48px;
}

.ai-send-btn:hover {
    background: var( --color-accent-gold-dark );
}

.ai-send-btn:disabled {
    background: var( --color-border-light );
    color: var( --color-text-light );
    cursor: not-allowed;
}

/* Law reference citations (linkifyLawReferences in ai.js) */
.citation {
    color: var( --color-accent-gold );
    text-decoration: underline;
    text-decoration-style: dotted;
    font-weight: 500;
}

.citation:hover {
    color: var( --color-primary );
}

/* Payment confirmation modal */
.payment-confirmation-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1100;
    align-items: center;
    justify-content: center;
}

.payment-confirmation-modal.modal--open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba( 0, 0, 0, 0.5 );
}

.modal-content {
    position: relative;
    background: var( --color-bg-white );
    width: 90%;
    max-width: 520px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba( 0, 0, 0, 0.18 );
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: var( --space-lg ) var( --space-xl );
    border-bottom: 1px solid var( --color-border-light );
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var( --font-heading );
    font-size: 20px;
    color: var( --color-primary );
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var( --color-text-light );
    padding: 8px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var( --color-primary );
}

.modal-body {
    padding: var( --space-xl );
}

.payment-info {
    text-align: center;
}

.payment-info .payment-icon {
    margin-bottom: var( --space-lg );
}

.payment-info h4 {
    font-family: var( --font-heading );
    font-size: 20px;
    color: var( --color-primary );
    margin-bottom: var( --space-md );
}

.payment-info p {
    color: var( --color-text-medium );
    line-height: 1.6;
    margin-bottom: var( --space-md );
}

.payment-details {
    background: var( --color-bg-cream );
    padding: var( --space-lg );
    border-radius: 8px;
    margin: var( --space-lg ) 0;
    border: 1px solid var( --color-border-gold );
}

.price-display {
    margin-bottom: 8px;
}

.price-amount {
    font-family: var( --font-heading );
    font-size: 36px;
    font-weight: 700;
    color: var( --color-primary );
}

.price-currency {
    font-family: var( --font-heading );
    font-size: 20px;
    color: var( --color-primary );
    margin-left: 4px;
}

.price-description {
    color: var( --color-text-light );
    font-size: 14px;
    margin: 0;
}

.payment-actions {
    display: flex;
    gap: var( --space-md );
    justify-content: center;
    margin-top: var( --space-lg );
}


/* ================================================================
   RESPONSIVE — DESKTOP (1024px+)
   ================================================================ */
@media ( min-width: 1024px ) {
    .ai-container {
        padding: 0;
    }
}
