/* Base Container - Responsive */
.wp-openai-chat-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: #f9f9f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 100%;
    width: 100%;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Desktop - 1920px and above */
@media (min-width: 1920px) {
    .wp-openai-chat-container {
        max-width: 1200px;
        padding: 25px;
    }
}

/* Desktop - Standard (1280px - 1919px) */
@media (min-width: 1280px) and (max-width: 1919px) {
    .wp-openai-chat-container {
        max-width: 1000px;
        padding: 20px;
    }
}

/* Laptop - 14" 1280x1024 and similar */
@media (min-width: 768px) and (max-width: 1279px) {
    .wp-openai-chat-container {
        max-width: 95%;
        padding: 18px;
    }
}

/* Mobile - Tablets */
@media (min-width: 481px) and (max-width: 767px) {
    .wp-openai-chat-container {
        max-width: 100%;
        padding: 10px;
        border-radius: 6px;
    }
}

/* Mobile - Phones */
@media (max-width: 480px) {
    .wp-openai-chat-container {
        padding: 10px;
        border-radius: 4px;
        margin: 10px auto;
    }
}

.wp-openai-messages {
    margin-bottom: 20px;
    max-height: 1200px;
    overflow-y: auto;
    padding: 10px;
    background: white;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    order: 2;
}

.wp-openai-input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    order: 1;
    margin-bottom: 15px;
}

.wp-openai-loading {
    margin-top: 10px;
    text-align: center;
    color: #666;
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
    order: 3;
}

.wp-openai-message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 6px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.assistant-message {
    background: #f5f5f5;
    border-left: 4px solid #4caf50;
}

.assistant-message.contact-sent {
    background: #e8f5e9;
    border-left: 4px solid #2e7d32;
}

.contact-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    background: #4caf50;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Media Results Styles - Fully Responsive */
.media-results {
    margin-top: 15px;
    display: grid;
    gap: 15px;
}

/* Desktop Large */
@media (min-width: 1280px) {
    .media-results {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Laptop / Tablet Landscape */
@media (min-width: 768px) and (max-width: 1279px) {
    .media-results {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 12px;
    }
}

/* Tablet Portrait */
@media (min-width: 481px) and (max-width: 767px) {
    .media-results {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .media-results {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.media-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    background: white;
    transition: box-shadow 0.2s;
}

.media-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.media-link {
    text-decoration: none;
    color: inherit;
}

.media-thumbnail {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.media-icon {
    font-size: 48px;
    display: block;
    text-align: center;
    padding: 30px 0;
}

.media-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.media-title {
    font-weight: 600;
    font-size: 14px;
    color: #2196f3;
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-title:hover {
    text-decoration: underline;
}

.media-size {
    font-size: 12px;
    color: #666;
}

.pdf-link .media-icon {
    color: #d32f2f;
}

.file-link .media-icon {
    color: #757575;
}

.wp-openai-message strong {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

.wp-openai-message p {
    margin: 0;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.wp-openai-input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.wp-openai-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
}

.wp-openai-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.wp-openai-send {
    padding: 12px 24px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.wp-openai-send:hover {
    background: #1976d2;
}

.wp-openai-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.wp-openai-loading {
    margin-top: 10px;
    text-align: center;
    color: #666;
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}

.wp-openai-loading {
    margin-top: 10px;
    text-align: center;
    color: #666;
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
    order: 3;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Scroll behavior - always at bottom */
.wp-openai-messages {
    scroll-behavior: smooth;
}

/* Responsive design */
@media (max-width: 600px) {
    .wp-openai-chat-container {
        padding: 10px;
    }
    
    .wp-openai-input-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .wp-openai-send {
        width: 100%;
        padding: 12px;
    }
    
    .wp-openai-input {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 64px; /* Better touch target */
        width: 100%;
    }
    
    .wp-openai-message {
        font-size: 14px;
    }
    
    .contact-badge {
        font-size: 11px;
        padding: 3px 10px;
    }
}