/* VersaTech Brand Styles */
/* Main Colors: Purple #2f3882, Yellow #fdb61b */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
  /* VersaTech Brand Colors - Always the same */
  --vt-purple: #2f3882;
  --vt-purple-dark: #242c68;
  --vt-purple-light: #4a52a8;
  --vt-yellow: #fdb61b;
  --vt-yellow-dark: #e8a516;
  --vt-yellow-light: #fdc84b;
}

/* Light Theme (Default) */
:root,
[data-theme="light"] {
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-accent: #f3f4f8;

  /* Text Colors */
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-light: #6b7280;
  --text-on-purple: #ffffff;
  --text-on-yellow: #1a1a1a;

  /* Border & Divider Colors */
  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --border-dark: #9ca3af;

  /* Input Colors */
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus: var(--vt-purple);

  /* Status Colors */
  --success: #10b981;
  --success-bg: #d1fae5;
  --error: #ef4444;
  --error-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --info: var(--vt-purple);
  --info-bg: #e8eaf6;

  /* Shadow */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Logo Color */
  --logo-color: var(--vt-purple);
}

/* Dark Theme */
[data-theme="dark"] {
  /* Background Colors */
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-accent: #242424;

  /* Text Colors */
  --text-primary: #e5e5e5;
  --text-secondary: #b4b4b4;
  --text-light: #8b8b8b;
  --text-on-purple: #ffffff;
  --text-on-yellow: #1a1a1a;

  /* Border & Divider Colors */
  --border-light: #333333;
  --border-medium: #404040;
  --border-dark: #525252;

  /* Input Colors */
  --input-bg: #1a1a1a;
  --input-border: #404040;
  --input-focus: var(--vt-purple-light);

  /* Status Colors */
  --success: #10b981;
  --success-bg: #064e3b;
  --error: #ef4444;
  --error-bg: #7f1d1d;
  --warning: #f59e0b;
  --warning-bg: #78350f;
  --info: var(--vt-purple-light);
  --info-bg: #1e1b4b;

  /* Shadow */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -2px rgba(0, 0, 0, 0.5);

  /* Logo Color */
  --logo-color: #ffffff;
}

/* Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Montserrat', ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  /* Mobile touch improvements */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: var(--vt-purple);
  margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
  margin-bottom: 1em;
}

/* Buttons */
.btn {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: var(--vt-yellow);
  color: var(--text-on-yellow);
  border: 2px solid var(--vt-yellow);
}

.btn-primary:hover {
  background: var(--vt-yellow-dark);
  border-color: var(--vt-yellow-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--vt-purple);
  color: var(--text-on-purple);
  border: 2px solid var(--vt-purple);
}

.btn-secondary:hover {
  background: var(--vt-purple-dark);
  border-color: var(--vt-purple-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--vt-purple);
  border: 2px solid var(--vt-purple);
}

.btn-outline:hover {
  background: var(--vt-purple);
  color: var(--text-on-purple);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Form Elements */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  font-family: 'Montserrat', sans-serif;
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(47, 56, 130, 0.1);
}

textarea {
  resize: vertical;
  min-height: 56px;
  font-family: 'Montserrat', sans-serif;
}

/* Cards & Panels */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: var(--vt-purple);
  color: var(--text-on-purple);
  padding: 16px 24px;
  border-radius: 12px 12px 0 0;
  font-weight: 600;
  font-size: 18px;
}

.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* Header Styles */
.page-header {
  background: var(--vt-purple);
  color: var(--text-on-purple);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.page-header h1 {
  color: var(--text-on-purple);
  margin: 0;
  font-size: 24px;
}

/* Chat Styles */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-primary);
}

.chat-header {
  background: var(--vt-purple);
  color: var(--text-on-purple);
  padding: 16px 20px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-secondary);
}

.chat-message {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
  margin-bottom: 8px;
  border-radius: 8px;
}

.chat-message .role {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--vt-purple);
  min-width: 80px;
}

.chat-message.user .role {
  color: var(--vt-purple);
}

.chat-message.assistant .role {
  color: var(--success);
}

.chat-message.system .role {
  color: var(--warning);
}

.chat-message .content {
  flex: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text-primary);
}

.chat-composer {
  background: var(--bg-primary);
  border-top: 2px solid var(--border-light);
  padding: 16px 20px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.composer-controls {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.composer-controls textarea {
  flex: 1;
}

/* User Info Section */
.user-info {
  background: var(--bg-accent);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--vt-purple);
  color: var(--text-on-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
}

.user-details {
  flex: 1;
}

.user-name {
  font-weight: 600;
  color: var(--vt-purple);
  margin-bottom: 4px;
}

.user-email {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Status Messages */
.status {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.status.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.status.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error);
}

.status.warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.status.info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info);
}

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--vt-yellow);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.w-full { width: 100%; }

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--vt-purple);
  color: var(--text-on-purple);
  border: 2px solid var(--vt-yellow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  z-index: 1000;
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(20deg);
  background: var(--vt-purple-dark);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* VersaTech Logo Color */
.vt-logo {
  color: var(--logo-color);
  transition: color 0.3s ease;
}

/* Smooth theme transition */
body,
.card,
.chat-message,
input,
textarea,
select,
button {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* AI Mode Toggle Styles */
.mode-toggle {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-accent);
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.mode-selection {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.mode-option {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 2px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-option:hover {
  border-color: var(--vt-purple-light);
  background: var(--bg-secondary);
}

.mode-option input[type="radio"] {
  display: none;
}

.mode-option input[type="radio"]:checked + span {
  color: var(--vt-purple);
  font-weight: 600;
}

.mode-option input[type="radio"]:checked ~ small {
  color: var(--vt-purple);
}

.mode-option:has(input[type="radio"]:checked) {
  border-color: var(--vt-purple);
  background: var(--info-bg);
  box-shadow: 0 0 0 3px rgba(47, 56, 130, 0.1);
}

.mode-option span {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.mode-option small {
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

/* Enhanced Chat Message Styles for Agent Mode */
.chat-message.agent {
  border-left: 4px solid var(--vt-purple);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--info-bg) 100%);
}

.chat-message.agent .role {
  color: var(--vt-purple);
}

.chat-message.agent .content {
  font-weight: 400;
}

/* Agent Status Indicators */
.agent-thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--info-bg);
  border: 1px solid var(--vt-purple-light);
  border-radius: 8px;
  margin-bottom: 16px;
  color: var(--vt-purple);
  font-style: italic;
}

.agent-thinking::before {
  content: "🤖";
  font-size: 16px;
}

.agent-thinking .loading {
  border-color: var(--vt-purple);
  border-top-color: transparent;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  .card {
    padding: 16px;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .btn {
    padding: 10px 20px;
    font-size: 13px;
  }

  .theme-toggle {
    width: 45px;
    height: 45px;
    font-size: 20px;
    bottom: 15px;
    right: 15px;
  }

  .mode-selection {
    flex-direction: column;
  }

  .mode-option {
    min-width: auto;
  }
}
