/* CSS Variables */
:root {
  --primary: #ff9900;
  --primary-dark: #e88900;
  --secondary: #232f3e;
  --success: #10b981;
  --success-dark: #059669;
  --accent: #8b5cf6;
  --accent-dark: #7c3aed;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius: 12px;
  --radius-sm: 8px;
  --font-mono: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Space Mono", monospace;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  line-height: 1.6;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout Components */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  flex: 1;
}

.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
}

.footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
}

.footer p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Cards and Sections */
.disclaimer {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.disclaimer p {
  color: #92400e;
  font-size: 0.8rem;
  margin: 0;
  line-height: 1.4;
  text-align: center;
}

.quick-lookup-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 2rem;
  border: 1px solid var(--border-light);
  margin-bottom: 2rem;
  border-left: 4px solid var(--accent);
}

.quick-lookup-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 2rem;
  border: 1px solid var(--border-light);
}

.card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Form Elements */
.resource-input-group {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.input-group {
  flex: 1;
  min-width: 200px;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.input-group input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
  background: var(--bg-secondary);
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(139 92 246 / 0.1);
}

.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
  background: var(--bg-secondary);
}

.file-upload.dragover {
  border-color: var(--primary);
  background: #fff8f0;
  transform: scale(1.02);
}

.file-upload input[type="file"] {
  display: none;
}

.file-upload p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.file-upload p:last-child {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.textarea {
  width: 100%;
  min-height: 300px;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  resize: vertical;
  transition: border-color 0.2s ease;
  background: var(--bg-secondary);
}

.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(255 153 0 / 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 2px solid #000;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: "Space Mono", monospace;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 1);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 1);
}

.btn-primary {
  background: linear-gradient(135deg, #ff9900, #e88900);
  color: white;
  border-color: #000;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ffaa00, #ff9900);
}

.btn-secondary {
  background: #ffffff;
  color: #000;
  border-color: #000;
}

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

.btn-accent {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  border-color: #000;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #9333ea, #8b5cf6);
}

/* Controls */
.controls {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.checkbox-group label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Output Tabs */
.output-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 0.25rem;
}

.tab {
  flex: 1;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.875rem;
  text-align: center;
  color: var(--text-secondary);
}

.tab:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.output-content {
  display: none;
}

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

/* Code Blocks */
.code-block {
  position: relative;
  background: var(--secondary);
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-x: auto;
  border: 1px solid #374151;
}

.copy-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem 1rem;
  background: var(--success);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: "Space Mono", monospace;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
  text-align: center;
}

.copy-btn:hover {
  background: var(--success-dark);
  transform: translateY(-1px);
}

/* Resource and Permission Items */
.resource-item {
  background: var(--bg-secondary);
  padding: 1rem;
  margin: 0.5rem 0;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-primary);
}

.resource-item.sam-resource {
  border-left-color: var(--accent);
}

.permission-group {
  margin: 1.5rem 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.permission-group h4 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.permission-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.permission-item {
  background: var(--bg-primary);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

/* Loading and Alerts */
.loading {
  display: none;
  text-align: center;
  padding: 2rem;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  border: 1px solid var(--border-light);
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  font-weight: 500;
  border-left: 4px solid;
}

.alert.error {
  background: #fef2f2;
  color: #dc2626;
  border-left-color: #dc2626;
}

.alert.success {
  background: #f0fdf4;
  color: #16a34a;
  border-left-color: #16a34a;
}

/* SAM Info */
.sam-info {
  background: #f3f4f6;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  border-left: 4px solid var(--accent);
}

.sam-info h5 {
  color: var(--accent-dark);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.sam-info p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
}

.single-resource-result {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-top: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .container {
    padding: 0.75rem;
  }

  .header h1 {
    font-size: 1.25rem;
  }

  .header p {
    font-size: 0.75rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .btn {
    justify-content: center;
    padding: 0.875rem 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  .textarea {
    min-height: 250px;
  }

  .footer {
    padding: 1.5rem 0;
  }

  .resource-input-group {
    flex-direction: column;
    align-items: stretch;
  }

  .input-group {
    min-width: auto;
  }
}
