/**
 * Columbia Estates AI Platform - Agent Side Panel Styles
 * Full-height side panel with site squeeze and voice support
 * Includes markdown rendering, acknowledgements, and image preview
 * Mobile-optimised with touch-friendly controls and dynamic viewport handling
 *
 * @version 1.5.2
 */

/* CSS Custom Properties for Columbia Brand */
:root {
    --columbia-purple: #654796;
    --columbia-purple-dark: #553986;
    --columbia-blue: #00b9f2;
    --columbia-green: #8DA13E;
    --columbia-indigo: #201747;
    --columbia-panel-width: 420px;
    --columbia-panel-collapsed: 0px;
}

/* Site Squeeze - Body adjustment when panel is open */
body.columbia-panel-open {
    margin-right: var(--columbia-panel-width) !important;
    transition: margin-right 0.3s ease-in-out;
}

body.columbia-panel-open #wpadminbar {
    right: var(--columbia-panel-width) !important;
    transition: right 0.3s ease-in-out;
}

/* Agent Widget Container */
.columbia-agent-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    z-index: 999999;
}

/* Toggle Button - Fixed bottom right */
.columbia-agent-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--columbia-purple), var(--columbia-blue));
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(101, 71, 150, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s;
    z-index: 999998;
}

.columbia-agent-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(101, 71, 150, 0.5);
}

.columbia-agent-toggle svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

body.columbia-panel-open .columbia-agent-toggle {
    opacity: 0;
    pointer-events: none;
}

/* Side Panel - Full height right panel */
.columbia-agent-panel {
    position: fixed;
    top: 0;
    right: calc(-1 * var(--columbia-panel-width));
    width: var(--columbia-panel-width);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    max-height: 100vh;
    max-height: 100dvh;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease-in-out;
    z-index: 999999;
    overflow: hidden; /* Prevent panel overflow */
}

body.columbia-panel-open .columbia-agent-panel {
    right: 0;
}

/* Panel Header */
.columbia-panel-header {
    background: linear-gradient(135deg, var(--columbia-indigo), var(--columbia-purple));
    color: #fff;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.columbia-panel-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.columbia-panel-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.columbia-panel-avatar svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

.columbia-panel-title h3 {
    margin: 0 0 2px 0;
    font-size: 18px;
    font-weight: 600;
}

.columbia-panel-title span {
    font-size: 12px;
    opacity: 0.85;
}

.columbia-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.columbia-mute-btn,
.columbia-panel-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.columbia-mute-btn:hover,
.columbia-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.columbia-mute-btn svg,
.columbia-panel-close svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.columbia-mute-btn.muted {
    background: rgba(220, 38, 38, 0.3);
}

.columbia-mute-btn.muted:hover {
    background: rgba(220, 38, 38, 0.5);
}

/* Mode Indicator */
.columbia-mode-indicator {
    padding: 8px 20px;
    background: #f0f4f8;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    flex-shrink: 0;
}

.columbia-mode-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.columbia-mode-dot.ai {
    background: var(--columbia-green);
    animation: pulse 2s infinite;
}

.columbia-mode-dot.voice {
    background: var(--columbia-blue);
    animation: pulse 1s infinite;
}

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

/* Messages Container */
.columbia-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.columbia-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    animation: messageSlide 0.3s ease-out;
}

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

.columbia-message.agent {
    align-items: flex-start;
}

.columbia-message.user {
    align-items: flex-end;
}

.columbia-message .bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.columbia-message.agent .bubble {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.columbia-message.user .bubble {
    background: linear-gradient(135deg, var(--columbia-purple), var(--columbia-purple-dark));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.columbia-message .timestamp {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}

/* Markdown Rendering Styles */
.columbia-message .bubble h1,
.columbia-message .bubble h2,
.columbia-message .bubble h3,
.columbia-message .bubble h4,
.columbia-message .bubble h5,
.columbia-message .bubble h6 {
    margin: 0.5em 0 0.3em 0;
    line-height: 1.3;
    font-weight: 600;
}

.columbia-message .bubble h1 { font-size: 1.3em; }
.columbia-message .bubble h2 { font-size: 1.2em; }
.columbia-message .bubble h3 { font-size: 1.1em; }

.columbia-message .bubble p {
    margin: 0 0 0.5em 0;
}

.columbia-message .bubble p:last-child {
    margin-bottom: 0;
}

.columbia-message .bubble ul,
.columbia-message .bubble ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.columbia-message .bubble li {
    margin-bottom: 0.25em;
}

.columbia-message .bubble code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
}

.columbia-message.user .bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.columbia-message .bubble pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5em 0;
    font-size: 0.85em;
}

.columbia-message .bubble pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.columbia-message .bubble blockquote {
    border-left: 3px solid var(--columbia-purple);
    padding-left: 12px;
    margin: 0.5em 0;
    color: #64748b;
    font-style: italic;
}

.columbia-message.user .bubble blockquote {
    border-left-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.9);
}

.columbia-message .bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
    font-size: 0.9em;
}

.columbia-message .bubble th,
.columbia-message .bubble td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    text-align: left;
}

.columbia-message .bubble th {
    background: #f1f5f9;
    font-weight: 600;
}

.columbia-message.user .bubble th,
.columbia-message.user .bubble td {
    border-color: rgba(255, 255, 255, 0.3);
}

.columbia-message.user .bubble th {
    background: rgba(255, 255, 255, 0.1);
}

.columbia-message .bubble hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1em 0;
}

.columbia-message .bubble a {
    color: var(--columbia-blue);
    text-decoration: none;
}

.columbia-message .bubble a:hover {
    text-decoration: underline;
}

.columbia-message.user .bubble a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: underline;
}

.columbia-message .bubble strong,
.columbia-message .bubble b {
    font-weight: 600;
}

.columbia-message .bubble em,
.columbia-message .bubble i {
    font-style: italic;
}

/* Typing Indicator */
.columbia-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.columbia-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.columbia-typing span:nth-child(1) { animation-delay: -0.32s; }
.columbia-typing span:nth-child(2) { animation-delay: -0.16s; }
.columbia-typing span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.columbia-panel-input {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.columbia-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 24px;
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.columbia-input-wrapper:focus-within {
    background: #fff;
    border-color: var(--columbia-purple);
}

.columbia-panel-input input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
}

.columbia-panel-input input::placeholder {
    color: #94a3b8;
}

/* Voice Button */
.columbia-voice-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    margin-right: 4px;
}

.columbia-voice-btn:hover {
    background: rgba(101, 71, 150, 0.1);
}

.columbia-voice-btn svg {
    width: 22px;
    height: 22px;
    fill: #64748b;
    transition: fill 0.2s;
}

.columbia-voice-btn.listening {
    background: rgba(220, 38, 38, 0.1);
}

.columbia-voice-btn.listening svg {
    fill: #dc2626;
    animation: voicePulse 1s infinite;
}

@keyframes voicePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Send Button */
.columbia-send-btn {
    background: linear-gradient(135deg, var(--columbia-purple), var(--columbia-blue));
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.columbia-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(101, 71, 150, 0.3);
}

.columbia-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.columbia-send-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Voice Status Bar */
.columbia-voice-status {
    padding: 10px 20px;
    background: linear-gradient(90deg, var(--columbia-blue), var(--columbia-purple));
    color: #fff;
    font-size: 13px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
}

.columbia-voice-status.active {
    display: flex;
}

.columbia-voice-status.listening {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.columbia-voice-status.speaking {
    background: linear-gradient(90deg, var(--columbia-green), #a3be3f);
}

.columbia-voice-waveform {
    display: flex;
    gap: 3px;
    align-items: center;
}

.columbia-voice-waveform span {
    width: 3px;
    height: 16px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    animation: waveform 0.5s infinite ease-in-out alternate;
}

.columbia-voice-waveform span:nth-child(1) { animation-delay: 0s; height: 8px; }
.columbia-voice-waveform span:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.columbia-voice-waveform span:nth-child(3) { animation-delay: 0.2s; height: 12px; }
.columbia-voice-waveform span:nth-child(4) { animation-delay: 0.3s; height: 20px; }
.columbia-voice-waveform span:nth-child(5) { animation-delay: 0.4s; height: 14px; }

@keyframes waveform {
    from { transform: scaleY(0.5); }
    to { transform: scaleY(1); }
}

/* Acknowledgement Notifications */
.columbia-acknowledgement {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 12px;
    font-size: 13px;
    animation: slideIn 0.3s ease-out;
}

.columbia-acknowledgement.success {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border: 1px solid #86efac;
    color: #166534;
}

.columbia-acknowledgement.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.columbia-ack-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.columbia-acknowledgement.success .columbia-ack-icon svg {
    fill: #16a34a;
}

.columbia-acknowledgement.error .columbia-ack-icon svg {
    fill: #dc2626;
}

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

/* Image Preview Area */
.columbia-image-preview {
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.columbia-image-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 12px;
    color: #64748b;
}

.columbia-clear-images {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.columbia-clear-images:hover {
    background: #fee2e2;
}

.columbia-image-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.columbia-image-item {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
}

.columbia-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.columbia-video-thumb {
    width: 100%;
    height: 100%;
    background: #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.columbia-video-thumb svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.columbia-remove-image {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #dc2626;
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.columbia-remove-image svg {
    width: 12px;
    height: 12px;
    fill: #fff;
}

/* Message Images */
.columbia-message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.columbia-message-images img {
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
    object-fit: cover;
}

.columbia-video-indicator {
    background: #1e1e1e;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
}

/* Camera Button */
.columbia-camera-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    margin-left: 4px;
}

.columbia-camera-btn:hover {
    background: rgba(101, 71, 150, 0.1);
}

.columbia-camera-btn svg {
    width: 22px;
    height: 22px;
    fill: #64748b;
}

/* Quick Actions */
.columbia-quick-actions {
    padding: 12px 20px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.columbia-quick-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.columbia-quick-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.columbia-quick-btn:hover {
    background: var(--columbia-purple);
    border-color: var(--columbia-purple);
    color: #fff;
}

/* Priority buttons (emergency) */
.columbia-quick-btn.priority-urgent {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.columbia-quick-btn.priority-urgent:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

/* Footer */
.columbia-panel-footer {
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #94a3b8;
    flex-shrink: 0;
}

.columbia-panel-footer a {
    color: var(--columbia-purple);
    text-decoration: none;
}

.columbia-panel-footer a:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    :root {
        --columbia-panel-width: 100vw;
    }

    body.columbia-panel-open {
        overflow: hidden;
        margin-right: 0 !important;
        position: fixed;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
    }

    .columbia-agent-panel {
        width: 100vw;
        width: 100dvw;
        right: -100vw;
        border-radius: 0;
        /* Mobile viewport handling - multiple fallbacks for cross-browser support */
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100); /* JS-calculated fallback */
        height: 100dvh; /* Dynamic viewport for modern browsers */
        height: -webkit-fill-available; /* iOS Safari fallback */
        max-height: 100vh;
        max-height: calc(var(--vh, 1vh) * 100);
        max-height: 100dvh;
        max-height: -webkit-fill-available;
        /* Safe area for notched phones */
        padding-bottom: env(safe-area-inset-bottom, 0);
        box-sizing: border-box;
        /* Ensure content doesn't overflow */
        overflow: hidden;
    }

    body.columbia-panel-open .columbia-agent-panel {
        right: 0;
    }

    /* Ensure messages area flexes properly */
    .columbia-panel-messages {
        flex: 1 1 auto;
        min-height: 0; /* Critical for flex shrinking */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Keep input always visible */
    .columbia-panel-input {
        flex-shrink: 0;
        position: relative;
        z-index: 10;
        background: #fff;
        /* Safe area padding for home indicator */
        padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    }

    /* Quick actions should shrink if needed */
    .columbia-quick-actions {
        flex-shrink: 0;
        max-height: 80px;
        overflow-x: auto;
    }

    /* Footer compact on mobile */
    .columbia-panel-footer {
        flex-shrink: 0;
    }

    .columbia-agent-toggle {
        bottom: 16px;
        right: 16px;
        width: 60px;
        height: 60px;
    }

    .columbia-agent-toggle svg {
        width: 26px;
        height: 26px;
    }

    /* Larger touch targets for mobile */
    .columbia-panel-header {
        padding: 16px;
    }

    .columbia-panel-avatar {
        width: 44px;
        height: 44px;
    }

    .columbia-panel-title h3 {
        font-size: 16px;
    }

    .columbia-mute-btn,
    .columbia-panel-close {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }

    .columbia-panel-messages {
        padding: 16px;
    }

    .columbia-message .bubble {
        max-width: 90%;
        padding: 14px 16px;
        font-size: 15px;
    }

    /* Mobile-optimised quick actions */
    .columbia-quick-actions {
        padding: 12px 16px;
        gap: 10px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .columbia-quick-actions::-webkit-scrollbar {
        display: none;
    }

    .columbia-quick-btn {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
        min-height: 44px;
    }

    /* Mobile input area */
    .columbia-panel-input {
        padding: 12px 16px;
        gap: 8px;
    }

    .columbia-panel-input input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .columbia-voice-btn {
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }

    .columbia-voice-btn svg {
        width: 24px;
        height: 24px;
    }

    .columbia-send-btn {
        width: 52px;
        height: 52px;
    }

    .columbia-send-btn svg {
        width: 24px;
        height: 24px;
    }

    .columbia-camera-btn {
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }

    .columbia-camera-btn svg {
        width: 24px;
        height: 24px;
    }

    /* Mobile image preview */
    .columbia-image-preview {
        padding: 10px 16px;
    }

    .columbia-image-item {
        width: 72px;
        height: 72px;
    }

    /* Mobile acknowledgement */
    .columbia-acknowledgement {
        padding: 14px 16px;
        font-size: 14px;
    }

    /* Mobile footer */
    .columbia-panel-footer {
        padding: 10px 16px;
        font-size: 12px;
    }

    /* Mobile markdown tables - horizontal scroll */
    .columbia-message .bubble table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Swipe indicator on header */
    .columbia-panel-header::after {
        content: '';
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }
}

/* Small mobile devices */
@media (max-width: 375px) {
    .columbia-quick-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .columbia-message .bubble {
        max-width: 95%;
        padding: 12px 14px;
    }

    .columbia-image-item {
        width: 56px;
        height: 56px;
    }
}

/* Admin bar adjustment */
body.admin-bar .columbia-agent-panel {
    top: 32px;
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
}

@media (max-width: 782px) {
    body.admin-bar .columbia-agent-panel {
        top: 46px;
        height: calc(100vh - 46px);
        height: calc(100dvh - 46px);
        height: calc(-webkit-fill-available - 46px);
    }
}

/* Extra small screens - ensure everything fits */
@media (max-height: 600px) {
    .columbia-panel-header {
        padding: 12px 16px;
    }

    .columbia-panel-avatar {
        width: 36px;
        height: 36px;
    }

    .columbia-panel-title h3 {
        font-size: 14px;
    }

    .columbia-panel-title span {
        font-size: 10px;
    }

    .columbia-mute-btn,
    .columbia-panel-close {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .columbia-mode-indicator {
        padding: 6px 16px;
        font-size: 11px;
    }

    .columbia-panel-messages {
        padding: 12px;
    }

    .columbia-message {
        margin-bottom: 10px;
    }

    .columbia-message .bubble {
        padding: 10px 12px;
        font-size: 13px;
    }

    .columbia-quick-actions {
        padding: 8px 12px;
        max-height: 60px;
    }

    .columbia-quick-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-height: 36px;
    }

    .columbia-panel-input {
        padding: 10px 12px;
    }

    .columbia-panel-input input {
        padding: 10px 12px;
        font-size: 15px;
    }

    .columbia-send-btn {
        width: 44px;
        height: 44px;
    }

    .columbia-panel-footer {
        padding: 8px 12px;
        font-size: 10px;
    }
}

/* Print - hide panel */
@media print {
    .columbia-agent-widget,
    .columbia-agent-toggle,
    .columbia-agent-panel {
        display: none !important;
    }
}
