/* Przycisk czatu */
.chat-toggle {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 60px;
	height: 60px;
	background: linear-gradient(135deg, #3086f3, #424fb0);
	border-radius: 50%;
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 20px rgba(48, 134, 243, 0.4);
	transition: all 0.3s ease;
	z-index: 1001;
	display: flex;
	align-items: center;
	justify-content: center;
}

.chat-toggle:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 25px rgba(48, 134, 243, 0.6);
}

.chat-toggle svg {
	width: 28px;
	height: 28px;
	fill: white;
}

/* Kontener czatu */
.chat-container {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 380px;
	height: 500px;
	background: white;
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(66, 79, 176, 0.2);
	transform: scale(0) translateY(20px);
	opacity: 0;
	transition: all 0.3s ease;
	z-index: 1000;
	border: 1px solid rgba(194, 228, 255, 0.5);
}

.chat-container.active {
	transform: scale(1) translateY(0);
	opacity: 1;
}

/* Nagłówek czatu */
.chat-header {
	background: linear-gradient(135deg, #424fb0, #3086f3);
	padding: 10px 20px;
	color: white;
	position: relative;
	display: block;
}

.chat-header h3 {
	font-size: 18px;
	font-weight: 600;
	margin-bottom: 5px;
}

.chat-header p {
	font-size: 14px;
	opacity: 0.9;
}

.close-btn {
	top: 15px;
	right: 15px;
	width: 30px;
	height: 30px;
	background: rgba(255, 255, 255, 0.2);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.3s ease;
}

.close-btn:hover {
	background: rgba(255, 255, 255, 0.3);
}

.close-btn svg {
	width: 16px;
	height: 16px;
	fill: white;
}

.header-status-button {
	display: flex;
	justify-content: space-between;
}

/* Obszar wiadomości */
.messages-area {
	height: 320px;
	overflow-y: auto;
	padding: 20px;
	background: #fafbff;
}

.message {
	margin-bottom: 15px;
	display: flex;
	align-items: flex-end;
	gap: 10px;
}

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

.message-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 600;
	flex-shrink: 0;
}

.message.ai .message-avatar {
	background: linear-gradient(135deg, #3086f3, #424fb0);
	color: white;
}

.messages-area .message .user-avatar {
	width: 36px;
    height: 36px;
}

.message.user .message-bubble {
	max-width: 100%;
}

.message.support .message-avatar {
	background: #ffeee3;
	color: #424fb0;
}

.message-bubble {
	max-width: 70%;
	padding: 12px 16px;
	border-radius: 18px;
	font-size: 14px;
	line-height: 1.4;
	position: relative;
}

.message.ai .message-bubble {
	background: white;
	border: 1px solid #c2e4ff;
	color: #424fb0;
}

.message.user .message-bubble {
	background: linear-gradient(135deg, #3086f3, #424fb0);
	color: white;
}

.message.support .message-bubble {
	background: #ffeee3;
	color: #424fb0;
	border: 1px solid rgba(255, 165, 0, 0.2);
}

.message-time {
	font-size: 11px;
	opacity: 0.6;
	margin-top: 4px;
}

/* Pole wprowadzania */
.input-area {
	padding: 20px;
	background: white;
	border-top: 1px solid #c2e4ff;
}

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

.message-ai-input {
	flex: 1;
	border: 1px solid #c2e4ff;
	border-radius: 20px;
	padding: 12px 16px;
	font-size: 14px;
	outline: none;
	resize: none;
	max-height: 100px;
	min-height: 40px;
	transition: border-color 0.3s ease;
}

.message-ai-input:focus {
	border-color: #3086f3;
	box-shadow: 0 0 0 3px rgba(48, 134, 243, 0.1);
}

.send-btn {
	width: 40px;
	height: 40px;
	background: linear-gradient(135deg, #3086f3, #424fb0);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease;
}

.send-btn:hover {
	transform: scale(1.05);
}

.send-btn svg {
	width: 18px;
	height: 18px;
	fill: white;
}

/* Status online */
.online-indicator {
	top: 15px;
	left: 20px;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	opacity: 0.9;
}

.status-dot {
	width: 8px;
	height: 8px;
	background: #4ade80;
	border-radius: 50%;
	animation: pulse 2s infinite;
}

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

/* Scrollbar */
.messages-area::-webkit-scrollbar {
	width: 4px;
}

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

.messages-area::-webkit-scrollbar-thumb {
	background: #c2e4ff;
	border-radius: 2px;
}

/* Typing indicator */
.typing-indicator {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	background: white;
	border-radius: 18px;
	border: 1px solid #c2e4ff;
	margin-bottom: 15px;
}

.typing-dots {
	display: flex;
	gap: 3px;
}

.typing-dot {
	width: 6px;
	height: 6px;
	background: #3086f3;
	border-radius: 50%;
	animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typing {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.4;
	}
	30% {
		transform: translateY(-10px);
		opacity: 1;
	}
}

/* Responsywność */
@media (max-width: 480px) {
	.chat-container {
		width: calc(100vw - 40px);
		height: calc(100vh - 40px);
		bottom: 20px;
		right: 20px;
	}
}

/* PANEL SMS AI */

/* Panel SMS - boczny po lewej stronie */
.sms-ai .sms-panel {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 380px;
    height: 94vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 3px solid #3086f3;
    box-shadow: 5px 0 20px rgba(66, 79, 176, 0.2);
    transform: translateX(-377px); /* Ukrywa panel, zostawia tylko 60px na uchwyt */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1005;
    display: flex;
    flex-direction: column;
}

.sms-ai .sms-panel.open {
    transform: translateX(0);
}

/* Toggle button - uchwyt po prawej stronie panelu */
.sms-ai .toggle-btn {
    position: absolute;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 120px;
    background: linear-gradient(135deg, #3086f3, #424fb0);
    border: none;
    border-radius: 0 15px 15px 0;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 3px 0 10px rgba(66, 79, 176, 0.3);
    transition: all 0.3s ease;
}

.sms-ai .toggle-btn:hover {
    background: linear-gradient(135deg, #424fb0, #3086f3);
    transform: translateY(-50%) translateX(2px);
}

/* Header panelu */
.sms-ai .panel-header {
    background: linear-gradient(135deg, #3086f3, #424fb0);
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #c2e4ff;
}

.sms-ai .sms-count {
    background: #FFA500;
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    margin-left: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Lista SMS-ów */
.sms-ai .sms-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: linear-gradient(180deg, rgba(194, 228, 255, 0.1) 0%, rgba(255, 238, 227, 0.1) 100%);
}

.sms-ai .sms-bubble {
    background: white;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(66, 79, 176, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    border-right: 4px solid #3086f3;
    overflow: hidden;
}

.sms-ai .sms-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 79, 176, 0.25);
    border-right-color: #FFA500;
}

.sms-ai .sms-bubble.new {
    border-right-color: #FFA500;
    animation: newSms 1s ease-out;
}

@keyframes newSms {
    0% { transform: translateX(-100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.sms-ai .sms-preview {
    padding: 15px;
}

.sms-ai .sms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sms-ai .sender {
    font-weight: 600;
    color: #424fb0;
    font-size: 14px;
}

.sms-ai .time {
    font-size: 12px;
    color: #666;
    background: #ffeee3;
    padding: 2px 8px;
    border-radius: 10px;
}

.sms-ai .message-preview {
    color: #333;
    font-size: 13px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Widok szczegółowy SMS-a */
.sms-ai .sms-detail {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 380px;
    height: 94vh;
    background: white;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 30px rgba(66, 79, 176, 0.3);
    z-index: 1005;
    display: flex;
    flex-direction: column;
}

.sms-ai .sms-detail.open {
    transform: translateX(0);
}

.sms-ai .detail-header {
    background: linear-gradient(135deg, #3086f3, #424fb0);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sms-ai .back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
    order: 3;
	width: 41px;
    height: 41px;
}

.sms-ai .back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sms-ai .detail-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

.sms-ai .detail-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.sms-ai .original-message {
    background: linear-gradient(135deg, #c2e4ff, #e8f4ff);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border-right: 4px solid #3086f3;
}

.sms-ai .message-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    color: #424fb0;
    font-weight: 600;
}

.sms-ai .message-text {
    color: #333;
    line-height: 1.5;
    font-size: 14px;
}

.sms-ai .ai-response {
    background: linear-gradient(135deg, #ffeee3, #fff8f2);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border-right: 4px solid #FFA500;
}

.sms-ai .ai-label {
    color: #FFA500;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.sms-ai .ai-label::before {
    content: "🤖";
    margin-right: 5px;
}

.sms-ai .response-text {
    color: #333;
    line-height: 1.5;
    font-size: 14px;
    margin-bottom: 15px;
}

.sms-ai .response-actions {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: #f8f9ff;
    border-top: 1px solid #e0e8ff;
}

.sms-ai .btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sms-ai .btn-reject {
    background: #f0f0f0;
    color: #666;
}

.sms-ai .btn-reject:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.sms-ai .btn-send {
    background: linear-gradient(135deg, #3086f3, #424fb0);
    color: white;
}

.sms-ai .btn-send:hover {
    background: linear-gradient(135deg, #424fb0, #3086f3);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(66, 79, 176, 0.3);
}

/* Scrollbar styling */
.sms-ai .sms-list::-webkit-scrollbar,
.sms-ai .detail-content::-webkit-scrollbar {
    width: 6px;
}

.sms-ai .sms-list::-webkit-scrollbar-track,
.sms-ai .detail-content::-webkit-scrollbar-track {
    background: transparent;
}

.sms-ai .sms-list::-webkit-scrollbar-thumb,
.sms-ai .detail-content::-webkit-scrollbar-thumb {
    background: #c2e4ff;
    border-radius: 3px;
}

.sms-ai .sms-list::-webkit-scrollbar-thumb:hover,
.sms-ai .detail-content::-webkit-scrollbar-thumb:hover {
    background: #3086f3;
}

/* Status wysłania */
.sms-ai .sending {
    pointer-events: none;
    opacity: 0.7;
}

.sms-ai .sent-status {
    background: #4CAF50;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    text-align: center;
    margin: 10px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .sms-ai .sms-panel {
        width: 100vw;
        transform: translateX(calc(-100vw + 50px));
    }
    
    .sms-ai .sms-panel.open {
        transform: translateX(0);
    }
    
    .sms-ai .sms-detail {
        width: 100vw;
    }
}