/* ==========================================================================
   COMPONENTS, MODALS, AI ASSISTANT & POPUPS STYLES
   ========================================================================== */

/* Universal Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 19, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1);
}

.modal-dialog.modal-lg {
  max-width: 1100px;
}

.modal-dialog.modal-xl {
  max-width: 1350px;
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
}

/* AI Assistant Modal Specific Styles */
.ai-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.ai-action-btn {
  background: #0B132B;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all var(--transition-fast);
}

.ai-action-btn:hover {
  border-color: #8B5CF6;
  background: rgba(139, 92, 246, 0.12);
}

.ai-btn-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #FFFFFF;
}

.ai-btn-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.ai-diff-compare-box {
  background: #0B132B;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.diff-column-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.diff-content {
  font-family: var(--font-hindi);
  font-size: 1rem;
  line-height: 1.6;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  min-height: 120px;
}

.diff-original {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #CBD5E1;
}

.diff-proposed {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34D399;
}

/* Multi-Device Preview Modal */
.preview-device-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preview-device-btn {
  background: #0B132B;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.preview-device-btn.active {
  background: var(--brand-red);
  color: #FFFFFF;
  border-color: var(--brand-red);
}

.preview-frame-container {
  display: flex;
  justify-content: center;
  background: #060A13;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  overflow: auto;
  min-height: 520px;
}

.preview-screen-wrapper {
  background: #0F172A;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-y: auto;
  transition: width 0.3s ease;
}

.preview-screen-wrapper.desktop {
  width: 100%;
  max-width: 1050px;
}

.preview-screen-wrapper.tablet {
  width: 768px;
}

.preview-screen-wrapper.mobile {
  width: 375px;
  border-radius: 28px;
  border: 8px solid #334155;
}

/* Media Library Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.media-item-card {
  position: relative;
  aspect-ratio: 1;
  background: #0B132B;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.media-item-card:hover, .media-item-card.selected {
  border-color: var(--brand-red);
  box-shadow: 0 0 10px rgba(211, 47, 47, 0.4);
}

.media-item-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-type-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
}

/* Devanagari Virtual Typing Helper Popup */
.devanagari-helper-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.5rem;
  background: #0B132B;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 0.75rem;
}

.hindi-key-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: #FFFFFF;
  font-family: var(--font-hindi);
  font-size: 0.95rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}

.hindi-key-btn:hover {
  background: var(--brand-red);
}

/* Social & WhatsApp Broadcast Card */
.whatsapp-preview-box {
  background: #075E54;
  color: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: var(--font-hindi);
  line-height: 1.6;
}

.whatsapp-bubble {
  background: #054740;
  border-radius: var(--radius-sm);
  padding: 1rem;
  white-space: pre-wrap;
  font-size: 0.95rem;
}

/* Global Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 3000;
}

.toast-message {
  background: #1E293B;
  border: 1px solid var(--border-subtle);
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideInToast 0.3s ease;
}

.toast-message.success {
  border-left: 4px solid var(--brand-green);
}

.toast-message.error {
  border-left: 4px solid var(--brand-red);
}

.toast-message.info {
  border-left: 4px solid var(--brand-blue);
}

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

/* Modal and Dialog Responsive Breakpoints */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0.5rem;
  }
  .modal-dialog {
    max-height: 94vh;
  }
  .modal-header {
    padding: 0.85rem 1rem;
  }
  .modal-title {
    font-size: 1rem;
  }
  .toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }
  .toast-message {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.65rem 1rem;
  }
}
