/**
 * Frontend Chat Interface Styles - ChatGPT-inspired design
 * N8N Chat Interface Pro
 */

/* Container */
.n8n-chat-container {
    display: flex;
    flex-direction: column;
    background: var(--n8n-bg-primary, #ffffff);
    border: 1px solid var(--n8n-border-color, #d9d9e3);
    border-radius: var(--n8n-border-radius, 8px);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: all 0.3s ease;
}

/* Container modes: normal, expanded, fullscreen */
.n8n-chat-container[data-mode="normal"] {
    position: relative;
}

.n8n-chat-container[data-mode="expanded"] {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100vw - 40px) !important;
    height: 80vh !important;
    max-width: 1200px;
    z-index: 10000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.n8n-chat-container[data-mode="fullscreen"] {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 10001;
    border-radius: 0;
    max-width: none;
    border: none;
}

/* Backdrop for expanded/fullscreen modes */
.n8n-chat-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.n8n-chat-backdrop.active {
    display: block;
}

/* Header */
.n8n-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--n8n-primary-color, #10a37f);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.n8n-chat-header-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.n8n-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.n8n-chat-header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

/* Font Size Controls */
.n8n-font-size-control {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.n8n-font-size-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.n8n-font-size-btn[data-size="small"] {
    font-size: 12px;
}

.n8n-font-size-btn[data-size="medium"] {
    font-size: 14px;
}

.n8n-font-size-btn[data-size="large"] {
    font-size: 16px;
}

.n8n-font-size-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.n8n-font-size-btn.active {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Window Control Buttons */
.n8n-window-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.n8n-window-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
}

.n8n-window-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.n8n-window-btn:active {
    transform: scale(0.95);
}

.n8n-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #46b450;
    animation: pulse 2s infinite;
}

.n8n-status-indicator[data-status="processing"] {
    background: #f0ad4e;
}

.n8n-status-indicator[data-status="error"] {
    background: #dc3232;
}

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

/* Messages Area Wrapper */
.n8n-chat-messages-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    overflow: hidden;
}

/* Progress Indicator Sidebar */
.n8n-chat-progress-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: rgba(0, 0, 0, 0.02);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 5;
    padding: 16px 0;
    overflow-y: auto;
}

.n8n-chat-progress-sidebar::-webkit-scrollbar {
    width: 4px;
}

.n8n-chat-progress-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.n8n-progress-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.n8n-progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #E5E7EB;
    border: 2px solid #D1D5DB;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.n8n-progress-dot:hover {
    transform: scale(1.3);
}

.n8n-progress-dot.completed {
    background: #10B981;
    border-color: #059669;
}

.n8n-progress-dot.active {
    background: var(--n8n-primary-color, #10a37f);
    border-color: var(--n8n-secondary-color, #19c37d);
}

.n8n-progress-dot.current {
    width: 16px;
    height: 16px;
}

.n8n-progress-dot .n8n-pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 2px solid var(--n8n-primary-color, #10a37f);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

.n8n-progress-line {
    width: 2px;
    height: 20px;
    background: #E5E7EB;
    flex-shrink: 0;
}

.n8n-progress-line.completed {
    background: #10B981;
}

.n8n-progress-line.active {
    background: linear-gradient(to bottom, #10B981, var(--n8n-primary-color, #10a37f));
}

/* Tooltip on dot hover */
.n8n-progress-dot::after {
    content: attr(data-time);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 12px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.n8n-progress-dot:hover::after {
    opacity: 1;
}

/* Messages Area */
.n8n-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-left: 60px; /* Make room for progress sidebar */
    background: var(--n8n-bg-primary, #ffffff);
    scroll-behavior: smooth;
}

.n8n-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.n8n-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.n8n-chat-messages::-webkit-scrollbar-thumb {
    background: var(--n8n-border-color, #d9d9e3);
    border-radius: 4px;
}

.n8n-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

/* Scroll to Bottom Button */
.n8n-scroll-to-bottom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--n8n-primary-color, #10a37f);
    color: white;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 10;
    font-size: 20px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.n8n-scroll-to-bottom.visible {
    display: flex;
}

.n8n-scroll-to-bottom:hover {
    background: var(--n8n-secondary-color, #19c37d);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.n8n-scroll-to-bottom:active {
    transform: translateY(0);
}

/* Welcome Message */
.n8n-chat-welcome {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--n8n-bg-secondary, #f7f7f8);
    border-radius: var(--n8n-border-radius, 8px);
    margin-bottom: 20px;
}

.n8n-chat-welcome p {
    margin: 0;
    color: var(--n8n-text-primary, #353740);
    line-height: 1.6;
}

/* Message Bubbles */
.n8n-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
    position: relative;
    padding: 8px;
    margin-left: -8px;
    margin-right: -8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.n8n-message:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.n8n-message.highlight {
    background-color: rgba(16, 163, 127, 0.1);
    animation: highlightFade 2s ease-out;
}

@keyframes highlightFade {
    0% {
        background-color: rgba(16, 163, 127, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

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

.n8n-message.n8n-user-message {
    flex-direction: row-reverse;
}

.n8n-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.n8n-user-avatar {
    background: var(--n8n-primary-color, #10a37f);
    color: white;
}

.n8n-bot-avatar {
    background: var(--n8n-bg-secondary, #f7f7f8);
    color: var(--n8n-text-primary, #353740);
}

.n8n-chat-avatar svg {
    width: 20px;
    height: 20px;
}

.n8n-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: var(--n8n-border-radius, 8px);
    line-height: 1.6;
    word-wrap: break-word;
}

.n8n-user-message .n8n-message-content {
    background: var(--n8n-primary-color, #10a37f);
    color: white;
    border-bottom-right-radius: 4px;
}

.n8n-bot-message .n8n-message-content {
    background: var(--n8n-bg-secondary, #f7f7f8);
    color: var(--n8n-text-primary, #353740);
    border-bottom-left-radius: 4px;
}

.n8n-message-timestamp {
    font-size: 11px;
    color: var(--n8n-text-secondary, #6e6e80);
    margin-top: 4px;
}

/* Message Tooltip */
.n8n-message-tooltip {
    position: absolute;
    top: -70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, top 0.2s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.n8n-message:hover .n8n-message-tooltip {
    opacity: 1;
    top: -80px;
}

.n8n-message-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.n8n-tooltip-time {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.n8n-tooltip-date {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.n8n-tooltip-duration {
    font-size: 11px;
    color: #10B981;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Different positioning for user vs bot messages */
.n8n-user-message .n8n-message-tooltip {
    left: auto;
    right: 16px;
    transform: none;
}

.n8n-user-message .n8n-message-tooltip::after {
    left: auto;
    right: 20px;
    transform: none;
}

.n8n-bot-message .n8n-message-tooltip {
    left: 60px;
    transform: none;
}

.n8n-bot-message .n8n-message-tooltip::after {
    left: 20px;
    transform: none;
}

/* Font Size Variations for Messages */
.n8n-chat-messages.font-small {
    font-size: 13px;
    line-height: 1.5;
}

.n8n-chat-messages.font-small .n8n-message-content {
    font-size: 13px;
}

.n8n-chat-messages.font-small .n8n-message-timestamp {
    font-size: 10px;
}

.n8n-chat-messages.font-medium {
    font-size: 15px;
    line-height: 1.6;
}

.n8n-chat-messages.font-medium .n8n-message-content {
    font-size: 15px;
}

.n8n-chat-messages.font-medium .n8n-message-timestamp {
    font-size: 11px;
}

.n8n-chat-messages.font-large {
    font-size: 17px;
    line-height: 1.7;
}

.n8n-chat-messages.font-large .n8n-message-content {
    font-size: 17px;
}

.n8n-chat-messages.font-large .n8n-message-timestamp {
    font-size: 12px;
}

/* Typing Indicator */
.n8n-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--n8n-bg-secondary, #f7f7f8);
    border-radius: var(--n8n-border-radius, 8px);
    width: fit-content;
    margin-bottom: 20px;
}

.n8n-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--n8n-text-secondary, #6e6e80);
    animation: bounce 1.4s infinite ease-in-out both;
}

.n8n-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.n8n-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Input Area */
.n8n-chat-input-area {
    padding: 16px 20px;
    background: var(--n8n-bg-primary, #ffffff);
    border-top: 1px solid var(--n8n-border-color, #d9d9e3);
    position: relative;
}

/* Drag & Drop Overlay */
.n8n-drag-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 163, 127, 0.95);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.n8n-drag-drop-content {
    text-align: center;
    color: white;
}

.n8n-drag-drop-content svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    animation: bounce-slow 2s infinite;
}

@keyframes bounce-slow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.n8n-drag-drop-content p {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* File Attachments Container */
.n8n-file-attachments {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--n8n-bg-secondary, #f7f7f8);
    border: 1px solid var(--n8n-border-color, #d9d9e3);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.n8n-file-attachments::-webkit-scrollbar {
    width: 6px;
}

.n8n-file-attachments::-webkit-scrollbar-track {
    background: transparent;
}

.n8n-file-attachments::-webkit-scrollbar-thumb {
    background: var(--n8n-border-color, #d9d9e3);
    border-radius: 3px;
}

/* File Item */
.n8n-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: white;
    border: 1px solid var(--n8n-border-color, #d9d9e3);
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.n8n-file-item:last-child {
    margin-bottom: 0;
}

.n8n-file-item.uploading {
    border-color: var(--n8n-primary-color, #10a37f);
    background: rgba(16, 163, 127, 0.02);
}

.n8n-file-item.uploaded {
    border-color: #46b450;
    background: rgba(70, 180, 80, 0.02);
}

.n8n-file-item.error {
    border-color: #dc3232;
    background: rgba(220, 50, 50, 0.02);
}

.n8n-file-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.n8n-file-details {
    flex: 1;
    min-width: 0;
}

.n8n-file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--n8n-text-primary, #353740);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.n8n-file-size {
    font-size: 12px;
    color: var(--n8n-text-secondary, #6e6e80);
    margin-top: 2px;
}

.n8n-file-progress {
    margin-top: 6px;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.n8n-file-progress-bar {
    height: 100%;
    background: var(--n8n-primary-color, #10a37f);
    width: 0%;
    transition: width 0.3s ease;
}

.n8n-file-status {
    font-size: 18px;
    flex-shrink: 0;
}

.n8n-file-remove {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--n8n-text-secondary, #6e6e80);
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.n8n-file-remove:hover {
    background: rgba(220, 50, 50, 0.1);
    color: #dc3232;
}

.n8n-file-remove svg {
    width: 16px;
    height: 16px;
}

/* File Button */
.n8n-file-button {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--n8n-text-secondary, #6e6e80);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.n8n-file-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--n8n-primary-color, #10a37f);
}

.n8n-file-button svg {
    width: 20px;
    height: 20px;
}

/* Attachment Indicator in Messages */
.n8n-attachment-indicator {
    display: inline-block;
    margin-right: 6px;
    font-size: 14px;
}

.n8n-chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--n8n-bg-secondary, #f7f7f8);
    border: 1px solid var(--n8n-border-color, #d9d9e3);
    border-radius: 12px;
    padding: 8px 12px;
    transition: border-color 0.2s, max-height 0.3s;
    position: relative;
}

.n8n-chat-input-wrapper:focus-within {
    border-color: var(--n8n-primary-color, #10a37f);
}

/* Input Controls on the Right */
.n8n-input-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

/* Textarea Expand Button */
.n8n-textarea-expand-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--n8n-text-secondary, #6e6e80);
    z-index: 5;
}

.n8n-textarea-expand-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--n8n-text-primary, #353740);
}

/* Expanded textarea state */
.n8n-chat-input-wrapper.expanded {
    max-height: 400px;
}

.n8n-chat-input-wrapper.expanded .n8n-chat-input {
    max-height: 380px;
}

.n8n-voice-button {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--n8n-text-secondary, #6e6e80);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.n8n-voice-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--n8n-primary-color, #10a37f);
}

.n8n-voice-button.recording {
    background: rgba(239, 68, 68, 0.15);
    color: #dc3232;
    animation: pulse-red 1.5s infinite;
    pointer-events: none;
    opacity: 0.8;
}

@keyframes pulse-red {
    0%, 100% {
        background: rgba(239, 68, 68, 0.15);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        background: rgba(239, 68, 68, 0.25);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

.n8n-voice-button svg {
    width: 20px;
    height: 20px;
}

.n8n-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 15px;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    font-family: inherit;
    color: var(--n8n-text-primary, #353740);
    line-height: 1.5;
    transition: max-height 0.2s;
    overflow-y: auto;
}

.n8n-chat-input::placeholder {
    color: var(--n8n-text-secondary, #6e6e80);
}

/* Auto-expanding textarea */
.n8n-chat-input.auto-resize {
    overflow-y: hidden;
}

/* Textarea scrollbar */
.n8n-chat-input::-webkit-scrollbar {
    width: 6px;
}

.n8n-chat-input::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.n8n-chat-input::-webkit-scrollbar-track {
    background: transparent;
}

.n8n-send-button {
    background: var(--n8n-primary-color, #10a37f);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.n8n-send-button:hover:not(:disabled) {
    background: var(--n8n-secondary-color, #19c37d);
    transform: translateY(-1px);
}

.n8n-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.n8n-send-button svg {
    width: 20px;
    height: 20px;
}

/* Voice Recording Status - Enhanced with Progress */
.n8n-voice-recording-status {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    margin-top: 12px;
    gap: 12px;
    animation: slideDown 0.3s ease-out;
}

.n8n-recording-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.n8n-recording-progress-container {
    width: 100%;
    margin: 8px 0;
}

.n8n-recording-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.n8n-recording-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10a37f 0%, #dc3232 100%);
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 4px;
    position: relative;
}

.n8n-recording-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.n8n-recording-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.n8n-recording-action-btn {
    padding: 8px 16px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.n8n-recording-action-btn.cancel {
    background: white;
    color: var(--n8n-text-primary, #353740);
}

.n8n-recording-action-btn.cancel:hover {
    background: rgba(0, 0, 0, 0.05);
}

.n8n-recording-action-btn.stop {
    background: #dc3232;
    color: white;
    border-color: #c92a2a;
}

.n8n-recording-action-btn.stop:hover {
    background: #c92a2a;
}

/* Recording waveform visualization (optional) */
.n8n-recording-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 40px;
    margin: 8px 0;
}

.n8n-waveform-bar {
    width: 3px;
    background: var(--n8n-primary-color, #10a37f);
    border-radius: 2px;
    animation: waveform 1.2s ease-in-out infinite;
}

.n8n-waveform-bar:nth-child(1) { animation-delay: 0s; }
.n8n-waveform-bar:nth-child(2) { animation-delay: 0.1s; }
.n8n-waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.n8n-waveform-bar:nth-child(4) { animation-delay: 0.3s; }
.n8n-waveform-bar:nth-child(5) { animation-delay: 0.4s; }
.n8n-waveform-bar:nth-child(6) { animation-delay: 0.3s; }
.n8n-waveform-bar:nth-child(7) { animation-delay: 0.2s; }
.n8n-waveform-bar:nth-child(8) { animation-delay: 0.1s; }

@keyframes waveform {
    0%, 100% { height: 8px; }
    50% { height: 32px; }
}

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

.n8n-voice-recording-status.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    animation: pulseWarning 1s infinite;
}

@keyframes pulseWarning {
    0%, 100% {
        border-color: rgba(245, 158, 11, 0.3);
    }
    50% {
        border-color: rgba(245, 158, 11, 0.6);
    }
}

.n8n-recording-time {
    font-weight: 600;
    color: #dc3232;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.n8n-voice-recording-status.warning .n8n-recording-time {
    color: #d97706;
}

.n8n-time-elapsed {
    color: #dc3232;
}

.n8n-time-separator {
    color: var(--n8n-text-secondary, #6e6e80);
    opacity: 0.6;
}

.n8n-time-max {
    color: var(--n8n-text-secondary, #6e6e80);
    opacity: 0.8;
}

.n8n-recording-text {
    color: var(--n8n-text-primary, #353740);
    flex: 1;
    font-size: 14px;
}

.n8n-cancel-recording {
    background: white;
    border: 1px solid var(--n8n-border-color, #d9d9e3);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--n8n-text-primary, #353740);
}

.n8n-cancel-recording:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--n8n-text-secondary, #6e6e80);
}

/* Stop Recording Button (replaces send button) */
.n8n-send-button.stop-recording {
    background: #dc3232;
    animation: pulse-stop 2s infinite;
}

.n8n-send-button.stop-recording:hover:not(:disabled) {
    background: #c92a2a;
    transform: scale(1.05);
}

@keyframes pulse-stop {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 50, 50, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(220, 50, 50, 0);
    }
}

/* Recording indicator pulsing */
.n8n-voice-button.recording .n8n-recording-icon {
    animation: recording-pulse 1.5s ease-in-out infinite;
}

@keyframes recording-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}

/* Character Counter */
.n8n-char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--n8n-text-secondary, #6e6e80);
    margin-top: 8px;
}

.n8n-char-count.warning {
    color: #f0ad4e;
}

.n8n-char-count.error {
    color: #dc3232;
}

/* Error Message */
.n8n-chat-error {
    padding: 16px;
    background: #fef4f4;
    border: 1px solid #dc3232;
    border-radius: 8px;
    color: #dc3232;
    text-align: center;
    margin: 20px;
}

/* Code blocks in messages */
.n8n-message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.n8n-message-content code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

/* Links in messages */
.n8n-message-content a {
    color: inherit;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .n8n-chat-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .n8n-message-content {
        max-width: 85%;
    }

    .n8n-chat-header {
        padding: 12px 16px;
    }

    .n8n-chat-messages {
        padding: 16px;
        padding-left: 56px; /* Adjusted for sidebar */
    }

    .n8n-chat-input-area {
        padding: 12px 16px;
    }

    /* Hide font size controls on mobile */
    .n8n-font-size-control {
        display: none;
    }

    /* Smaller progress sidebar */
    .n8n-chat-progress-sidebar {
        width: 32px;
    }

    .n8n-chat-messages {
        padding-left: 48px;
    }

    /* Stack recording actions vertically on mobile */
    .n8n-recording-actions {
        flex-direction: column;
    }

    .n8n-recording-action-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .n8n-message-content {
        max-width: 90%;
        font-size: 14px;
    }

    .n8n-chat-header-title {
        font-size: 14px;
    }

    /* Smaller window control buttons */
    .n8n-window-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    /* Smaller scroll to bottom button */
    .n8n-scroll-to-bottom {
        width: 40px;
        height: 40px;
        bottom: 16px;
        right: 16px;
    }

    /* Input controls */
    .n8n-input-controls .n8n-voice-button,
    .n8n-input-controls .n8n-file-button {
        width: 40px;
        height: 40px;
    }

    .n8n-send-button {
        width: 40px;
        height: 40px;
    }
}

/* Expanded/Fullscreen mode adjustments */
.n8n-chat-container[data-mode="expanded"] .n8n-chat-messages,
.n8n-chat-container[data-mode="fullscreen"] .n8n-chat-messages {
    height: auto;
}

@media (max-width: 768px) {
    /* On mobile, expanded mode takes full screen */
    .n8n-chat-container[data-mode="expanded"] {
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0;
    }
}

/* Loading Spinner */
.n8n-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Accessibility */
.n8n-chat-container:focus-within {
    outline: 2px solid var(--n8n-primary-color, #10a37f);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .n8n-chat-input-area,
    .n8n-chat-header {
        display: none;
    }

    .n8n-chat-messages {
        overflow: visible;
    }
}
