:root {
  --primary: #c99c33;
  --primary-glow: rgba(201, 156, 51, 0.4);
  --secondary: #1a365d;
  --bg-dark: #070b19;
  --bg-card: rgba(10, 17, 40, 0.4);
  --text-main: #f0f2f5;
  --text-muted: #a0a5b5;
  --text-gold: #e2b714;
  --glass-border: rgba(255, 255, 255, 0.08);
  --chat-user: rgba(201, 156, 51, 0.15);
  --chat-ai: rgba(26, 54, 93, 0.5);
  --success: #00ffa3;
}

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

body {
  font-family: 'Outfit', 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 50%, rgba(201, 156, 51, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(26, 54, 93, 0.4) 0%, transparent 45%);
}

.app-layout.column-layout {
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 1000px) {
  .app-layout.column-layout {
    overflow-y: auto;
  }
}

/* Banner Section (Top Row) */
.banner-section {
  width: 100%;
  height: 35vh;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 10;
}

.banner-image {
  width: 100%;
  height: 100%;
  position: relative;
}

.banner-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.banner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, rgba(7, 11, 25, 0.95) 0%, rgba(7, 11, 25, 0.5) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 80px;
}



.hero-content {
  position: relative;
  z-index: 1;
  max-width: 600px;
}

.hero-title {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 20px;
  animation: fadeUp 0.8s ease-out forwards;
  opacity: 0;
}

.text-gold {
  color: var(--text-gold);
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
  animation: fadeUp 1s ease-out 0.2s forwards;
  opacity: 0;
}

.hero-credits {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 500;
  letter-spacing: 0.5px;
  animation: fadeUp 1s ease-out 0.3s forwards;
  opacity: 0;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Chat Section Adjustments */
.chat-section.full-width {
  display: flex;
  flex-direction: column;
  height: 65vh;
  padding: 30px 50px;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 1000px) {
  .chat-section.full-width {
     min-height: 65vh;
     padding: 20px;
     height: auto;
  }
}

.chat-container.glass-panel {
  flex: 1;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeUp 1s ease-out 0.4s forwards;
  opacity: 0;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 30px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--glass-border);
}

.brand-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-gold);
}

.chat-history {
  flex: 1;
  min-height: 0;
  padding: 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  padding: 16px 20px;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  animation: slideUp 0.3s ease-out forwards;
}

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

.message.user {
  align-self: flex-end;
  background: var(--chat-user);
  border: 1px solid var(--primary-glow);
  border-bottom-right-radius: 4px;
}

.message.ai {
  align-self: flex-start;
  background: var(--chat-ai);
  border: 1px solid rgba(26, 54, 93, 1);
  border-bottom-left-radius: 4px;
}

.message .sources {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--primary);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 8px;
}

/* Scholar-segregated answer styling */
.scholar-header {
  color: var(--text-gold, #e2b714);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 16px 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(201, 156, 51, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.scholar-header:first-child {
  margin-top: 0;
}

.scholar-divider {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(201, 156, 51, 0.45), transparent);
  margin: 20px 0;
}

.scholar-ref-box {
  margin-top: 10px;
  margin-bottom: 8px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--primary, #c99c33);
  border-radius: 4px;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.scholar-ref-box strong {
  color: var(--text-gold, #e2b714);
}

.input-area {
  padding: 20px 30px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--glass-border);
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 6px 12px;
  transition: all 0.3s;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px;
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
}

.language-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 6px 10px;
  margin-right: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.language-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.send-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  padding: 8px;
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  display: flex;
  align-items: center;
}

.send-btn:hover {
  transform: scale(1.1);
  color: var(--text-gold);
}

/* --- Brand Header Navigation Tabs --- */
.brand-header {
  justify-content: space-between;
}

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

.nav-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.nav-tab:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* --- Tab Views --- */
.tab-view {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.tab-view.active {
  display: flex;
}

/* --- Admin Container & Sub-tabs --- */
.admin-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 30px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.import-mode-bar {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 12px;
}

.sub-tab {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
}

.sub-tab.active {
  border-color: var(--primary);
  color: var(--text-gold);
  background: rgba(201, 156, 51, 0.1);
}

.import-section {
  display: none;
}

.import-section.active {
  display: block;
}

/* --- File Dropzone --- */
.dropzone {
  border: 2px dashed var(--primary);
  background: rgba(201, 156, 51, 0.03);
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
}

.dropzone:hover, .dropzone.dragover {
  background: rgba(201, 156, 51, 0.08);
  border-color: var(--text-gold);
  box-shadow: 0 0 25px var(--primary-glow);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.dropzone-content svg {
  color: var(--primary);
}

.dropzone-content h3 {
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #a67c1e 100%);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(201, 156, 51, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201, 156, 51, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.file-card {
  margin-top: 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  padding: 16px 20px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-title {
  font-weight: 600;
  color: var(--text-gold);
}

.file-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.file-options {
  display: flex;
  align-items: center;
  gap: 16px;
}

.checkbox-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* --- Manual Text Form --- */
.manual-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(0,0,0,0.3);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-gold);
}

.form-group input, .form-group textarea {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all 0.3s;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* --- Spinner & Status --- */
.import-status {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(26, 54, 93, 0.4);
  border: 1px solid rgba(26, 54, 93, 0.8);
  padding: 16px 20px;
  border-radius: 12px;
  color: var(--text-main);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Preview Card --- */
.result-preview {
  background: rgba(0, 255, 163, 0.05);
  border: 1px solid rgba(0, 255, 163, 0.3);
  border-radius: 16px;
  padding: 20px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.preview-header h4 {
  color: var(--success);
  font-size: 1.1rem;
}

.badge {
  background: var(--primary);
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.preview-body p {
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.preview-body p strong {
  color: var(--text-main);
}

.preview-text-box {
  margin-top: 12px;
}

.preview-text-box label {
  font-size: 0.85rem;
  color: var(--text-gold);
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

#preview-text {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--glass-border);
  padding: 12px;
  border-radius: 8px;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* --- Database Table --- */
.db-manager-section {
  margin-top: 10px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
}

.db-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.db-header h3 {
  font-size: 1.1rem;
  color: var(--text-gold);
}

.table-wrapper {
  overflow-x: auto;
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.db-table th {
  padding: 12px 16px;
  background: rgba(0,0,0,0.4);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--glass-border);
}

.db-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.9rem;
  color: var(--text-main);
}

.btn-danger {
  background: rgba(255, 75, 75, 0.15);
  color: #ff5c5c;
  border: 1px solid rgba(255, 75, 75, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #ff4b4b;
  color: #fff;
}

.hidden { display: none !important; }
.text-center { text-align: center; }

/* --- Admin Password Auth Screen --- */
.auth-card {
  max-width: 480px;
  margin: 40px auto;
  background: rgba(10, 17, 40, 0.6);
  border: 1px solid var(--primary-glow);
  border-radius: 20px;
  padding: 36px 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(15px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
}

.shield-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 12px;
  background: rgba(201, 156, 51, 0.1);
  border: 1px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-gold);
  box-shadow: 0 0 20px var(--primary-glow);
}

.auth-header h3 {
  font-size: 1.3rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-error {
  color: #ff5c5c;
  background: rgba(255, 75, 75, 0.1);
  border: 1px solid rgba(255, 75, 75, 0.3);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.full-width {
  width: 100%;
}

.admin-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.auth-status-badge {
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(0, 255, 163, 0.1);
  border: 1px solid rgba(0, 255, 163, 0.3);
  padding: 6px 12px;
  border-radius: 20px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
