.kbh-ai-tools-panel {
    padding: 14px;
    direction: rtl;
    text-align: right;
    background: linear-gradient(135deg, #eef6ff 0%, #f8fbff 55%, #f4f0ff 100%);
    border-bottom: 1px solid rgba(37, 99, 235, 0.14);
}

.kbh-ai-summary-button {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    color: #ffffff;
    background: linear-gradient(135deg, #075985, #2563eb 58%, #7c3aed);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.kbh-ai-summary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.3);
}

.kbh-ai-summary-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.kbh-ai-summary-button-icon {
    width: 27px;
    height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 18px;
}

.kbh-ai-tools-description {
    margin-top: 8px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.8;
    text-align: center;
}

.kbh-ai-summary-open {
    overflow: hidden;
}

.kbh-ai-summary-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    direction: rtl;
    background: rgba(15, 23, 42, 0.64);
    backdrop-filter: blur(7px);
}

.kbh-ai-summary-modal.kbh-ai-summary-modal-visible {
    display: flex;
}

.kbh-ai-summary-dialog {
    width: min(760px, 94vw);
    max-height: min(720px, 88vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.3);
}

.kbh-ai-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    color: #ffffff;
    background: linear-gradient(135deg, #075985, #2563eb 60%, #7c3aed);
}

.kbh-ai-summary-eyebrow {
    margin-bottom: 3px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 11px;
}

.kbh-ai-summary-header h2 {
    margin: 0;
    font-family: inherit;
    font-size: 21px;
    font-weight: 800;
}

.kbh-ai-summary-close {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    font-family: inherit;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.kbh-ai-summary-body {
    min-height: 240px;
    overflow-y: auto;
    padding: 24px;
    color: #1e293b;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.kbh-ai-assistant-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 22px;
    padding: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f1f5f9;
}

.kbh-ai-assistant-tab {
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    padding: 9px 12px;
    color: #64748b;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.7;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.kbh-ai-assistant-tab:hover {
    color: #1d4ed8;
    background: rgba(255, 255, 255, 0.65);
}

.kbh-ai-assistant-tab-active,
.kbh-ai-assistant-tab-active:hover {
    color: #1d4ed8;
    background: #ffffff;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.09);
}

.kbh-ai-assistant-tab-panel {
    display: none;
}

.kbh-ai-assistant-tab-panel-active {
    display: block;
}

.kbh-ai-assistant-intro {
    margin-bottom: 14px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.9;
}

.kbh-ai-assistant-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 18px;
}

.kbh-ai-summary-loading {
    min-height: 190px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #475569;
    font-size: 14px;
}

.kbh-ai-summary-spinner {
    width: 38px;
    height: 38px;
    border: 4px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: kbh-ai-summary-spin 800ms linear infinite;
}

@keyframes kbh-ai-summary-spin {
    to {
        transform: rotate(360deg);
    }
}

.kbh-ai-summary-content {
    display: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 15px;
    line-height: 2.1;
    text-align: right;
}

.kbh-ai-summary-media-panel {
    display: none;
    margin-top: 20px;
    padding: 16px;
    /*border: 1px solid #dbeafe;*/
    /*border-radius: 14px;*/
    /*background: #ffffff;*/
    /*box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);*/
}

.kbh-ai-summary-media-title {
    margin-bottom: 12px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
}

.kbh-ai-summary-media-loading {
    display: none;
    padding: 10px 0;
    color: #475569;
    font-size: 13px;
}

.kbh-ai-summary-media-error {
    display: none;
    padding: 10px 12px;
    border-radius: 9px;
    color: #991b1b;
    background: #fef2f2;
    font-size: 13px;
    line-height: 1.8;
}

#kbh-ai-summary-audio {
    display: none;
    width: 100%;
    height: 46px;
}

#kbh-ai-summary-infographic {
    display: none;
    width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: contain;
}

.kbh-ai-summary-quiz-question {
    margin-top: 14px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    /*background: #f8fafc;*/
}

.kbh-ai-summary-quiz-question-title {
    margin-bottom: 12px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.9;
}

.kbh-ai-summary-quiz-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.kbh-ai-summary-quiz-option {
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    padding: 10px 12px;
    color: #334155;
    background: #ffffff;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.7;
    text-align: right;
    cursor: pointer;
}

.kbh-ai-summary-quiz-option:hover:not(:disabled) {
    border-color: #2563eb;
    background: #eff6ff;
}

.kbh-ai-summary-quiz-option-correct,
.kbh-ai-summary-quiz-option-correct:disabled {
    border-color: #22c55e;
    color: #166534;
    background: #dcfce7;
    opacity: 1;
}

.kbh-ai-summary-quiz-option-wrong,
.kbh-ai-summary-quiz-option-wrong:disabled {
    border-color: #ef4444;
    color: #991b1b;
    background: #fee2e2;
    opacity: 1;
}

.kbh-ai-summary-quiz-feedback {
    min-height: 22px;
    margin-top: 10px;
    font-size: 12px;
    font-weight: 700;
}

.kbh-ai-summary-quiz-feedback-correct {
    color: #15803d;
}

.kbh-ai-summary-quiz-feedback-wrong {
    color: #b91c1c;
}

.kbh-ai-summary-quiz-hint-button {
    border: 0;
    padding: 4px 0;
    color: #2563eb;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.kbh-ai-summary-quiz-hint {
    display: none;
    margin-top: 7px;
    padding: 9px 11px;
    border-right: 3px solid #f59e0b;
    color: #713f12;
    background: #fffbeb;
    font-size: 12px;
    line-height: 1.8;
}

.kbh-ai-summary-quiz-score {
    display: none;
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    color: #ffffff;
    background: #0f172a;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
}

.kbh-ai-summary-error {
    display: none;
    margin: 18px 0;
    padding: 15px 17px;
    border: 1px solid #fecaca;
    border-radius: 12px;
    color: #991b1b;
    background: #fef2f2;
    font-size: 14px;
    line-height: 1.9;
}

.kbh-ai-summary-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
    padding: 14px 22px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.kbh-ai-summary-action {
    min-width: 118px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 16px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.kbh-ai-summary-action-primary {
    border-color: #2563eb;
    color: #ffffff;
    background: #2563eb;
}

.kbh-ai-summary-action-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.kbh-ai-summary-action-audio {
    border-color: #bae6fd;
    color: #075985;
    background: #f0f9ff;
}

.kbh-ai-summary-action-image {
    border-color: #ddd6fe;
    color: #5b21b6;
    background: #f5f3ff;
}

.kbh-ai-summary-action-quiz {
    border-color: #bbf7d0;
    color: #166534;
    background: #f0fdf4;
}

.kbh-ai-summary-action:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.kbh-ai-summary-action.kbh-ai-summary-action-loading:disabled {
    cursor: wait;
}

.kbh-ai-summary-done {
    min-width: 92px;
    border: 0;
    border-radius: 10px;
    padding: 9px 18px;
    color: #ffffff;
    background: #0f172a;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 576px) {
    .kbh-ai-summary-modal {
        padding: 10px;
    }

    .kbh-ai-summary-dialog {
        width: 100%;
        max-height: 92vh;
        border-radius: 17px;
    }

    .kbh-ai-summary-header,
    .kbh-ai-summary-body,
    .kbh-ai-summary-footer {
        padding-right: 16px;
        padding-left: 16px;
    }

    .kbh-ai-summary-footer button {
        flex: 1 1 130px;
    }

    .kbh-ai-assistant-tabs {
        grid-template-columns: 1fr;
    }

    .kbh-ai-assistant-tab {
        min-height: 40px;
    }

    .kbh-ai-assistant-actions .kbh-ai-summary-action {
        flex: 1 1 150px;
    }

    .kbh-ai-summary-quiz-options {
        grid-template-columns: 1fr;
    }
}
