/* Floating Button Container */
#chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 9999;
}

/* Main Chat Button */
#chatbot-btn {
  background-color: #c1272c;
  color: white;
  border-radius: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  font-size: 18px;
  font-weight: bold;
  font-family: Arial, sans-serif;
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.3s ease, background-color 0.3s ease;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
  border: none;
  outline: none;
}

#chatbot-btn:hover {
  background-color: #a01f23;
  transform: translateY(-2px);
}

#chatbot-btn:focus {
  outline: 3px solid #c1272c;
  outline-offset: 2px;
}

/* Chat Icon */
#chat-icon {
  background-color: white;
  color: #c1272c;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 18px;
}

/* Chat Modal Container */
#chat-iframe-container {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 400px;
  height: 600px;
  background: white;
  border-radius: 20px;
  box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  overflow: hidden;
}

/* Wrapper for Tabs and Close Button */
.chat-tabs-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #c1272c;
  padding: 10px;
  border-radius: 20px 20px 0 0;
}

/* Tabs Container */
.chat-tabs {
  display: flex;
}

.chat-tab {
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 35px;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  border: none;
  outline: none;
}

.chat-tab:focus {
  outline: 3px solid white;
  outline-offset: 2px;
}

.chat-tab.active {
  background: #a01f23;
}

/* Close Button (Styled like Tabs) */
#close-chat {
  background: #c1272c;
  color: white;
  border: none;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 35px;
  transition: background 0.3s ease, transform 0.2s ease;
  outline: none;
}

#close-chat:hover {
  background: #a01f23;
  transform: scale(0.95);
}

#close-chat:focus {
  outline: 3px solid white;
  outline-offset: 2px;
}

/* Modal Content */
.chat-content {
  width: 100%;
  height: calc(100% - 60px);
  border: none;
}

/* WhatsApp Mockup Styles */
#whatsapp-mockup {
  width: 100%;
  height: 100%;
  background: #F7F7F7;
  display: flex;
  flex-direction: column;
}
#whatsapp-header {
  background: #075e54;
  color: white;
  display: flex;
  align-items: center;
  padding: 10px;
  font-size: 16px;
  font-weight: bold;
}
#whatsapp-header img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}
#whatsapp-chat {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}
.whatsapp-message {
  background: white;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 5px;
}
#whatsapp-button {
  background: #25d366;
  color: black;
  font-size: 16px;
  font-weight: bold;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  outline: none;
  transition: background-color 0.3s ease;
}
#whatsapp-button:hover {
  background: #128c7e;
}
#whatsapp-button:focus {
  outline: 3px solid #25d366;
  outline-offset: 2px;
}
#whatsapp-button img {
  width: 24px;
  margin-right: 10px;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  #chat-iframe-container {
    width: 90%;
    height: 80vh;
    bottom: 20px;
    right: 5%;
  }
  #chatbot-btn {
    padding: 10px 15px;
    font-size: 16px;
  }
}

/* High Contrast Mode Support */
@media (forced-colors: active) {
  #chatbot-btn,
  #close-chat,
  .chat-tab,
  #whatsapp-button {
    border: 2px solid currentColor;
  }
  
  #chatbot-btn:focus,
  #close-chat:focus,
  .chat-tab:focus,
  #whatsapp-button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  #chatbot-btn,
  #close-chat,
  .chat-tab,
  #whatsapp-button {
    transition: none;
  }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 10px;
    margin: 10px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1s 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%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* File Attachment */
.attach-file-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    font-size: 18px;
    transition: color 0.3s ease;
}

.attach-file-btn:hover {
    color: var(--primary-color, #c1272c);
}

.file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f8f8;
    padding: 10px;
    margin: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-info i {
    font-size: 20px;
    color: #666;
}

.file-size {
    color: #666;
    font-size: 12px;
}

.remove-file {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    transition: color 0.3s ease;
}

.remove-file:hover {
    color: #ff4444;
}

/* Read Receipt */
.read-receipt {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    color: #4CAF50;
    font-size: 12px;
}

/* Chat Input Area */
.chat-input {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f8f8f8;
    border-top: 1px solid #ddd;
}

.chat-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    margin-right: 10px;
    font-size: 14px;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary-color, #c1272c);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .file-preview {
        margin: 5px;
        padding: 8px;
    }

    .file-info {
        font-size: 14px;
    }

    .chat-input {
        padding: 8px;
    }
}

/* Settings Page Styles */
.window-size-inputs,
.button-style-inputs,
.animation-inputs,
.font-inputs,
.branding-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.window-size-inputs label,
.button-style-inputs label,
.animation-inputs label,
.font-inputs label,
.branding-inputs label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.window-size-inputs input[type="number"],
.font-inputs input[type="number"],
.animation-inputs input[type="number"] {
    width: 80px;
    padding: 5px;
}

.button-style-inputs select,
.animation-inputs select,
.font-inputs select {
    padding: 5px;
    min-width: 150px;
}

.branding-inputs input[type="url"],
.branding-inputs input[type="text"] {
    width: 100%;
    max-width: 400px;
}

/* Animation Classes */
.fade {
    opacity: 0;
    transition: opacity var(--chat-animation-duration) ease-in-out;
}

.fade.show {
    opacity: 1;
}

.slide {
    transform: translateY(20px);
    opacity: 0;
    transition: transform var(--chat-animation-duration) ease-out, opacity var(--chat-animation-duration) ease-out;
}

.slide.show {
    transform: translateY(0);
    opacity: 1;
}

.bounce {
    animation: bounce var(--chat-animation-duration) cubic-bezier(0.36, 0, 0.66, -0.56);
}

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

/* Button Style Variations */
#chatbot-btn.rounded {
    border-radius: 35px;
}

#chatbot-btn.square {
    border-radius: 0;
}

#chatbot-btn.pill {
    border-radius: 50px;
}

#chatbot-btn.small {
    padding: 8px 15px;
    font-size: 14px;
}

#chatbot-btn.medium {
    padding: 14px 20px;
    font-size: 16px;
}

#chatbot-btn.large {
    padding: 20px 25px;
    font-size: 18px;
}

/* Branding Styles */
.powered-by {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 12px;
    color: #666;
    text-decoration: none;
}

.powered-by:hover {
    color: var(--primary-color, #c1272c);
}

/* Responsive Adjustments for Settings */
@media (max-width: 782px) {
    .window-size-inputs,
    .button-style-inputs,
    .animation-inputs,
    .font-inputs,
    .branding-inputs {
        gap: 10px;
    }

    .branding-inputs input[type="url"],
    .branding-inputs input[type="text"] {
        max-width: 100%;
    }
}

/* Enhanced Animation System */
@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes scaleOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.9);
        opacity: 0;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes bounceOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    20% {
        transform: scale(1.1);
        opacity: 0.9;
    }
    100% {
        transform: scale(0.3);
        opacity: 0;
    }
}

/* Animation Classes */
.animate-slide-in {
    animation: slideIn var(--chat-animation-duration) ease-out forwards;
}

.animate-slide-out {
    animation: slideOut var(--chat-animation-duration) ease-in forwards;
}

.animate-fade-in {
    animation: fadeIn var(--chat-animation-duration) ease-out forwards;
}

.animate-fade-out {
    animation: fadeOut var(--chat-animation-duration) ease-in forwards;
}

.animate-scale-in {
    animation: scaleIn var(--chat-animation-duration) ease-out forwards;
}

.animate-scale-out {
    animation: scaleOut var(--chat-animation-duration) ease-in forwards;
}

.animate-bounce-in {
    animation: bounceIn var(--chat-animation-duration) cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.animate-bounce-out {
    animation: bounceOut var(--chat-animation-duration) cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Enhanced Transitions */
#chat-iframe-container {
    transition: all var(--chat-animation-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

#chatbot-btn {
    transition: all var(--chat-animation-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-tab {
    transition: all var(--chat-animation-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

#close-chat {
    transition: all var(--chat-animation-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover Effects */
#chatbot-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.chat-tab:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#close-chat:hover {
    transform: rotate(90deg) scale(1.1);
}

/* Message Animations */
.whatsapp-message {
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.whatsapp-message:nth-child(1) { animation-delay: 0.1s; }
.whatsapp-message:nth-child(2) { animation-delay: 0.2s; }
.whatsapp-message:nth-child(3) { animation-delay: 0.3s; }
.whatsapp-message:nth-child(4) { animation-delay: 0.4s; }
.whatsapp-message:nth-child(5) { animation-delay: 0.5s; }

/* Theme Preview Animations */
.theme-preview {
    transition: all 0.3s ease;
}

.theme-option:hover .theme-preview {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Enhanced Branding Styles */
.chat-logo {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    object-fit: contain;
}

.header-logo {
    width: 32px;
    height: 32px;
    margin-right: 8px;
    object-fit: contain;
}

.company-name {
    font-weight: bold;
    font-size: 16px;
}

.chat-header-text {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--chat-text-color);
}

.chat-subheader-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

.social-links {
    display: flex;
    gap: 12px;
    margin: 16px 0;
}

.social-link {
    color: #666;
    font-size: 20px;
    transition: color 0.3s ease;
}

.social-link:hover {
    color: var(--chat-primary-color);
}

.chat-footer {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #eee;
    background: #f9f9f9;
}

/* Theme Preview Styles */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.theme-option {
    position: relative;
    cursor: pointer;
}

.theme-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-preview {
    display: block;
    width: 100%;
    height: 100px;
    border-radius: 8px;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
}

.theme-option input[type="radio"]:checked + label .theme-preview {
    border-color: var(--chat-primary-color);
    box-shadow: 0 0 0 2px var(--chat-primary-color);
}

/* Color Scheme Preview Styles */
.color-scheme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.scheme-option {
    position: relative;
    cursor: pointer;
}

.scheme-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.scheme-preview {
    display: block;
    width: 100%;
    height: 80px;
    border-radius: 6px;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
}

.scheme-option input[type="radio"]:checked + label .scheme-preview {
    border-color: var(--chat-primary-color);
    box-shadow: 0 0 0 2px var(--chat-primary-color);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .theme-selector,
    .color-scheme-selector {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .theme-preview {
        height: 80px;
    }

    .scheme-preview {
        height: 60px;
    }

    .chat-header-text {
        font-size: 18px;
    }

    .chat-subheader-text {
        font-size: 13px;
    }

    .social-links {
        gap: 8px;
    }

    .social-link {
        font-size: 18px;
    }
}

/* High Contrast Mode Support */
@media (forced-colors: active) {
    .theme-preview,
    .scheme-preview {
        border: 2px solid currentColor;
    }

    .theme-option input[type="radio"]:checked + label .theme-preview,
    .scheme-option input[type="radio"]:checked + label .scheme-preview {
        border-color: currentColor;
        box-shadow: 0 0 0 2px currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
