* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2196f3;
  --primary-dark: #1976d2;
  --bg-color: #f5f5f5;
  --text-color: #333333;
  --border-color: #e0e0e0;
  --error-color: #f44336;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ==================== APP HEADER ==================== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #1a1a2e;
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 50px;
}

.app-header.hidden {
  display: none;
}

.app-header .header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header .logo-icon {
  font-size: 20px;
}

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

.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header .btn-icon {
  color: white;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.2s;
}

.app-header .btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
}

.app-header #current-user {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

/* ==================== END APP HEADER ==================== */

/* ==================== LOGIN SCREEN ==================== */

.login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.login-container {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

.login-container h1 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--primary-color);
}

.login-container input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
}

.login-container input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.login-container button {
  width: 100%;
  padding: 12px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.login-container button:hover {
  background: var(--primary-dark);
}

.error {
  color: var(--error-color);
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
}

.login-language-selector {
  margin-top: 20px;
  text-align: center;
}

.login-language-selector .language-btn {
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.login-language-selector .language-btn:hover {
  background: var(--bg-color);
}

/* Small mobile */
@media (max-width: 480px) {
  .login-container {
    margin: 16px;
    padding: 24px;
  }

  .login-container h1 {
    font-size: 24px;
    margin-bottom: 20px;
  }
}

/* ==================== END LOGIN SCREEN ==================== */

/* ==================== CHAT21 IFRAME CONTAINER ==================== */

.chat21-container {
  position: fixed;
  top: 50px; /* Account for app header */
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: calc(100vh - 50px);
  z-index: 100;
  background: #fff;
}

.chat21-container.hidden {
  display: none;
}

.chat21-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ==================== END CHAT21 IFRAME CONTAINER ==================== */

/* ==================== LANGUAGE MODAL ==================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  animation: scaleIn 0.2s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-color);
  color: var(--text-color);
}

.language-modal-content {
  max-height: 70vh;
}

.language-list {
  padding: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.language-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.language-item:hover {
  background: var(--bg-color);
}

.language-item.active {
  background: #e3f2fd;
}

.language-flag {
  font-size: 24px;
}

.language-name {
  flex: 1;
  font-size: 15px;
}

.language-check {
  color: var(--primary-color);
  font-weight: bold;
}

.language-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.language-btn:hover {
  background: var(--bg-color);
}

/* ==================== END LANGUAGE MODAL ==================== */

/* ==================== RTL SUPPORT ==================== */

[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .app-header .header-left {
  order: 2;
}

[dir="rtl"] .app-header .header-right {
  order: 1;
}

[dir="rtl"] .language-item {
  flex-direction: row-reverse;
}

/* ==================== END RTL SUPPORT ==================== */
