:root {
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --primary-blue-light: #dbeafe;
  --success-green: #10b981;
  --success-green-hover: #059669;
  --warning-orange: #f59e0b;
  --error-red: #ef4444;

  /* Neutral Colors */
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Typography */
  --font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;

  /* Spacing */
  --sidebar-width: 280px;
  --border-radius: 4px;
  --border-radius-lg: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, var(--primary-blue) 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Auth Container */
#authContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-box {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  min-width: 320px;
  animation: slideIn 0.5s ease-out;
}

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

.auth-box h1 {
  color: var(--gray-800);
  margin-bottom: 10px;
  font-size: 2em;
}

.auth-box p {
  color: var(--gray-600);
  margin-bottom: 30px;
  font-size: 1.1em;
}

.auth-box input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 16px;
  transition: all 0.3s ease;
}

.auth-box input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-box button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #764ba2 100%);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.auth-box button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.auth-box button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#authError {
  color: var(--error-red);
  margin-top: 16px;
  font-weight: 500;
  display: none;
}

/* Main Layout */
#mainContent {
  display: none;
  min-height: 100vh;
  padding-left: var(--sidebar-width);
  transition: all 0.3s ease;
}

#mainContent.authenticated {
  display: block;
}

/* Sidebar Styles */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 240px;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid #e8e8e8;
  z-index: 20;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  font-size: 1.1rem;
  color: #1a1a1a;
}

.sidebar-nav {
  padding: 1rem 0;
}

.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 276px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  width: 36px;
  height: 36px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 1001;
  display: none;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  color: var(--gray-600);
  transition: all 0.2s ease;
}

.sidebar-toggle.visible {
  display: flex;
}

.sidebar-toggle:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.sidebar.collapsed + .sidebar-toggle {
  left: 16px;
}

.nav-section {
  margin-bottom: 30px;
}

.nav-section-title {
  padding: 0 20px;
  margin-bottom: 12px;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--gray-600);
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--primary-blue-light);
  color: var(--primary-blue);
  border-left-color: var(--primary-blue);
}

.nav-item.active {
  background: var(--primary-blue-light);
  color: var(--primary-blue);
  border-left-color: var(--primary-blue);
  font-weight: 600;
}

.nav-item-icon {
  font-size: 1.2em;
  min-width: 20px;
}

.nav-item.active {
  color: #1a1a1a;
  background: #f0f0f0;
  font-weight: 500;
  border-right: 2px solid #1a1a1a;
}

.nav-item-text {
  font-size: 14px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  color: #1a1a1a;
}

/* Header */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-left: -40px;
}

.header-left {
  display: flex;
  align-items: center;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: 16px;
  width: 500px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #86868b;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #f5f5f7;
}

.modal-body {
  padding: 24px;
}

/* Tabs */
.tabs {
  border-bottom: 1px solid #e5e5e7;
  margin-bottom: 24px;
}

.tab-list {
  display: flex;
  gap: 0;
}

.tab-button {
  padding: 12px 20px;
  background: none;
  border: none;
  color: #86868b;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  position: relative;
}

.tab-button.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.tab-button:hover:not(.active) {
  color: #1d1d1f;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #1d1d1f;
  font-size: 14px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.coming-soon {
  text-align: center;
  padding: 40px 20px;
  color: #86868b;
  font-size: 16px;
}

.coming-soon-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* Connection Settings Button */
.connection-settings-btn {
  padding: 8px 16px;
  border: 1px solid #d2d2d7;
  background: white;
  color: #1d1d1f;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.connection-settings-btn:hover {
  background: #f5f5f7;
  border-color: #a1a1aa;
}

.modal-actions {
  padding: 0 24px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-secondary {
  background: #f5f5f7;
  color: #1d1d1f;
}

.btn-secondary:hover {
  background: #e5e5e7;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5a67d8;
}

.btn-primary:disabled {
  background: #d2d2d7;
  cursor: not-allowed;
}

.page-title {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0;
}

.header-right {
  display: flex;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray-600);
}

.logout-btn {
  background: linear-gradient(135deg, var(--error-red) 0%, #c0392b 100%);
  color: var(--white);
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Profile Content Layout */
.profile-content {
  padding: 40px;
  max-width: 1400px;
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.profile-main {
  flex: 1;
  max-width: 800px;
}

.profile-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}

.profile-header {
  text-align: center;
  margin-bottom: 40px;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3em;
  color: var(--white);
  margin: 0 auto 20px;
}

.profile-info {
  display: grid;
  gap: 24px;
}

.info-group {
  display: grid;
  gap: 12px;
}

.info-label {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 1.1em;
}

.info-value {
  background: var(--primary-blue-light);
  padding: 16px;
  color: var(--gray-700);
  font-family: "Monaco", "Menlo", monospace;
  word-break: break-all;
}

.rag-input {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 16px;
  resize: vertical;
  min-height: 120px;
  transition: all 0.3s ease;
}

.rag-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.save-btn {
  background: linear-gradient(135deg, var(--primary-blue) 0%, #764ba2 100%);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 16px;
}

.save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

/* Statistics Cards */
.profiel-spendind {
  flex: 0 0 400px;
  padding: 0;
}

.spending-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}

.spending-header {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.emails-status,
.lead-generation-spend,
.call-time {
  padding: 24px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

.emails-status {
  background: linear-gradient(
    135deg,
    var(--primary-blue) 0%,
    var(--primary-blue-hover) 100%
  );
  color: var(--white);
}

.call-time {
  background: linear-gradient(135deg, #ff6666 0%, #540101 100%);
  color: var(--white);
}

.lead-generation-spend {
  background: linear-gradient(
    135deg,
    var(--success-green) 0%,
    var(--success-green-hover) 100%
  );
  color: var(--white);
}

.emails-status::before,
.lead-generation-spend::before,
.call-time::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(30px, -30px);
}

.call-status {
  background: linear-gradient(135deg, var(--success-green) 0%, #3afa00 100%);
  color: var(--white);
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.call-status:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.call-status a {
  text-decoration: none;
  color: white;
}

.header-right-actions {
  display: flex;
  align-items: center;
  margin-left: 500px;
  gap: 12px;
}

.emails-status h3,
.lead-generation-spend h3,
.call-time h3 {
  font-size: 1.3em;
  margin-bottom: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.emails-status p,
.lead-generation-spend p,
.call-time p {
  margin-bottom: 12px;
  font-size: 0.95em;
  opacity: 0.9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.emails-status p:last-child,
.lead-generation-spend p:last-child,
.call-time p:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.emails-status p span,
.lead-generation-spend p span,
.call-time p span {
  font-weight: 600;
  font-size: 1.1em;
}

/* Notification */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  transform: translateX(400px);
  transition: all 0.3s ease;
}

.notification.show {
  transform: translateX(0);
}

.notification.success {
  border-left: 4px solid var(--success-green);
}

.notification.error {
  border-left: 4px solid var(--error-red);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .profile-content {
    flex-direction: column;
  }

  .profiel-spendind {
    flex: none;
    max-width: 100%;
  }

  .spending-header {
    flex-direction: row;
    gap: 20px;
  }

  .emails-status,
  .lead-generation-spend {
    flex: 1;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar-toggle {
    left: 16px;
    display: flex;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  #mainContent {
    padding-left: 0;
  }

  .profile-content {
    padding: 20px;
  }

  .profile-card {
    padding: 24px;
  }

  .spending-header {
    flex-direction: column;
  }

  .header {
    padding: 16px 20px;
  }
}

@media (max-width: 480px) {
  .emails-status p,
  .lead-generation-spend p {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .emails-status p span,
  .lead-generation-spend p span {
    font-weight: 700;
  }

  .sidebar-header {
    margin-bottom: 16px;
  }

  .sidebar-header h2 {
    font-size: 18px;
  }
}

.hidden {
  display: none !important;
}

.file-upload-section {
  margin-top: 15px;
  padding: 15px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  background: #fafafa;
  transition: all 0.3s ease;
}

.file-upload-section:hover {
  border-color: #007bff;
  background: #f0f8ff;
}

.file-upload-section.dragover {
  border-color: #007bff;
  background: #e3f2fd;
  transform: scale(1.02);
}

.file-input-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-input-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background: #007bff;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
  font-weight: 500;
}

.file-input-label:hover {
  background: #0056b3;
}

.file-info {
  margin-top: 10px;
  padding: 8px;
  background: #e9ecef;
  border-radius: 4px;
  font-size: 14px;
  display: none;
}

.file-info.show {
  display: block;
}

.supported-formats {
  margin-top: 10px;
  font-size: 12px;
  color: #666;
}

.processing-indicator {
  display: none;
  align-items: center;
  margin-top: 10px;
  color: #007bff;
}

.processing-indicator.show {
  display: flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.rag-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.save-btn,
.clear-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.save-btn {
  background: #28a745;
  color: white;
}

.save-btn:hover {
  background: #218838;
}

.clear-btn {
  background: #dc3545;
  color: white;
}

.clear-btn:hover {
  background: #c82333;
}
