/* CSS Variables for Premium Look */
:root {
  --nc-primary-color: #2563EB;
  --nc-primary-gradient: linear-gradient(135deg, #2563EB, #1D4ED8);
  --nc-bg-glass: rgba(255, 255, 255, 0.85);
  --nc-border-glass: rgba(255, 255, 255, 0.5);
  --nc-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --nc-text-dark: #1F2937;
  --nc-text-light: #6B7280;
  --nc-white: #ffffff;
  --nc-radius: 16px;
  --nc-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Container */
#news-chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Floating Toggle Button */
#news-chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--nc-primary-gradient);
  color: var(--nc-white);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: var(--nc-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

#news-chatbot-toggle:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

/* Chat Window */
#news-chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 600px;
  max-height: 80vh;
  background: var(--nc-bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--nc-border-glass);
  border-radius: var(--nc-radius);
  box-shadow: var(--nc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--nc-transition);
  opacity: 1;
  transform: translateY(0);
}

#news-chatbot-window.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  display: flex; /* Keep layout but hide visually */
  visibility: hidden; /* Ensure it doesn't block clicks */
}

/* Header */
.nc-header {
  background: var(--nc-primary-gradient);
  padding: 16px 20px;
  color: var(--nc-white);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nc-title {
  font-weight: 600;
  font-size: 16px;
}

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

#nc-clear-chat {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: var(--nc-transition);
}

#nc-clear-chat:hover {
  color: var(--nc-white);
  transform: scale(1.1);
}

#nc-clear-chat.confirming {
  color: #10b981; /* Green color for OK */
  transform: scale(1.2);
}

#news-chatbot-close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

#news-chatbot-close:hover {
  color: var(--nc-white);
}

/* Messages Area */
.nc-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nc-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: nc-slide-up 0.3s ease-out;
}

.nc-message.bot {
  align-self: flex-start;
}

.nc-message.user {
  align-self: flex-end;
}

.nc-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.nc-message.bot .nc-bubble {
  background: rgba(255, 255, 255, 0.9);
  color: var(--nc-text-dark);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.nc-message.user .nc-bubble {
  background: var(--nc-primary-color);
  color: var(--nc-white);
  border-bottom-right-radius: 4px;
}

/* Quick Actions */
.nc-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.nc-action-btn {
  background: rgba(0, 0, 0, 0.05);
  color: var(--nc-primary-color);
  border: 1px solid var(--nc-primary-color);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--nc-transition);
  font-weight: 500;
}

.nc-action-btn:hover {
  background: var(--nc-primary-color);
  color: var(--nc-white);
}

/* Input Area */
.nc-input-area {
  padding: 16px;
  background: rgba(255,255,255,0.9);
  border-top: 1px solid rgba(0,0,0,0.05);
  display: flex;
  gap: 10px;
}

#nc-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  outline: none;
  font-size: 14px;
  transition: var(--nc-transition);
}

#nc-input:focus {
  border-color: var(--nc-primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#nc-send-btn {
  background: var(--nc-primary-gradient);
  color: var(--nc-white);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--nc-transition);
}

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

/* News Cards (Dynamic Content) */
.nc-news-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--nc-transition);
  text-decoration: none;
  color: inherit;
  display: block;
  animation: nc-fade-in 0.4s ease-out both;
}

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

.nc-news-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.nc-news-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.nc-news-content {
  padding: 12px;
}

.nc-news-date {
  font-size: 11px;
  color: #888;
  margin-bottom: 2px;
}

.nc-news-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--nc-text-dark);
}

.nc-news-excerpt {
  font-size: 12px;
  color: var(--nc-text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nc-view-more-btn {
  display: inline-block;
  background: var(--nc-white);
  color: var(--nc-primary-color);
  border: 1px solid var(--nc-primary-color);
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
  transition: var(--nc-transition);
  text-align: center;
}

.nc-view-more-btn:hover {
  background: var(--nc-primary-color);
  color: var(--nc-white);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Animations */
@keyframes nc-slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive */
@media (max-width: 480px) {
  #news-chatbot-window {
    width: 100%;
    height: 100%;
    max-height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
}
