* {
  box-sizing: border-box;
}

html, body {
  height: auto;
  overflow-y: auto;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  background: linear-gradient(135deg, #e8f3f9, #ffffff);
  color: #1e3a5f;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 100vh;
}

/* Flash Messages */
.flash-messages {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
}

.flash-message {
  padding: 15px 20px;
  margin-bottom: 10px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideIn 0.3s ease-out;
  font-weight: 500;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.flash-success {
  background: #d4edda;
  color: #155724;
  border-left: 4px solid #28a745;
}

.flash-danger {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
}

.flash-warning {
  background: #fff3cd;
  color: #856404;
  border-left: 4px solid #ffc107;
}

.flash-info {
  background: #d1ecf1;
  color: #0c5460;
  border-left: 4px solid #17a2b8;
}

.flash-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0;
  margin-left: 15px;
}

.flash-close:hover {
  opacity: 1;
}

/* Navigation Bar */
.navbar {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

.nav-brand i {
  font-size: 2rem;
}

.nav-menu {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s;
  padding: 10px 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.nav-link i {
  font-size: 1.2rem;
}

.nav-link:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

.logout-link {
  background: rgba(255,255,255,0.15);
  margin-left: 15px;
}

.logout-link:hover {
  background: rgba(255,255,255,0.25);
}

/* Notification Badge */
.notification-container {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: #ff4757;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Notification Dropdown */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 350px;
  max-height: 500px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.notification-dropdown.active {
  display: flex;
  animation: dropdownSlide 0.3s ease-out;
}

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

.notification-header {
  padding: 15px 20px;
  border-bottom: 2px solid #f0f0f0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.notification-header h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.notification-list {
  max-height: 400px;
  overflow-y: auto;
}

.notification-loading {
  padding: 40px;
  text-align: center;
  color: #999;
  font-size: 0.95rem;
}

.notification-item {
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  gap: 12px;
  align-items: start;
}

.notification-item:hover {
  background: #f8f9ff;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item.non-clickable {
  cursor: default;
  opacity: 0.8;
}

.notification-icon {
  font-size: 1.3rem;
  color: #667eea;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
}

.notification-message {
  color: #333;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 5px;
}

.notification-time {
  color: #999;
  font-size: 0.75rem;
}

.notification-empty {
  padding: 40px 20px;
  text-align: center;
  color: #999;
}

.notification-empty i {
  font-size: 3rem;
  color: #ddd;
  margin-bottom: 15px;
}

/* Mobile Navigation */
.nav-user-mobile {
  display: none;
  align-items: center;
  gap: 15px;
  color: white;
}

.user-name {
  font-weight: 500;
  font-size: 0.9rem;
}

.nav-toggle {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s;
}

.nav-toggle:hover {
  background: rgba(255,255,255,0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-container {
    padding: 12px 20px;
  }
  
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-direction: column;
    gap: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  }
  
  .nav-menu.active {
    max-height: 400px;
  }
  
  .nav-link {
    width: 100%;
    padding: 15px 30px;
    border-radius: 0;
    justify-content: flex-start;
  }
  
  .nav-text {
    display: inline;
  }
  
  .logout-link {
    margin-left: 0;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  
  .nav-user-mobile {
    display: flex;
  }
}

@media (min-width: 769px) {
  .nav-text {
    display: inline;
  }
}

/* Legacy styles cleanup */
.nav-user {
  display: none;
}

.user-info {
  display: none;
}

.btn-logout {
  display: none;
}

/* Main Content */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  padding: 30px 20px;
}

/* Footer */
.footer {
  width: 100%;
  padding: 20px;
  text-align: center;
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  margin-top: auto;
}

.container {
  text-align: center;
  width: 90%;
  max-width: 1000px;
  position: relative;
  overflow: visible;             /* 👈 prevents scroll blocking */
}

.logo {
  width: 90px;
  margin-bottom: 10px;
}

header h1 {
  font-weight: 600;
  font-size: 2.5rem;
}

header h1 span {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header p {
  font-size: 1.1rem;
  color: #3f5873;
  margin-bottom: 40px;
}

.options {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

.card {
  background: white;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.1);
  padding: 30px 20px;
  width: 280px;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  text-align: center;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 25px rgba(42,125,225,0.2);
}

.card i {
  font-size: 60px;
  color: #2a7de1;
  margin-bottom: 20px;
}

.card h2 {
  color: #2a7de1;
  margin-bottom: 10px;
}

.card p {
  font-size: 0.95rem;
  color: #4a607f;
}

footer {
  margin-top: 50px;
  font-size: 0.9rem;
  color: #6b7c93;
}

.heart-icon {
  color: #e63946;
  margin: 0 5px;
  vertical-align: middle;
}

/* ---------- Prescription Reader Page ---------- */
.upload-section {
  margin: 40px auto;
  max-width: 500px;
}

.drop-area {
  border: 2px dashed #764ba2;
  border-radius: 15px;
  padding: 40px 20px;
  text-align: center;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  color: #4a4a68;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.drop-area.dragover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
  border-color: #667eea;
}

.upload-icon {
  font-size: 60px;
  color: #764ba2;
  margin-bottom: 15px;
}

.preview-container {
  position: relative;
  text-align: center;
}

.preview-container img {
  max-width: 100%;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.remove-btn {
  margin-top: 10px;
  background-color: #e63946;
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.3s;
}

.remove-btn:hover {
  background-color: #c52d38;
}

.explain-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 25px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
}

.explain-btn:disabled {
  background: linear-gradient(135deg, #b8b8d1 0%, #c4a4cc 100%);
  cursor: not-allowed;
  box-shadow: none;
}

.explain-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4);
}

/* ---------- Back Button ---------- */
.back-btn {
  position: absolute;
  top: 25px;
  right: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s;
  box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
  z-index: 100;
}

.back-btn i {
  font-size: 1rem;
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4);
}

/* ---------- Result Output ---------- */
.result-container {
  margin-top: 30px;
  text-align: left;
  width: 100%;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  overflow: visible;          /* allow expansion without breaking scroll */
}

.result-container h3 {
  color: #764ba2;
  margin-bottom: 10px;
  font-weight: 600;
}

.result-box {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  border-radius: 12px;
  padding: 15px 20px;
  margin-top: 15px;
  max-height: 300px;
  overflow-y: auto;
  white-space: normal;
  text-align: left;
  line-height: 1.6;
  border: 1px solid rgba(118, 75, 162, 0.2);
  box-shadow: inset 0 0 5px rgba(118, 75, 162, 0.1);
}

/* Markdown formatting styles */
.result-box h2, .result-box h3, .result-box h4 {
  color: #764ba2;
  margin-top: 15px;
  margin-bottom: 8px;
  font-weight: 600;
}

.result-box ul {
  padding-left: 25px;
  margin: 8px 0;
}

.result-box li {
  list-style-type: disc;
  margin-bottom: 4px;
}

/* Scrollbar styling */
.result-box::-webkit-scrollbar {
  width: 8px;
}
.result-box::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
}
.result-box::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5568d3 0%, #64397a 100%);
}
/* ------------ CHAT BOT PAGE ------------ */

.chat-window {
    width: 100%;
    max-height: 650px;   /* Increased */
    min-height: 450px;   /* Increased */
    overflow-y: auto;
    background: #ffffff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 6px 18px rgba(118, 75, 162, 0.15);
    border: 1px solid rgba(118, 75, 162, 0.1);
    margin-bottom: 20px;
}

.msg {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
}

.bot-msg .bubble {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: #4a4a68;
}

.user-msg {
    justify-content: flex-end;
}

.user-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.bubble {
    padding: 12px 15px;
    border-radius: 12px;
    max-width: 75%;
    line-height: 1.5;
    font-size: 0.95rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}

/* Input box */
.chat-input-box {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 25px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 15px;
    border-radius: 12px;
    border: 2px solid rgba(118, 75, 162, 0.3);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.chat-input:focus {
    outline: none;
    border-color: #764ba2;
}

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.25s ease;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
}
.send-btn:hover {
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.5);
    transform: translateY(-2px);
}

/* Typing dots animation */
.dots::after {
    content: "...";
    font-size: 22px;
    letter-spacing: 3px;
    color: #764ba2;   /* Purple for theme consistency */
    font-weight: 800;
    animation: blink 1s infinite;
}


@keyframes blink {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* New chat button */
.new-chat-inline {
    background: #ff6b6b;
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: 0.25s ease;
}
.new-chat-inline:hover {
    background: #ff3b3b;
    box-shadow: 0 0 10px rgba(255, 80, 80, 0.7);
    transform: translateY(-2px);
}

/* Icon-based avatar */
.icon-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-right: 10px;
    box-shadow: 0 2px 8px rgba(118, 75, 162, 0.3);
}
/* Force left alignment for chat messages */
.chat-window {
    text-align: left !important;
}

.msg {
    text-align: left !important;
}

.bubble {
    text-align: left !important;
}

/* Prescriptions Page - Two Sections */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 40px;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.section-divider {
  border-top: 2px solid #e0e0e0;
  padding-top: 40px;
}

.count-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-upload {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
}

.btn-upload:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.uploading-message {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border: 2px solid #667eea;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  margin: 20px 0;
  font-size: 1.1rem;
  color: #667eea;
  font-weight: 600;
}

.uploading-message i {
  margin-right: 10px;
  font-size: 1.3rem;
}

.empty-section {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  background: #f9f9f9;
  border-radius: 10px;
  margin-top: 20px;
}

.empty-section i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-section p {
  font-size: 1.1rem;
  margin: 0;
}

.prescription-card.uploaded {
  border-left: 4px solid #667eea;
}

.doctor-icon.uploaded {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.prescription-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.btn-delete-small {
  background: #ff4757;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-delete-small:hover {
  background: #e84053;
  transform: scale(1.1);
}

.ai-note {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  padding: 10px;
  border-radius: 6px;
  border-left: 3px solid #667eea;
  font-style: italic;
  color: #555;
}

/* Password Toggle Eye Icon */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrapper input {
  padding-right: 45px;
  width: 100%;
}

.password-toggle {
  position: absolute;
  right: 15px;
  color: #999;
  cursor: pointer;
  transition: color 0.3s ease;
  font-size: 1.1rem;
}

.password-toggle:hover {
  color: #667eea;
}

.password-toggle.fa-eye-slash {
  color: #667eea;
}
