/* Common Styles - Shared between all pages */

/* Reduced motion preference - disable animations for accessibility */
@media (prefers-reduced-motion: reduce) {
  .chat-container {
    animation: none !important;
    backdrop-filter: none !important;
  }
  
  .theme-toggle-btn:hover {
    transform: none !important;
  }
  
  .new-session-btn:active {
    transform: none !important;
  }
}

/* Base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'IRAN', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

html, body {
  background-color: #000;
  color: #fff;
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  direction: rtl;
  text-align: right;
  transition: direction 0.3s ease, font-family 0.3s ease;
  /* Mobile optimizations */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* iOS safe area support */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Night mode background with bg.png and animated effect */
body:not(.day-mode) {
  background-image: url('../assets/bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body:not(.day-mode)::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: -1;
  pointer-events: none;
}

/* Day Mode - clean, bright theme */
body.day-mode {
  background: linear-gradient(135deg, #f0f4f8 0%, #e6f3ff 50%, #f0f4f8 100%) !important;
  color: #333 !important;
}

/* LTR language support */
body.dir-ltr, html[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

/* Dynamic font support using CSS variables */
:root {
  --language-font: 'IRAN', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Apply language font to body when language classes are present */
body[class*="lang-"] {
  font-family: var(--language-font, system-ui, -apple-system, sans-serif);
}

/* Ensure all text elements use the language font */
body[class*="lang-"] * {
  font-family: inherit;
}

/* Language selection modal styling - Used by both pages */
.language-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white !important;
  color: #333 !important;
  border-radius: 15px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
  border: 2px solid rgba(0, 255, 255, 0.2);
}

.modal-header {
  text-align: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  color: #0088ff !important;
  margin-bottom: 10px;
  text-shadow: none;
}

.modal-header .country-flag {
  width: 48px;
  height: 36px;
}

.language-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.language-option {
  padding: 15px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-weight: 500;
  background: white !important;
  color: #333 !important;
}

.language-option:hover {
  border-color: #0088ff;
  background: #f8f9fa !important;
  color: #333 !important;
}

.language-option.primary {
  border-color: #0088ff;
  background: #e3f2fd !important;
  color: #0066cc !important;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666 !important;
  padding: 5px;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal:hover {
  background: #f0f0f0;
  color: #333 !important;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Night mode styles for legal links */
body:not(.day-mode) .legal-links {
  color: white;
}

body:not(.day-mode) .legal-links a {
  color: white;
}