/* === Global Reset === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

/* === Body === */
body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: background 0.3s ease;
}

/* === Auth Wrapper (for index.html) === */
.auth-wrapper {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  width: 100%;
  align-items: center;
}

/* === Modern Card Design === */
.modern-card {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* === Card Containers === */
.auth-container,
.welcome-container,
.chat-container {
  background: #fff;
  border-radius: 1.5rem;
  width: 100%;
  max-width: 450px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  animation: slide-up 0.6s ease;
  transition: all 0.3s ease;
}

.chat-container {
  max-width: 600px;
  height: 85vh;
  display: flex;
  flex-direction: column;
}

/* === Logo Container === */
.logo-container {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.logo-container i {
  font-size: 2rem;
  color: white;
}

/* === Header Section === */
.auth-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 2.5rem 2rem;
  color: #fff;
}

.auth-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.auth-header p {
  font-size: 1rem;
  opacity: 0.95;
  font-weight: 300;
}

.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1.2rem 1.5rem;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.header-buttons {
  display: flex;
  gap: 10px;
}

.theme-btn,
.logout-btn {
  width: auto;
  padding: 8px 16px;
  font-size: 0.85rem;
  margin-top: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.theme-btn:hover,
.logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* === Content Area === */
.auth-content {
  padding: 2.5rem;
}

.welcome-container {
  padding: 2rem;
}
#user-email {
  word-wrap: break-word;
  word-break: break-all;
  display: block;
  max-width: 100%;
  font-size: 1.1rem;
  font-weight: 600;
  color: #667eea;
}

/* === Input Groups === */
.input-group {
  position: relative;
  margin: 1rem 0;
}

.input-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 1rem;
  z-index: 1;
}

/* === Inputs === */
input {
  width: 100%;
  padding: 14px 15px 14px 45px;
  margin: 0;
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  outline: none;
  font-size: 0.95rem;
  transition: all 0.3s;
  background: #f8f9fa;
}

input:focus {
  border-color: #667eea;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

input:focus + .input-icon,
input:not(:placeholder-shown) + .input-icon {
  color: #667eea;
}

.message-inputs {
  display: flex;
  padding: 15px;
  gap: 10px;
  background: #fff;
  border-top: 1px solid #e8e8e8;
}

.message-inputs input {
  margin: 0;
  flex: 1;
  padding: 12px 15px;
  background: #f8f9fa;
}

.message-inputs button {
  width: auto;
  margin: 0;
  padding: 12px 24px;
  border-radius: 12px;
}

/* === Buttons === */
button {
  width: 100%;
  padding: 14px;
  margin-top: 1rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

button:active {
  transform: translateY(0);
}

.primary-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  position: relative;
  overflow: hidden;
}

.primary-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s;
}

.primary-btn:hover::before {
  left: 100%;
}

/* === Google Button === */
.google-btn {
  background: #fff;
  color: #333;
  border: 2px solid #e8e8e8;
}

.google-btn:hover {
  background: #f8f9fa;
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.google-btn i {
  font-size: 1.2rem;
  color: #4285f4;
}

/* === Divider === */
.divider {
  margin: 1.5rem 0;
  text-align: center;
  position: relative;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #e8e8e8;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.divider span {
  background: #fff;
  padding: 0 15px;
  color: #999;
  font-size: 0.85rem;
  position: relative;
}

/* === Links === */
.auth-switch {
  margin-top: 2rem;
  color: #666;
  font-size: 0.9rem;
}

a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s;
}

a:hover {
  color: #764ba2;
  text-decoration: underline;
}

/* === Features Panel === */
.features-panel {
  flex: 1;
  color: white;
  padding: 2rem;
  animation: fade-in-right 0.8s ease;
}

.features-panel h3 {
  font-size: 1.8rem;
  margin-bottom: 2rem;
  font-weight: 600;
}

.feature-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.feature-item i {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 15px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.feature-item h4 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.feature-item p {
  font-size: 0.9rem;
  opacity: 0.9;
  line-height: 1.5;
}

/* === Chat Message Box === */
.message-box {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background 0.3s ease;
}

.message-box::-webkit-scrollbar {
  width: 6px;
}

.message-box::-webkit-scrollbar-track {
  background: transparent;
}

.message-box::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.message-box::-webkit-scrollbar-thumb:hover {
  background: #999;
}

.message {
  padding: 12px 15px;
  border-radius: 12px;
  position: relative;
  text-align: start;
  max-width: 75%;
  word-wrap: break-word;
  transition: all 0.2s ease;
  animation: message-appear 0.3s ease;
}

@keyframes message-appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.own {
  align-self: flex-end;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.message.other {
  align-self: flex-start;
  background: #fff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-header {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 5px;
}

.message.own .message-header {
  color: rgba(255, 255, 255, 0.9);
}

.message.other .message-header {
  color: #667eea;
}

.message-text {
  margin-bottom: 5px;
  line-height: 1.4;
}

.edited-badge {
  font-size: 0.7rem;
  font-style: italic;
  opacity: 0.7;
}

.message-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.2s;
  margin-top: 8px;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-action {
  background: rgba(0, 0, 0, 0.1);
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 8px;
  width: auto;
  border-radius: 6px;
  transition: all 0.2s;
}

.message.own .message-action {
  background: rgba(255, 255, 255, 0.2);
}

.message-action:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.message.own .message-action:hover {
  background: rgba(255, 255, 255, 0.3);
}

.message-time {
  font-size: 0.7rem;
  opacity: 0.7;
  text-align: right;
  margin-top: 4px;
}

/* === Loading Spinner === */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(5px);
}

.loading.hidden {
  display: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading p {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: #fff;
  font-weight: 500;
}

/* === Dark Theme for toogle=== */
body.dark-theme {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

body.dark-theme .modern-card {
  background: rgba(15, 52, 96, 0.95);
  color: #f0f0f0;
}

body.dark-theme .auth-container,
body.dark-theme .welcome-container,
body.dark-theme .chat-container {
  background: #0f3460;
  color: #f0f0f0;
}

body.dark-theme .message-box {
  background: #16213e;
}

body.dark-theme .message.own {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

body.dark-theme .message.other {
  background: #1a1a2e;
  color: #f0f0f0;
  border: 1px solid #533483;
}

body.dark-theme input {
  background: #16213e;
  border-color: #533483;
  color: #f0f0f0;
}

body.dark-theme input:focus {
  border-color: #667eea;
  background: #1a1a2e;
}

body.dark-theme .input-icon {
  color: #999;
}

body.dark-theme input:focus + .input-icon {
  color: #667eea;
}

body.dark-theme .divider::before,
body.dark-theme .divider::after {
  background: #533483;
}

body.dark-theme .divider span {
  background: #0f3460;
  color: #ccc;
}

body.dark-theme .google-btn {
  background: #16213e;
  border-color: #533483;
  color: #f0f0f0;
}

body.dark-theme .google-btn:hover {
  background: #1a1a2e;
  border-color: #667eea;
}

body.dark-theme .message-inputs {
  background: #0f3460;
  border-top-color: #533483;
}

body.dark-theme .message-inputs input {
  background: #16213e;
}

/* === Animations === */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes slide-up {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fade-in-right {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.7s ease-in;
}

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

@keyframes message-remove {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}
/* Index page buttons - hide on small screens */
.index-header-buttons {
  position: fixed;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 10px;
  z-index: 9999;
}


/* Chat page buttons - always visible */
.header-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.auth-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
}
/* === Responsive Design === */
@media (max-width: 992px) {
  .auth-wrapper {
    flex-direction: column;
  }

  .features-panel {
    display: none;
  }
}

@media (max-width: 480px) {
  .index-header-buttons {
    display: none;
  }
  .auth-container,
  .welcome-container,
  .chat-container {
    width: 100%;
    border-radius: 1rem;
  }

  .auth-header h2 {
    font-size: 1.6rem;
  }

  .chat-header {
    flex-direction: column;
    gap: 10px;
    padding: 1rem;
  }

  .header-buttons {
    width: 100%;
    justify-content: center;
  }

  .auth-content {
    padding: 2rem 1.5rem;
  }

  input,
  button {
    font-size: 0.9rem;
  }

  .message {
    max-width: 85%;
  }

  .logo-container {
    width: 60px;
    height: 60px;
  }

  .logo-container i {
    font-size: 1.5rem;
  }
}

@media (max-width: 375px) {
  #user-email {
    font-size: 0.9rem; /* Chhoti font size */
  }
}

/* === SweetAlert Theme Support === */

/* Light mode default */
.swal2-popup {
  background: #fff !important;
  color: #333 !important;
  border-radius: 16px !important;
  padding: 1.8rem !important;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15) !important;
}

.swal2-title {
  font-weight: 600 !important;
  margin-bottom: 10px !important;
}

.swal2-confirm,
.swal2-cancel {
  border-radius: 10px !important;
  padding: 10px 18px !important;
  font-weight: 600 !important;
}

/* === Dark Mode SweetAlert === */
body.dark-theme .swal2-popup {
  background: #0f3460 !important;
  color: #f0f0f0 !important;
  border: 1px solid #533483 !important;
  box-shadow: 0 0 40px rgba(102, 126, 234, 0.4) !important;
}

body.dark-theme .swal2-title,
body.dark-theme .swal2-html-container {
  color: #f0f0f0 !important;
}

/* Confirm Button */
body.dark-theme .swal2-confirm {
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5) !important;
}

body.dark-theme .swal2-confirm:hover {
  transform: translateY(-2px);
}

/* Cancel Button */
body.dark-theme .swal2-cancel {
  background: #1a1a2e !important;
  color: #f0f0f0 !important;
  border: 1px solid #533483 !important;
}

body.dark-theme .swal2-cancel:hover {
  background: #16213e !important;
}
