/**
 * Smart Search Extended Features Styles
 *
 * Styles for chatbot, voice search, and visual search components.
 *
 * @package Inoterior
 */

/* =============================================
   Chatbot Widget
   ============================================= */

 [hidden], template {
    display: none;
}  

#tm-smart-search-chatbot {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #0c121c;
}

.tm-chatbot-toggle {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9990;
    transition: all 0.3s ease;
    background: linear-gradient(270deg, #A930DF 0%, #3A1BDD 100%), #000000;
    padding: 0;
}

.tm-chatbot-toggle:hover {
	transform: scale(1.1);
	background: var(--tm-secondary-bg);
}

.tm-chatbot-toggle:focus {
	outline: 2px solid #667eea;
	outline-offset: 2px;
}

.tm-chatbot-toggle i {
    font-size: 20px;
}

.tm-chatbot-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 15px;
    background: #ff3a3a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

/* Position variations */
.tm-chatbot-bottom-left .tm-chatbot-toggle {
	right: auto;
	left: 20px;
}

.tm-chatbot-floating .tm-chatbot-toggle {
	position: absolute;
	bottom: auto;
	top: 50%;
	transform: translateY(-50%);
	right: 0;
}

/* Chat Window */
.tm-chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: var(--ttm-whitecolor);
    border-radius: 20px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.tm-chatbot-bottom-left .tm-chatbot-window {
	right: auto;
	left: 20px;
}

.tm-chatbot-header {
    padding: 20px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: url(../../images/chat-title-bg.jpg) no-repeat 100% 100%;
    background-size: cover;
    background-position: center;
    color: white;
    border-radius: 20px 20px 0 0;
}

.tm-chatbot-header h3 {
    margin: 0 0 0 0;
    font-size: 18px;
    line-height: 28px;
    font-weight: 600;
    color: #ffffff;
}
.tm-chatbot-title p {
    margin: 0;
}
.tm-chatbot-close {
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    background: rgba(255,255,225,0.10);
    border-radius: 10px;
}

.tm-chatbot-close:hover {
	transform: scale(1.1);
}

/* Messages */
.tm-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #ffffff;
}
.tm-chatbot-message {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	animation: messageIn 0.3s ease;
}

@keyframes messageIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.tm-message-user {
	justify-content: flex-end;
}

.tm-message-user .tm-message-content {
	background: #3A1BDD;
	color: white;
	border-radius: 15px 15px 0 15px;
	padding: 10px 12px;
	max-width: 70%;
	word-wrap: break-word;
}

.tm-message-bot {
	justify-content: flex-start;
}

.tm-message-bot .tm-message-icon {
    flex-shrink: 0;
    font-size: 18px;
    width: 50px;
    height: 50px;
    padding: 5px;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(
0deg, #A930DF 0%, #3A1BDD 100%), #000000;
}
.tm-message-bot .tm-message-icon img.chatmsgbox-img {
    max-width: 100%;
}
.tm-message-bot .tm-message-content {
    background: #F3F1FF;
    border-radius: 15px 15px 15px 0;
    padding: 10px 12px;
    max-width: 70%;
    word-wrap: break-word;
}

.tm-message-error {
	color: #dc2626;
}

.tm-message-error .tm-message-icon {
	margin-right: 4px;
}

/* Typing indicator */
.tm-message-typing {
	align-items: center;
}

.tm-typing-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #d1d5db;
	display: inline-block;
	margin: 0 2px;
	animation: typing 1.4s infinite;
}

.tm-typing-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.tm-typing-dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typing {
	0%, 60%, 100% {
		opacity: 0.5;
		transform: translateY(0);
	}
	30% {
		opacity: 1;
		transform: translateY(-10px);
	}
}

/* Input Area */
.tm-chatbot-input-area {
    padding: 20px;
    border-top: 1px solid #E2E2E2;
    background: #F3F1FF;
    border-radius: 0 0 20px 20px;
}
.tm-chatbot-header-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.tm-chatbot-image {
    width: 60px;
    height: 60px;
    overflow: hidden;
    border-radius: 50%;
    background: #ffffff;
    padding: 6px;
}
.tm-chatbot-image img {
    max-width: 100%;
}
.tm-chatbot-form {
	display: flex;
	gap: 10px;
}
.tm-chatbot-form input.tm-chatbot-input {
    height: 50px;
    border-radius: 12px;
    border: 1px solid #E2E2E2;
	flex: 1;
	font-family: inherit;
	transition: border-color 0.2s ease;
	color: #0c121c;
}
.tm-chatbot-form .tm-chatbot-input:focus {
    outline: none;
    border-color: #0c121c;
    box-shadow: 0 0 8px 0px rgba(0, 0, 0, 0.10);
}

.tm-chatbot-send {
    width: 50px;
    height: 50px;
    padding: 0;
    background: linear-gradient(270deg, #A930DF 0%, #3A1BDD 100%), #000000;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.tm-chatbot-send:hover {
	background: #000000;
}

.tm-chatbot-send:focus {
	outline: 2px solid #667eea;
	outline-offset: 2px;
}

/* =============================================
   Voice Search
   ============================================= */
#tm-smart-search-voice-overlay[hidden],
#tm-smart-search-visual-overlay[hidden],
.tm-visual-loading[hidden],
.tm-smart-search-visual-overlay[hidden]{
	display: none;
}

#tm-smart-search-voice-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.tm-voice-container {
	position: relative;
	width: 100%;
	max-width: 500px;
	background: white;
	border-radius: 12px;
	padding: 40px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	animation: slideUp 0.3s ease;
}

@keyframes slideUp {
	from {
		transform: translateY(20px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.tm-voice-close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: none;
	border: none;
	font-size: 28px;
	color: var(--body-fonts-color);
	cursor: pointer;
	padding: 0;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s ease;
}

.tm-voice-close:hover {
	color: var(--tm-secondary-bg);
}

.tm-voice-content {
	text-align: center;
}

.tm-voice-content h2 {
	margin: 0 0 20px 0;
	font-size: 24px;
	color: var(--tm-secondary-bg);
}

/* Waveform animation */
.tm-voice-animation {
	margin: 30px 0;
	height: 80px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tm-voice-waveform {
	width: 200px;
	height: 60px;
}

.tm-wave {
	fill: var(--tm-skincolor-bg);
	animation: wave 0.6s ease-in-out infinite;
}

.tm-wave:nth-child(1) { animation-delay: 0s; }
.tm-wave:nth-child(2) { animation-delay: 0.1s; }
.tm-wave:nth-child(3) { animation-delay: 0.2s; }
.tm-wave:nth-child(4) { animation-delay: 0.3s; }
.tm-wave:nth-child(5) { animation-delay: 0.4s; }
.tm-wave:nth-child(6) { animation-delay: 0.5s; }
.tm-wave:nth-child(7) { animation-delay: 0.6s; }
.tm-wave:nth-child(8) { animation-delay: 0.7s; }

@keyframes wave {
	0%, 100% {
		height: 20px;
		y: 20px;
	}
	50% {
		height: 50px;
		y: 5px;
	}
}

.tm-voice-status {
	font-size: 14px;
	color: var(--body-fonts-color);
	margin: 20px 0;
}

.tm-voice-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--tm-skincolor-bg) 50%, var(--tm-secondary-bg) 100%);
    color: var(--ttm-whitecolor);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 40px;
    transition: all 0.3s ease;
    box-shadow: 0px 3px 20px 0px rgb(0 0 0 / 10%);
}

.tm-voice-button:hover {
    transform: scale(1.05);
    box-shadow: 0px 6px 20px 0px rgb(0 0 0 / 20%);
}

.tm-voice-button[data-state="active"] {
	animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
	0%, 100% {
		box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
		transform: scale(1);
	}
	50% {
		box-shadow: 0 4px 15px rgba(102, 126, 234, 0.8);
		transform: scale(1.05);
	}
}

.tm-voice-transcript {
	margin-top: 20px;
	padding: 12px;
	background: #f3f4f6;
	border-radius: 6px;
	font-size: 13px;
	color: var(--tm-secondary-bg);
	word-wrap: break-word;
}

/* =============================================
   Visual Search
   ============================================= */

#tm-smart-search-visual-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	animation: fadeIn 0.3s ease;
}

.tm-visual-container {
    position: relative;
    width: 100%;
    max-width: 650px;
    background: var(--ttm-whitecolor);
    border-radius: var(--border-radius-box);
    padding: 20px 35px 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
	max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.tm-visual-close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: none;
	border: none;
	font-size: 28px;
	color: var(--body-fonts-color);
	cursor: pointer;
	padding: 0;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s ease;
}

.tm-visual-close:hover {
	color: var(--tm-secondary-bg);
}

.tm-visual-content h2 {
	margin: 0 0 0 0;
	font-size: 24px;
	color: var(--tm-secondary-bg);
	text-align: center;
}
.tm-visual-content p {
    margin-bottom: 25px;
    text-align: center;
}
/* Uploader */
.tm-visual-uploader {
    border: 2px dashed var(--tm-skincolor-bg);
    border-radius: var(--border-radius-box);
    background: var(--tm-greycolor-bg);
    padding: 35px 35px 20px 35px;
    position: relative;
    margin-bottom: 30px;
}
.tm-visual-input,
#tm-visual-input{
    display:none;
}

/* Top */

.tm-file-top {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.tm-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 30px;
    border-radius: var(--border-radius-box);
    background: var(--tm-skincolor-bg);
    color: var(--ttm-whitecolor);
    font-size: 18px;
    font-weight: var(--special-element-fontweight);
    cursor: pointer;
    transition: .3s;
    user-select: none;
}

.tm-file-btn:hover{
    background:#c37f48;
}

.tm-file-name {
    font-size: 16px;
    color: var(--tm-secondary-bg);
}

/* Upload Area */

.tm-visual-upload-label svg {
    width: 150px;
    height: 120px;
    margin-bottom: 20px;
}

.tm-visual-upload-label span {
    display: block;
    font-size: 20px;
    line-height: 30px;
    font-weight: var(--special-element-fontweight);
    color: var(--tm-secondary-bg);
}

.tm-visual-upload-label p {
    font-size: var(--body-font-size);
    color: var(--body-fonts-color);
    font-weight: 400;
    margin: 0 0;
}

/* Preview */

.tm-visual-uploader:hover {
	border-color: var(--tm-skincolor-bg);
	background: transparent;
}

.tm-visual-uploader.tm-drag-over {
	border-color: #667eea;
	background: #f0f4ff;
	box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tm-visual-input {
	display: none;
}

.tm-visual-upload-label {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	cursor: pointer;
}

.tm-visual-upload-label i {
	font-size: 40px;
	color: #667eea;
}


/* Preview */
.tm-visual-preview {
    position: relative;
    border-radius: var(--border-radius-box);
    overflow: hidden;
    height: auto;
    width: 200px;
    margin: 15px auto 20px;
    border: 1px solid var(--ttm-bordercolor);
    padding: 10px;
    background: var(--ttm-whitecolor);
}

.tm-visual-preview img {
    max-width: 100%;
    display: block;
    border-radius: var(--border-radius-box);
    margin: 0 auto;
    object-fit: contain;
}
.tm-visual-remove {
	position: absolute;
	top: 5px;
	right: 5px;
	width: 30px;
	height: 30px;
	background: rgba(0, 0, 0, 0.5);
	color: var(--ttm-whitecolor);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
	padding: 0;
}

.tm-visual-remove:hover {
	background: rgba(0, 0, 0, 0.7);
}

/* Search button */
.tm-visual-search-btn {
    width: 100%;
    padding: 15px 30px;
    background: var(--tm-skincolor-bg);
    color: var(--ttm-whitecolor);
    border: none;
    border-radius: var(--border-radius-box);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tm-visual-search-btn:hover:not(:disabled) {
	transform: translateY(-2px);
	background: var(--tm-secondary-bg);
}

.tm-visual-search-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Loading */
.tm-visual-loading {
	text-align: center;
	padding: 20px;
	color: #667eea;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.tm-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid #d1d5db;
	border-top-color: #667eea;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* =============================================
   Responsive Design
   ============================================= */

@media (max-width: 640px) {
	.tm-chatbot-toggle {
		width: 48px;
		height: 48px;
		bottom: 16px;
		right: 16px;
	}

	.tm-chatbot-window {
		width: calc(100% - 32px);
		height: 400px;
		max-height: 60vh;
		bottom: 70px;
		right: 16px;
		left: auto;
	}

	.tm-chatbot-bottom-left .tm-chatbot-window {
		left: 16px;
		right: auto;
	}

	.tm-chatbot-messages {
		padding: 12px;
	}

	.tm-message-user .tm-message-content,
	.tm-message-bot .tm-message-content {
		max-width: 85%;
	}

	.tm-voice-container,
	.tm-visual-container {
		width: calc(100% - 32px);
		padding: 24px;
	}

	.tm-visual-preview {
		max-height: 300px;
		overflow: hidden;
	}

	.tm-voice-waveform {
		width: 150px;
		height: 50px;
	}

.tm-visual-uploader {
    padding: 25px 25px 10px 25px;
}
.tm-file-btn {
    padding: 13px 20px;
    font-size: 16px;
}
.tm-file-name {
    font-size: 14px;
}
    .ttm-aisearchbox.tm-search-overlay {
        width: 100%;
    }
	.tm-smart-search-result-top em {
    margin-left: 8px;
}
}
/* =============================================
   Print Styles
   ============================================= */

@media print {
	#tm-smart-search-chatbot,
	#tm-smart-search-voice-overlay,
	#tm-smart-search-visual-overlay {
		display: none !important;
	}
}
