/*
 * UI Styles for bpflint web interface
 * Modern, responsive design with card-based layout
 */

/* ========================================
   CSS Custom Properties (Design System)
   ======================================== */

:root {
  --primary: #0066ff;
  --primary-dark: #0052cc;
  --primary-light: #3385ff;
  --surface: #ffffff;
  --background: #f8f9fa;
  --border: #e1e4e8;
  --text: #24292e;
  --text-secondary: #586069;
  --error: #d73a49;
  --success: #28a745;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --body-bg: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
  --lint-bg: #fafbfc;
  --input-readonly-bg: #f6f8fa;
}

[data-theme="dark"] {
  --primary: #3385ff;
  --primary-dark: #0066ff;
  --primary-light: #66a3ff;
  --surface: #1e1e1e;
  --background: #121212;
  --border: #333;
  --text: #e1e1e1;
  --text-secondary: #a0a0a0;
  --error: #ff6b6b;
  --success: #4caf50;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  --body-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --lint-bg: #252525;
  --input-readonly-bg: #2a2a2a;
}

/* ========================================
   Base Styles
   ======================================== */

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  padding: 40px 20px;
  margin: 0;
  background: var(--body-bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========================================
   Layout
   ======================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--surface);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

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

/* ========================================
   Theme Toggle
   ======================================== */

.theme-toggle {
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.theme-toggle .sun {
  display: none;
}

.theme-toggle .moon {
  display: inline;
}

[data-theme="dark"] .theme-toggle .sun {
  display: inline;
  color: #ffcc33;
}

[data-theme="dark"] .theme-toggle .moon {
  display: none;
}

/* ========================================
   Typography
   ======================================== */

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, var(--primary) 0%, #00a6ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.6;
}

/* ========================================
   Form Controls
   ======================================== */

#fileInput {
  display: none;
}

.section {
  display: grid;
  grid-template-columns: 140px minmax(10em, 1fr) auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 1.25rem;
  background: var(--background);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.section:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

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

.section input[type="text"],
.section input[type="number"] {
  padding: 0.65rem 0.85rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background: var(--surface);
  color: var(--text);
}

.section input[type="text"]:focus,
.section input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.section input[type="text"]:read-only {
  background: var(--input-readonly-bg);
  color: var(--text-secondary);
  cursor: default;
}

.section input[type="number"] {
  width: 100%;
}

.section button {
  padding: 0.65rem 1.5rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
  white-space: nowrap;
}

.section button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
}

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

/* ========================================
   Lint Output Area
   ======================================== */

#lintMessages {
  width: 100%;
  min-height: 400px;
  margin-top: 1.5rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 0.875rem;
  white-space: pre-wrap;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: var(--lint-bg);
  overflow: auto;
  box-shadow: inset var(--shadow-sm);
  line-height: 1.5;
  transition: border-color 0.2s ease;
}

#lintMessages:hover {
  border-color: var(--primary-light);
}

/* ========================================
   Error Display
   ======================================== */

.error {
  color: var(--error);
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(215, 58, 73, 0.05);
  border-left: 4px solid var(--error);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
  display: none;
}

.error:not(:empty) {
  display: block;
  animation: slideIn 0.3s ease;
}

/* ========================================
   Animations
   ======================================== */

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  body {
    padding: 20px 10px;
  }

  .container {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }

  .section {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .section label {
    margin-bottom: -0.5rem;
  }
}
