/**
 * Main Styles
 * Responsive design for AI Agent interface
 */

:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --success-color: #48bb78;
  --warning-color: #ed8936;
  --error-color: #f56565;
  --bg-dark: #1a202c;
  --bg-light: #f7fafc;
  --text-dark: #2d3748;
  --text-light: #718096;
  --border-color: #e2e8f0;
  --sidebar-width: 250px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
}

body {
  overflow: hidden;
}

.app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-dark);
  color: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
}

.logo {
  margin-bottom: 30px;
  text-align: center;
}

.logo h1 {
  font-size: 20px;
  font-weight: 600;
}

.nav-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--text-light);
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-item.active {
  background: var(--primary-color);
  color: white;
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error-color);
}

.status-dot.online {
  background: var(--success-color);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Main */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.tab-content {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 30px;
}

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

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.chat-header {
  margin-bottom: 20px;
}

.chat-header h2 {
  font-size: 24px;
  margin-bottom: 5px;
}

.chat-header p {
  color: var(--text-light);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.message {
  margin-bottom: 15px;
  animation: slideIn 0.3s ease-out;
}

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

.message-user {
  display: flex;
  justify-content: flex-end;
}

.message-user .message-content {
  background: var(--primary-color);
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 70%;
}

.message-assistant .message-content {
  background: var(--bg-light);
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 70%;
  border: 1px solid var(--border-color);
}

.message-system {
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  margin: 10px 0;
}

.system-message {
  display: inline-block;
  background: var(--bg-light);
  padding: 8px 12px;
  border-radius: 6px;
}

.message-text {
  line-height: 1.5;
}

.message-text code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 5px;
}

.chat-input-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-commands {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.command-btn {
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.command-btn:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
}

#chat-form {
  display: flex;
  gap: 10px;
}

#message-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#message-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.send-btn:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

.send-btn:active {
  transform: translateY(0);
}

/* Section Headers */
.section-header {
  margin-bottom: 30px;
}

.section-header h2 {
  font-size: 24px;
  margin-bottom: 5px;
}

.section-header p {
  color: var(--text-light);
}

/* Scanner */
.scanner-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--secondary-color);
}

.btn-secondary {
  background: white;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-light);
}

.btn-secondary.active {
  background: var(--warning-color);
  color: white;
  border-color: var(--warning-color);
}

.scanner-results {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 20px;
}

.placeholder {
  color: var(--text-light);
  text-align: center;
  padding: 40px;
}

.scan-report {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.scan-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

.scan-header h3 {
  margin-bottom: 10px;
}

.scan-time, .scan-duration {
  font-size: 12px;
  color: var(--text-light);
}

.issues-section, .recommendations-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.issues-list, .recommendations-list {
  list-style: none;
}

.issue-item, .recommendation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--bg-light);
  border-radius: 8px;
  border-left: 4px solid var(--warning-color);
}

.issue-item.severity-critical {
  border-left-color: var(--error-color);
}

.issue-item.severity-high {
  border-left-color: var(--warning-color);
}

.issue-item.severity-medium {
  border-left-color: #f6ad55;
}

.severity-badge, .priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.1);
}

.issue-message {
  flex: 1;
}

.issue-file {
  color: var(--text-light);
  font-size: 12px;
}

.success-message {
  color: var(--success-color);
  font-weight: 600;
  padding: 20px;
  text-align: center;
  background: rgba(72, 187, 120, 0.1);
  border-radius: 8px;
}

/* Project */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.project-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  overflow: hidden;
}

.project-card h3 {
  margin-bottom: 15px;
  font-size: 16px;
}

.file-tree, .readme-content, .dockerfile-content {
  max-height: 400px;
  overflow-y: auto;
}

.file-list {
  list-style: none;
}

.category {
  font-weight: 600;
  color: var(--primary-color);
  margin-top: 15px;
  margin-bottom: 10px;
  font-size: 12px;
  text-transform: uppercase;
}

.file-item, .dir-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.file-item:hover, .dir-item:hover {
  background: var(--bg-light);
}

.file-icon, .dir-icon {
  font-size: 16px;
  min-width: 20px;
}

.file-name, .dir-name {
  flex: 1;
  font-size: 13px;
}

.file-size {
  font-size: 11px;
  color: var(--text-light);
}

.markdown-content {
  line-height: 1.6;
}

.markdown-content p {
  margin-bottom: 10px;
}

.markdown-content pre {
  background: var(--bg-light);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 10px 0;
}

.markdown-content code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

/* Settings */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

.setting-group {
  background: white;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.setting-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
}

.setting-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.setting-group input[type="number"] {
  margin-left: 10px;
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 100px;
}

.settings-info {
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.settings-info h4 {
  margin-bottom: 15px;
}

.info-box {
  background: var(--bg-light);
  padding: 15px;
  border-radius: 8px;
}

.info-box dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 15px;
}

.info-box dt {
  font-weight: 600;
  color: var(--text-dark);
}

.info-box dd {
  color: var(--text-light);
}

/* Notifications */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 20px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.3s ease-out;
}

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

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

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

.notification-info {
  border-left: 4px solid var(--primary-color);
  color: var(--primary-color);
}

.close-btn {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 20px;
  margin-left: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    padding: 15px;
  }

  .logo {
    margin-bottom: 0;
  }

  .nav-menu {
    flex-direction: row;
    flex: 1;
    gap: 5px;
    margin: 0 20px;
  }

  .nav-item {
    padding: 8px 12px;
    font-size: 12px;
  }

  .main {
    padding-bottom: 50px;
  }

  .tab-content {
    padding: 15px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .message-user .message-content,
  .message-assistant .message-content {
    max-width: 100%;
  }

  .chat-messages {
    padding: 15px;
  }

  .quick-commands {
    flex-direction: column;
  }

  .command-btn {
    width: 100%;
  }

  #chat-form {
    flex-direction: column;
  }

  .send-btn {
    width: 100%;
  }
}
