/* ChatGPT AI Search Client - Frontend Styles */

.chatgpt-ai-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
}

.chatgpt-ai-input-row {
    position: relative;
}

#chatgpt-ai-input,
.chatgpt-ai-input {
    width: 100%;
    padding: 14px 50px 14px 16px;
    border-radius: 999px;
    border: 1px solid #d0d0d0;
    font-size: 15px;
    background: #f7f7f8;
    transition: all 0.18s ease;
    box-sizing: border-box;
}

#chatgpt-ai-input:focus,
.chatgpt-ai-input:focus {
    outline: none;
    border-color: #999;
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.chatgpt-ai-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: none;
}

.chatgpt-ai-clear-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #555;
}

.chatgpt-ai-results {
    margin-top: 10px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08);
    padding: 14px 16px;
    display: none;
    max-height: 70vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.chatgpt-ai-results.visible {
    display: block;
}

.chatgpt-ai-loading {
    font-size: 14px;
    color: #555;
    position: relative;
    padding-left: 24px;
}

.chatgpt-ai-loading::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border-radius: 999px;
    border: 2px solid #999;
    border-top-color: transparent;
    animation: chatgpt-ai-spin 0.7s linear infinite;
}

@keyframes chatgpt-ai-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.chatgpt-ai-error {
    font-size: 14px;
    color: #c0392b;
}

/* Answer - Compact */
.chatgpt-ai-answer {
    font-size: 14px;
    line-height: 1.55;
    color: #333;
    margin-bottom: 12px;
}

.chatgpt-ai-answer p {
    margin: 0 0 8px 0;
}

.chatgpt-ai-answer p:last-child {
    margin-bottom: 0;
}

/* Section titles */
.chatgpt-ai-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* Sections */
.chatgpt-ai-sources,
.chatgpt-ai-doctors {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

/* ===== 3-COLUMN GRID - HORIZONTAL CARDS ===== */
.chatgpt-ai-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
}

/* Base card style - FORCE horizontal layout */
.chatgpt-ai-grid-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    background: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none !important;
    color: inherit;
    transition: all 0.2s ease;
    min-width: 0;
    padding: 10px !important;
    gap: 10px !important;
}

.chatgpt-ai-grid-item:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Service thumbnail - small square (NOT full width) */
.chatgpt-ai-grid-thumb {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    padding-top: 0 !important;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-color: #e0e0e0;
    flex-shrink: 0 !important;
}

.chatgpt-ai-grid-info {
    flex: 1;
    min-width: 0;
}

.chatgpt-ai-grid-title {
    font-size: 13px !important;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0 !important;
}

.chatgpt-ai-grid-subtitle {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
    padding: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== DOCTOR CARDS - Circle thumbnail ===== */
.chatgpt-ai-doctor-item .chatgpt-ai-doctor-thumb {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    border-radius: 50% !important;
    background-size: cover;
    background-position: center;
    background-color: #e0e0e0;
    flex-shrink: 0;
}

.chatgpt-ai-doctor-item .chatgpt-ai-grid-info {
    flex: 1;
    min-width: 0;
}

.chatgpt-ai-doctor-item .chatgpt-ai-grid-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chatgpt-ai-doctor-item .chatgpt-ai-grid-subtitle {
    font-size: 11px;
    margin-top: 2px;
}

/* CTA Buttons - Multiple, same row, same size by default */
.chatgpt-ai-cta-wrap {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.chatgpt-ai-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    min-width: 140px;
    background: #0066cc;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.chatgpt-ai-cta:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

/* CTA Large (for CTA-only responses) */
.chatgpt-ai-cta-large {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.chatgpt-ai-cta-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ===== FLOATING BUTTON ===== */
.chatgpt-ai-floating-btn {
    position: fixed;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #0066cc;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 99998;
}

.chatgpt-ai-floating-btn:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

.chatgpt-ai-floating-btn svg {
    width: 24px;
    height: 24px;
}

.chatgpt-ai-floating-btn img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Floating button positions - bottom only */
.chatgpt-ai-floating-btn.pos-bottom-left {
    bottom: 20px;
    left: 20px;
}

.chatgpt-ai-floating-btn.pos-bottom-center {
    bottom: 20px;
    left: 50%;
    margin-left: -28px;
}

.chatgpt-ai-floating-btn.pos-bottom-right {
    bottom: 20px;
    right: 20px;
}

/* ===== FLOATING PANEL - ALWAYS CENTERED ===== */
.chatgpt-ai-floating-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.chatgpt-ai-floating-overlay.open {
    opacity: 1;
    visibility: visible;
}

.chatgpt-ai-floating-panel {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    width: 500px;
    max-width: 100%;
}

.chatgpt-ai-floating-overlay.open .chatgpt-ai-floating-panel {
    opacity: 1;
    transform: scale(1);
}

.chatgpt-ai-floating-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}

.chatgpt-ai-floating-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}

.chatgpt-ai-floating-close:hover {
    background: #e0e0e0;
    color: #333;
}

.chatgpt-ai-floating-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
}

.chatgpt-ai-floating-wrapper {
    max-width: none;
    margin: 0;
}

.chatgpt-ai-floating-wrapper .chatgpt-ai-input-row {
    margin-bottom: 0;
}

.chatgpt-ai-floating-results {
    margin-top: 12px;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    max-height: none;
    overflow: visible;
}

.chatgpt-ai-floating-results.visible {
    display: block;
}

/* RTL Support */
[dir="rtl"] .chatgpt-ai-clear-btn {
    right: auto;
    left: 8px;
}

[dir="rtl"] #chatgpt-ai-input,
[dir="rtl"] .chatgpt-ai-input {
    padding: 14px 16px 14px 50px;
}

[dir="rtl"] .chatgpt-ai-loading {
    padding-left: 0;
    padding-right: 24px;
}

[dir="rtl"] .chatgpt-ai-loading::before {
    left: auto;
    right: 3px;
}

[dir="rtl"] .chatgpt-ai-doctor-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .chatgpt-ai-doctor-item .chatgpt-ai-grid-info {
    text-align: right;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .chatgpt-ai-floating-panel {
        width: 90vw;
        max-height: 80vh;
    }
    
    .chatgpt-ai-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    .chatgpt-ai-grid-item {
        padding: 8px !important;
        gap: 8px !important;
    }
    
    .chatgpt-ai-grid-thumb,
    .chatgpt-ai-doctor-thumb {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
    }
    
    .chatgpt-ai-grid-title {
        font-size: 11px !important;
    }
    
    .chatgpt-ai-grid-subtitle {
        font-size: 10px !important;
    }
}

@media (max-width: 500px) {
    .chatgpt-ai-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    #chatgpt-ai-input,
    .chatgpt-ai-input {
        font-size: 16px;
    }
}
