/* ==========================================================
   AI Nursing Portal v8.3 – Hospital Professional Style
   Includes: Login, Dashboard, Sidebar, Chatbot, Dark Mode
   ========================================================== */

/* GLOBAL RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Roboto, sans-serif;
}

body {
  background: #f8f9fa;
  color: #212529;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 250px;
  background: #007bff;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  transition: left 0.3s ease;
}

.sidebar h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.sidebar nav a {
  display: block;
  color: white;
  text-decoration: none;
  padding: 10px;
  border-radius: 6px;
  margin: 5px 0;
  transition: background 0.2s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255, 255, 255, 0.2);
}

.logo {
  width: 60px;
  border-radius: 10px;
  background: #fff;
  padding: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* CONTENT AREA */
.content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

h1, h2 {
  margin-bottom: 15px;
}

/* GRID CARDS */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  text-align: center;
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-3px);
}

/* TABLE (EHR) */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 10px;
  overflow: hidden;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  text-align: left;
}

th {
  background: #007bff;
  color: white;
}

/* CHATBOT */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 65vh;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.chat-window {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}

.msg {
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 80%;
}

.msg.user {
  background: #007bff;
  color: white;
  margin-left: auto;
}

.msg.ai {
  background: #e9ecef;
  color: #000;
}

.chat-input {
  display: flex;
  padding: 10px;
  border-top: 1px solid #ddd;
}

.chat-input input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
}

.chat-input button {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  margin-left: 8px;
  cursor: pointer;
}

/* DARK MODE */
@media (prefers-color-scheme: dark) {
  body {
    background: #121212;
    color: #eaeaea;
  }
  .sidebar {
    background: #0d6efd;
  }
  .card, table {
    background: #1e1e1e;
    color: #ddd;
  }
  th {
    background: #0d6efd;
  }
}

/* RESPONSIVE SIDEBAR TOGGLE */
.menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.5rem;
  padding: 8px 12px;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
}

@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100%;
    z-index: 1002;
    transition: left 0.3s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .content {
    margin-left: 0;
    margin-top: 70px;
    padding: 20px;
  }
}

/* ========================= LOGIN PAGE ========================= */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  color: #fff;
  overflow: hidden;
  position: relative;
  background: linear-gradient(120deg, #007bff, #004b9a, #007bff);
  background-size: 200% 200%;
  animation: gradientMove 8s ease infinite;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.login-container {
  background: rgba(255, 255, 255, 0.18);
  padding: 45px 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
  animation: fadeSlide 1s ease-out;
}

@keyframes fadeSlide {
  0% { transform: translateY(40px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Logo */
.login-container .logo {
  width: 80px;
  margin-bottom: 15px;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  transition: transform 0.6s;
}

.login-container .logo:hover {
  transform: rotate(8deg) scale(1.05);
}

/* Tiêu đề động */
.hospital-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
  margin-bottom: 10px;
  animation: titleFade 3s ease-in-out infinite;
}

@keyframes titleFade {
  0%, 100% { opacity: 0.9; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

/* Hệ thống AI Bệnh viện */
.login-container h1 {
  margin-bottom: 25px;
  font-weight: 700;
  font-size: 1.9rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* Input */
.login-container input {
  display: block;
  width: 290px;
  margin: 12px auto;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 8px;
  background: rgba(255,255,255,0.97);
  color: #000;
  outline: none;
  transition: 0.2s ease;
}

.login-container input:focus {
  border-color: #28a745;
  box-shadow: 0 0 10px rgba(40, 167, 69, 0.4);
}

/* Buttons */
.login-container button {
  width: 290px;
  margin-top: 14px;
  padding: 12px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: #28a745;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
}

.login-container button:hover {
  background: #23913a;
  transform: translateY(-2px);
}

.login-container p {
  color: #ffecec;
  margin-top: 12px;
  font-weight: 500;
}

/* Nút ngôn ngữ */
.login-container #langBtn {
  margin-top: 18px;
  background: #28a745;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  color: #fff;
  transition: 0.3s;
}

.login-container #langBtn:hover {
  background: #23913a;
  box-shadow: 0 0 8px rgba(255,255,255,0.3);
}

/* Hiệu ứng icon ngôn ngữ */
#langBtn {
  position: relative;
  overflow: hidden;
}

#langBtn::after {
  content: "🌐";
  position: absolute;
  right: 10px;
  opacity: 0.7;
}

/* Responsive Login */
@media (max-width: 600px) {
  .login-container {
    width: 90%;
    padding: 30px 25px;
  }
  .login-container h1 {
    font-size: 1.6rem;
  }
  .hospital-title {
    font-size: 1.2rem;
  }
}
/* ============= CHATBOT ENHANCEMENTS ============= */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 70vh;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.chat-window {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.msg {
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
  line-height: 1.4;
  animation: fadeIn 0.3s ease;
}

.msg.user {
  background: #007bff;
  color: white;
  margin-left: auto;
}

.msg.ai {
  background: #e9ecef;
  color: #000;
}

.msg.typing {
  font-style: italic;
  opacity: 0.7;
}

.chat-input {
  display: flex;
  padding: 10px;
  border-top: 1px solid #ddd;
  background: #fafafa;
}

.chat-input input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
}

.chat-input button {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  margin-left: 8px;
  cursor: pointer;
  transition: 0.3s;
}

.chat-input button:hover {
  background: #23913a;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
