/* CampusBot - Bootstrap-Friendly Redesign */

/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  width: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Theme overrides for Bootstrap */
:root {
  --bs-primary: #0066cc;       /* CampusBot brand blue */
  --bs-primary-dark: #003d99;
  --bs-danger: #dc3545;
  --bs-light: #f0f4f8;
  --bs-dark: #1a3a52;
  --text-light: #5a7a91;
}

/* Background */
body {
  background: linear-gradient(135deg, #f0f4f8 0%, #dde5f0 100%);
  background-attachment: fixed;
}

/* Chat container card */
.chat-container {
  display: flex;
  flex-direction: column;
  min-height: 90vh;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 1px solid rgba(0, 102, 204, 0.15);
  box-shadow: 0 12px 40px rgba(0, 51, 153, 0.15);
  overflow: hidden;
}
/* Header */
header {
  background: linear-gradient(135deg, #0066cc 0%, #003d99 100%);
  color: #fff;
  padding: 20px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 51, 153, 0.2);
}
header h1 { font-size: 2rem; }
header p { font-size: 1rem; opacity: 0.92; }
header .header-actions {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  justify-content: center;
}
header .header-actions a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  opacity: 0.95;
  transition: all 0.2s ease;
}
header .header-actions a:hover { 
  opacity: 1;
  text-decoration: underline;
}

/* Chat area */
.chat-box {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: transparent;
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease-in;
}

/* Messages */
.bot-message, .user-message {
  max-width: 70%;
  margin: 8px 0;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 1rem;
  animation: slideUp 0.25s ease both;
}
.bot-message {
  background: rgba(224, 238, 255, 0.9);
  align-self: flex-start;
}
.user-message {
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: #fff;
  align-self: flex-end;
}
/* Typing indicator */
#typing {
  display: none;
  align-self: flex-start;
  margin: 8px 0;
}
.typing-dots {
  display: inline-flex;
  gap: 4px;
  background: rgba(224,231,255,0.3);
  padding: 10px 14px;
  border-radius: 16px;
}
.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--text-light);
  border-radius: 50%;
  animation: bounce 1s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Input bar */
#chat-form {
  display: flex;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  background: transparent;
  backdrop-filter: blur(6px);
}
#user-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
  background: rgba(240, 244, 248, 0.9);
  border: 2px solid #dde5f0;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}
#user-input:focus {
  border-color: #0066cc;
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.12), 0 4px 12px rgba(0, 102, 204, 0.15);
}

/* Base button (Bootstrap override) */
button, .btn {
  border-radius: 12px;
  transition: background 0.2s ease, transform 0.05s ease;
}
button:hover, .btn:hover { background: var(--bs-primary-dark); }
button:active, .btn:active { transform: scale(0.98); }
/* Admin link footer */
.admin-login {
  text-align: center;
  padding: 10px;
  background: transparent;
}
.admin-login a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 600;
}
.admin-login a:hover { text-decoration: underline; }

/* Forms */
.form-screen {
  display: grid;
  place-items: center;
  height: 100vh;
  width: 100vw;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(6px);
}
.form-container {
  width: 94%;
  max-width: 420px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 102, 204, 0.15);
  border-radius: 24px;
  padding: 36px 28px;
  box-shadow: 0 12px 40px rgba(0, 51, 153, 0.15);
  animation: fadeIn 0.4s ease-in;
}
.form-container h2 { color: #1a3a52; margin-bottom: 10px; font-weight: 700; }
.form-sub { color: #5a7a91; margin-bottom: 14px; }
.form-container .field { position: relative; }
.form-container input, .form-container textarea {
  width: 100%;
  padding: 12px 14px;
  margin: 10px 0;
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
  background: rgba(240, 244, 248, 0.9);
  border: 2px solid #dde5f0;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}
.form-container input:focus, .form-container textarea:focus {
  border-color: #0066cc;
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.12), 0 4px 12px rgba(0, 102, 204, 0.15);
}
.form-container .eye-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 18px;
  color: var(--text-light);
}
.form-container button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  margin-top: 6px;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.05s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 20px rgba(0, 102, 204, 0.25);
}
.form-container button:hover { 
  background: linear-gradient(135deg, #0052a3 0%, #003d99 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 102, 204, 0.35);
}
.form-container button:active { transform: scale(0.99); }
.form-links {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
.form-links a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 600;
}
.form-links a:hover { text-decoration: underline; }
.error { color: #dc2626; margin: 6px 0; }
.success { color: #16a34a; margin: 6px 0; }
/* Table styles */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 51, 153, 0.08);
  border: 1px solid rgba(0, 102, 204, 0.12);
}
.table th, .table td {
  padding: 12px;
  border-bottom: 1px solid rgba(0, 102, 204, 0.08);
  text-align: left;
}
.table th {
  background: linear-gradient(135deg, #0066cc 0%, #003d99 100%);
  color: #fff;
  font-weight: 700;
}
.table tr:last-child td { border-bottom: none; }

/* Animations */
@keyframes fadeIn { 
  from { opacity: 0; } 
  to { opacity: 1; } 
}
@keyframes slideUp { 
  from { transform: translateY(10px); opacity: 0; } 
  to { transform: translateY(0); opacity: 1; } 
}
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.85); opacity: 0.8; }
  40% { transform: scale(1); opacity: 1; }
}
/* Responsive */
@media (max-width: 768px) {
  header h1 { font-size: 1.6rem; }
  header p { font-size: 0.9rem; }
  .bot-message, .user-message { font-size: 0.95rem; }
  .form-container {
    padding: 20px;
    max-width: 95%;
  }
  #user-input {
    font-size: 0.9rem;
    padding: 10px 12px;
  }
  button, .btn {
    font-size: 0.9rem;
    padding: 0 16px;
  }
}

/* Admin panel — inline forms and action buttons */
.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-form input[type="text"] {
  margin: 4px 0;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: rgba(255,255,255,0.6);
}

/* Side-by-side action buttons */
.btn-update, .btn-delete {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.btn-update {
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}
.btn-update:hover { 
  background: linear-gradient(135deg, #0052a3 0%, #003d99 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 102, 204, 0.25);
}
.btn-delete { background: linear-gradient(135deg, #dc3545 0%, #c82333 100%); }
.btn-delete:hover { background: #c82333; box-shadow: 0 8px 18px rgba(220, 53, 69, 0.25); }

/* Utility to place forms/buttons side by side in table cells */
.actions-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Suggested questions panel */
.suggestions {
  background: rgba(241,245,249,0.1);
  padding: 12px 16px;
  border-top: 1px solid rgba(229,231,235,0.3);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  animation: fadeIn 1s ease forwards;
}
.suggestion {
  background: rgba(255,255,255,0.95);
  border: 2px solid #dde5f0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  color: #1a3a52;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.suggestion:hover {
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: #ffffff;
  border-color: #0066cc;
  transform: scale(1.05);
}

/* Mobile: horizontal scroll for suggestions */
@media (max-width: 768px) {
  .suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    justify-content: flex-start;
    padding-bottom: 10px;
    scrollbar-width: thin;
  }
  .suggestions::-webkit-scrollbar {
    height: 6px;
  }
  .suggestions::-webkit-scrollbar-thumb {
    background: rgba(59,130,246,0.5);
    border-radius: 10px;
  }
  .suggestion {
    flex: 0 0 auto; /* prevents shrinking, ensures side scroll */
  }
}


/* Logout button styled like admin */
.logout-btn {
  background: transparent;
  color: #0066cc;
  border: 2px solid #dde5f0;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}
.logout-btn:hover {
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: #ffffff;
  border-color: #0066cc;
  transform: translateY(-2px);
}
/* Suggested questions panel */
.suggestions {
  background: rgba(241,245,249,0.1);
  padding: 12px 16px;
  border-top: 1px solid rgba(229,231,235,0.3);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  animation: fadeIn 1s ease forwards;
}
/* Ensure chat container fits desktop and mobile */
.chat-container {
  width: 100%;
  max-width: 1200px;   /* keeps it neat on desktop */
  margin: 0 auto;      /* center horizontally */
  min-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* Chat box grows to fill space */
.chat-box {
  flex: 1;
  overflow-y: auto;
}

/* Suggestions horizontal scroll on mobile */
@media (max-width: 768px) {
  .suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
  }
  .suggestion {
    flex: 0 0 auto;
  }
}
/* Fullscreen chat container */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* prevent page scroll */
}

.chat-container {
  height: 100vh;   /* full viewport height */
  width: 100vw;    /* full viewport width */
  max-width: 100%; /* no extra margins */
  margin: 0;
  display: flex;
  flex-direction: column;
}

/* Chat box grows to fill space between header and form */
.chat-box {
  flex: 1;
  overflow-y: auto; /* internal scroll for messages only */
}
