/* CipherGuard - AI Security Scanner Styles v2.0 */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f9f9f9;
  --bg-card: #ffffff;
  --bg-input: #f5f5f5;
  --border-color: #d1d5db;
  --border-highlight: #9ca3af;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --accent-cyan: #00d4ff;
  --accent-teal: #ef4444;
  --accent-green: #ef4444;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --accent-purple: #a855f7;
  --gradient-button: linear-gradient(135deg, #dc2626 0%, #ef4444 50%, #f87171 100%);
  --gradient-button-hover: linear-gradient(135deg, #ef4444 0%, #f87171 50%, #fca5a5 100%);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-glow-cyan: 0 0 30px rgba(0, 212, 255, 0.15);
  --shadow-glow-green: 0 0 30px rgba(239, 68, 68, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem;
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

/* Shield Icon */
.shield-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 1.5rem;
  background: #ffffff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(0deg);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.shield-icon svg {
  width: 40px;
  height: 40px;
  color: white;
}

/* App Title */
.app-title {
  font-size: 3.5rem;
  font-weight: 800;
  color: #ef4444;
  letter-spacing: -1px;
  margin-bottom: 1rem;
  text-shadow: 0 0 40px rgba(239, 68, 68, 0.3);
}

/* Gemini Badge */
.gemini-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  padding: 0.6rem 1.25rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.gemini-badge i {
  font-size: 1rem;
}

.gemini-badge.connecting {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.gemini-badge.connected {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.gemini-badge.disconnected {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* App Subtitle */
.app-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
}

/* Scan Card */
.scan-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-card), var(--shadow-glow-cyan);
}

.scan-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Input Group */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.input-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ef4444;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-group label i {
  font-size: 0.85rem;
  color: #ef4444;
}

.input-group input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

/* Select Wrapper */
.select-wrapper {
  position: relative;
}

.select-wrapper select {
  width: 100%;
  padding: 1rem 3rem 1rem 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  appearance: none;
  transition: all 0.2s ease;
}

.select-wrapper select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.select-wrapper select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.5rem;
}

.select-arrow {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-cyan);
  pointer-events: none;
  font-size: 0.9rem;
}

/* Scan Button */
.scan-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.1rem 2rem;
  background: var(--gradient-button);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.scan-button:hover {
  background: var(--gradient-button-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.4);
}

.scan-button:active {
  transform: translateY(0);
}

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

.scan-button i {
  font-size: 1.2rem;
}

/* Results Section */
.results-section {
  width: 100%;
  max-width: 900px;
  margin-top: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 2rem 1rem;
}

.loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  color: var(--accent-cyan);
  animation: pulse 1.5s ease-in-out infinite;
}

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

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

.loading-state h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.loading-state p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Progress Container */
.progress-container {
  width: 100%;
  margin: 1.5rem 0;
}

.progress-wrapper {
  width: 100%;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--bg-input);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-button);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* File List */
.file-list {
  margin-top: 1.5rem;
  max-height: 300px;
  overflow-y: auto;
  text-align: left;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-color);
}

.file-counter {
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid var(--accent-cyan);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-counter {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--accent-red);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--accent-red);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.current-file {
  background: var(--bg-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px dashed var(--border-color);
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  animation: fadeIn 0.3s ease;
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item i {
  color: var(--accent-yellow);
  font-size: 0.85rem;
}

.file-item .file-name {
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item .finding-badge {
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.file-item .finding-type {
  background: var(--bg-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Severity Colors */
.file-item.severity-critical {
  border-left: 3px solid var(--accent-red);
  background: rgba(239, 68, 68, 0.08);
}

.file-item.severity-high {
  border-left: 3px solid var(--accent-yellow);
  background: rgba(245, 158, 11, 0.08);
}

.file-item.severity-medium {
  border-left: 3px solid var(--accent-cyan);
  background: rgba(0, 212, 255, 0.08);
}

.file-item.severity-low {
  border-left: 3px solid var(--accent-green);
  background: rgba(16, 185, 129, 0.08);
}

.finding-badge.critical { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.finding-badge.high { background: rgba(245, 158, 11, 0.2); color: var(--accent-yellow); }
.finding-badge.medium { background: rgba(0, 212, 255, 0.2); color: var(--accent-cyan); }
.finding-badge.low { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: var(--accent-cyan);
}

.stat-icon {
  width: 45px;
  height: 45px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-icon.blue { background: rgba(0, 212, 255, 0.15); color: var(--accent-cyan); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.stat-icon.yellow { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.stat-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.stat-icon.purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-cyan);
}

.action-btn.primary {
  background: var(--gradient-button);
  border: none;
  color: white;
}

.action-btn.primary:hover {
  background: var(--gradient-button-hover);
}

/* Findings Section */
.findings-section {
  margin-bottom: 1.5rem;
}

.findings-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
}

.findings-title i {
  color: var(--accent-yellow);
}

.findings-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Severity Groups */
.severity-group {
  margin-bottom: 1.5rem;
}

.severity-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.severity-header.critical {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.severity-header.high {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.severity-header.medium {
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.severity-header.low {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.severity-findings {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Finding Card */
.finding-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: all 0.2s ease;
}

.finding-card:hover {
  border-color: var(--accent-cyan);
}

.finding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.finding-file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.finding-file i {
  color: var(--accent-cyan);
}

.finding-details {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.finding-detail {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.finding-detail i {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.finding-match {
  background: rgba(239, 68, 68, 0.1);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.8rem;
  color: var(--accent-red);
  border-left: 3px solid var(--accent-red);
  word-break: break-all;
}

.finding-context {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow-x: auto;
}

.finding-context code {
  font-family: 'Monaco', 'Consolas', monospace;
}

/* AI Recommendation */
.ai-recommendation {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-sm);
}

.ai-rec-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-purple);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.ai-rec-content {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* AI Analysis Items */
.ai-analysis-item {
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.ai-finding-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--accent-purple);
  margin-bottom: 0.5rem;
}

.ai-analysis-content {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* No Findings */
.no-findings {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-secondary);
}

.no-findings i {
  font-size: 3.5rem;
  color: var(--accent-green);
  margin-bottom: 1rem;
}

.no-findings h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* AI Summary Section */
.ai-summary-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.ai-summary-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--accent-purple);
}

.ai-summary-content {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Overall Assessment Preview */
.overall-assessment-preview {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.assessment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-purple);
  font-weight: 600;
}

/* Raw JSON Panel */
.raw-json-panel {
  margin-top: 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  max-height: 350px;
  overflow: auto;
}

.raw-json-panel pre {
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}

/* Footer */
.app-footer {
  padding: 1.5rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Toast Messages */
.toast-message {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.toast-message.fade-out {
  animation: slideOut 0.3s ease forwards;
}

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

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

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-input);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .main-content {
    padding: 2rem 1rem;
  }
  
  .app-title {
    font-size: 2.5rem;
  }
  
  .scan-card {
    padding: 1.5rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-btn {
    justify-content: center;
  }
}
