/**
 * Web GPT Chat Interface Styles
 */

.web-gpt-chat-container {
    display: flex;
    flex-direction: column;
	    border: 1px solid #ddd;
	    border-radius: 8px;
    overflow: hidden;
    min-height: 0;
    max-width: 100%;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    letter-spacing: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.web-gpt-chat-container * {
    box-sizing: border-box;
}

/* Dark theme */
.web-gpt-chat-container[data-theme="dark"] {
    background: #1e1e1e;
    border-color: #333;
    color: #fff;
}

.web-gpt-chat-container[data-theme="dark"] .web-gpt-chat-input-container {
    background: #2a2a2a;
}

.web-gpt-chat-container[data-theme="dark"] .web-gpt-chat-input {
    background: #333;
    color: #fff;
    border-color: #444;
}

.web-gpt-chat-container[data-theme="dark"] .web-gpt-message-assistant .web-gpt-message-content {
    background: #2a2a2a;
}

/* Header */
.web-gpt-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
	    background: linear-gradient(135deg, var(--web-gpt-gradient-start, #263238) 0%, var(--web-gpt-gradient-end, #1f4e5f) 100%);
    color: white;
	    font-weight: 600;
    flex-shrink: 0;
	}

.web-gpt-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    line-height: 1.2;
}

.web-gpt-title-icon,
.web-gpt-title-logo,
.web-gpt-chat-actions svg,
.web-gpt-chat-reset svg,
.web-gpt-chat-send svg,
.web-gpt-floating-button svg {
    display: block;
}

.web-gpt-title-logo {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 30px;
}

.web-gpt-title-logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 30px;
    max-height: 30px;
    object-fit: contain;
}

.web-gpt-chat-toolbar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex: 0 0 auto;
}

.web-gpt-chat-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.web-gpt-chat-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
	    padding: 0;
    margin: 0;
    line-height: 1;
}

.web-gpt-chat-actions-secondary button {
    width: 30px;
    height: 28px;
}

.web-gpt-chat-actions button:hover {
    opacity: 0.8;
}

/* Messages */
.web-gpt-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f9f9f9;
}

.web-gpt-chat-container[data-theme="dark"] .web-gpt-chat-messages {
    background: #1a1a1a;
}

.web-gpt-message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease-in;
}

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

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

.web-gpt-message-avatar {
	    width: 30px;
	    height: 30px;
	    border-radius: 999px;
	    display: flex;
	    align-items: center;
	    justify-content: center;
	    background: #d7dee2;
	    color: #263238;
	    font-size: 11px;
	    font-weight: 700;
	    letter-spacing: 0;
	    flex-shrink: 0;
}

.web-gpt-message-avatar-logo {
    overflow: hidden;
    padding: 3px;
    background: #d7dee2;
}

.web-gpt-message-avatar-round {
    border-radius: 999px;
}

.web-gpt-message-avatar-square {
    border-radius: 5px;
}

.web-gpt-message-avatar-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.web-gpt-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: var(--web-gpt-message-font-size, 15px);
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.web-gpt-message-content p {
    margin: 0;
}

.web-gpt-message-assistant .web-gpt-message-content {
    background: #f0f0f0;
    border-bottom-left-radius: 4px;
}

.web-gpt-message-user .web-gpt-message-content {
	    background: var(--web-gpt-accent, #1f4e5f);
    color: white;
    border-bottom-right-radius: 4px;
}

.web-gpt-message-error .web-gpt-message-content {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

/* Loading animation */
.web-gpt-loading .web-gpt-message-content::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Sources */
.web-gpt-sources {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
    font-size: 13px;
}

.web-gpt-sources-header {
    font-weight: 600;
    cursor: pointer;
    color: #666;
}

.web-gpt-source-list {
    margin: 8px 0 0;
    padding-left: 18px;
}

.web-gpt-source-list li {
    margin: 4px 0;
}

.web-gpt-source-list a {
    color: var(--web-gpt-accent, #1f4e5f);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.web-gpt-primary-source {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.35;
}

.web-gpt-primary-source a {
    color: var(--web-gpt-accent, #1f4e5f);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.web-gpt-source-score {
    display: none;
}

.web-gpt-source-snippet {
    display: none;
}

/* Input */
.web-gpt-chat-input-container {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #ddd;
    background: #fafafa;
    flex-shrink: 0;
}

.web-gpt-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    line-height: 1.4;
}

.web-gpt-chat-input:focus {
    outline: none;
	    border-color: var(--web-gpt-accent, #1f4e5f);
}

.web-gpt-chat-send {
	    background: var(--web-gpt-accent, #1f4e5f);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
	    transition: all 0.2s;
	    flex-shrink: 0;
	    display: flex;
	    align-items: center;
	    justify-content: center;
	}

.web-gpt-chat-reset {
    background: transparent;
    color: var(--web-gpt-accent, #1f4e5f);
    border: 1px solid rgba(31, 78, 95, 0.26);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.web-gpt-chat-reset:hover {
    background: rgba(31, 78, 95, 0.08);
}

.web-gpt-chat-send:hover:not(:disabled) {
	    background: var(--web-gpt-gradient-end, #1f4e5f);
    transform: scale(1.05);
}

.web-gpt-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Notification */
	.web-gpt-notification {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4caf50;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
	}

.web-gpt-floating-shell {
    position: fixed;
    z-index: 99999;
    bottom: 24px;
}

.web-gpt-floating-bottom-right {
    right: 24px;
}

.web-gpt-floating-bottom-left {
    left: 24px;
}

.web-gpt-floating-side-tab {
    top: var(--web-gpt-tab-offset, 50%);
    bottom: auto;
    transform: translateY(-50%);
}

.web-gpt-floating-tab-left {
    left: 0;
}

.web-gpt-floating-tab-right {
    right: 0;
}

.web-gpt-floating-button {
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--web-gpt-gradient-start, #263238), var(--web-gpt-gradient-end, #1f4e5f));
    color: #fff;
    font: 700 15px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.web-gpt-floating-side-tab .web-gpt-floating-button {
    width: var(--web-gpt-tab-width, 48px);
    min-width: var(--web-gpt-tab-width, 48px);
    height: var(--web-gpt-tab-height, 180px);
    min-height: var(--web-gpt-tab-height, 180px);
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    padding: 10px 8px;
    border-radius: 8px 0 0 8px;
    line-height: 1.1;
    white-space: normal;
}

.web-gpt-floating-tab-left .web-gpt-floating-button {
    border-radius: 0 8px 8px 0;
}

.web-gpt-floating-side-tab .web-gpt-floating-button svg {
    flex: 0 0 auto;
}

.web-gpt-floating-side-tab .web-gpt-floating-button span {
    display: inline-block;
    max-width: calc(var(--web-gpt-tab-width, 48px) - 16px);
    max-height: calc(var(--web-gpt-tab-height, 180px) - 44px);
    overflow: hidden;
    overflow-wrap: anywhere;
}

.web-gpt-floating-tab-text-vertical-rl .web-gpt-floating-button span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.web-gpt-floating-tab-text-vertical-lr .web-gpt-floating-button span {
    writing-mode: vertical-lr;
    text-orientation: mixed;
}

.web-gpt-floating-tab-text-horizontal .web-gpt-floating-button span {
    writing-mode: horizontal-tb;
}

.web-gpt-floating-panel {
    position: absolute;
    bottom: 68px;
    width: min(420px, calc(100vw - 32px));
    height: min(640px, calc(100vh - 120px));
    min-height: 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.web-gpt-floating-panel .web-gpt-chat-container {
    height: 100%;
    max-height: 100%;
}

.web-gpt-floating-bottom-right .web-gpt-floating-panel {
    right: 0;
}

.web-gpt-floating-bottom-left .web-gpt-floating-panel {
    left: 0;
}

.web-gpt-floating-side-tab .web-gpt-floating-panel {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

.web-gpt-floating-tab-left .web-gpt-floating-panel {
    left: calc(var(--web-gpt-tab-width, 48px) + 12px);
}

.web-gpt-floating-tab-right .web-gpt-floating-panel {
    right: calc(var(--web-gpt-tab-width, 48px) + 12px);
}

.web-gpt-chat-modal-open {
    overflow: hidden;
}

.web-gpt-floating-shell.web-gpt-floating-fullscreen::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.web-gpt-floating-shell.web-gpt-floating-fullscreen > .web-gpt-floating-button {
    display: none;
}

.web-gpt-floating-side-tab.web-gpt-floating-fullscreen {
    inset: 0 auto auto 0;
    transform: none;
}

.web-gpt-floating-shell.web-gpt-floating-fullscreen .web-gpt-floating-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(1080px, calc(100vw - 40px));
    height: min(820px, calc(100vh - 40px));
    max-height: calc(100vh - 40px);
    transform: translate(-50%, -50%);
    z-index: 1;
}

.web-gpt-floating-shell.web-gpt-floating-fullscreen .web-gpt-message-content {
    max-width: min(760px, 78%);
}

.web-gpt-floating-shell.web-gpt-floating-fullscreen .web-gpt-chat-input-container {
    padding: 18px 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .web-gpt-message-content {
        max-width: 85%;
    }

	    .web-gpt-chat-input-container {
	        padding: 12px;
	    }

	    .web-gpt-floating-shell {
	        left: 16px;
	        right: 16px;
	        bottom: 16px;
	    }

	    .web-gpt-floating-mobile-full .web-gpt-floating-button {
	        width: 100%;
	        justify-content: center;
	    }

	    .web-gpt-floating-shell.web-gpt-floating-mobile-icon {
	        left: auto;
	        right: 16px;
	    }

	    .web-gpt-floating-bottom-left.web-gpt-floating-mobile-icon {
	        left: 16px;
	        right: auto;
	    }

	    .web-gpt-floating-mobile-icon .web-gpt-floating-button {
	        width: 56px;
	        height: 56px;
	        min-height: 56px;
	        justify-content: center;
	        gap: 0;
	        padding: 0;
	        border-radius: 999px;
	    }

	    .web-gpt-floating-mobile-icon .web-gpt-floating-button span {
	        position: absolute;
	        width: 1px;
	        height: 1px;
	        overflow: hidden;
	        clip: rect(0 0 0 0);
	        white-space: nowrap;
	    }

	    .web-gpt-floating-side-tab {
	        top: var(--web-gpt-tab-offset, 50%);
	        bottom: auto;
	        left: auto;
	        right: auto;
	        width: auto;
	        transform: translateY(-50%);
	    }

	    .web-gpt-floating-side-tab.web-gpt-floating-tab-left {
	        left: 0;
	        right: auto;
	    }

	    .web-gpt-floating-side-tab.web-gpt-floating-tab-right {
	        left: auto;
	        right: 0;
	    }

	    .web-gpt-floating-side-tab .web-gpt-floating-button,
	    .web-gpt-floating-side-tab.web-gpt-floating-mobile-icon .web-gpt-floating-button {
	        width: var(--web-gpt-tab-width, 48px);
	        min-width: var(--web-gpt-tab-width, 48px);
	        height: var(--web-gpt-tab-height, 180px);
	        min-height: var(--web-gpt-tab-height, 180px);
	        padding: 10px 8px;
	        border-radius: 8px 0 0 8px;
	    }

	    .web-gpt-floating-side-tab.web-gpt-floating-tab-left .web-gpt-floating-button,
	    .web-gpt-floating-side-tab.web-gpt-floating-tab-left.web-gpt-floating-mobile-icon .web-gpt-floating-button {
	        border-radius: 0 8px 8px 0;
	    }

	    .web-gpt-floating-side-tab.web-gpt-floating-mobile-icon .web-gpt-floating-button span {
	        position: static;
	        width: auto;
	        height: auto;
	        overflow: hidden;
	        clip: auto;
	        white-space: normal;
	    }

	    .web-gpt-floating-panel {
	        left: 0;
	        right: 0;
	        width: 100%;
	        height: min(620px, calc(100vh - 96px));
	    }

	    .web-gpt-floating-mobile-icon .web-gpt-floating-panel {
	        position: fixed;
	        left: 16px;
	        right: 16px;
	        bottom: 84px;
	        width: auto;
	    }

	    .web-gpt-floating-side-tab .web-gpt-floating-panel,
	    .web-gpt-floating-side-tab.web-gpt-floating-mobile-icon .web-gpt-floating-panel {
	        position: fixed;
	        top: 50%;
	        left: 16px;
	        right: 16px;
	        bottom: auto;
	        width: auto;
	        transform: translateY(-50%);
	    }

	    .web-gpt-floating-shell.web-gpt-floating-fullscreen .web-gpt-floating-panel {
	        width: calc(100vw - 24px);
	        height: calc(100vh - 24px);
	        max-height: calc(100vh - 24px);
	    }
	}
