/*
OpenAI API Demos - Common Styles
This file contains shared styles across all demo pages.
*/

/* Base Styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f5f5f5;
}

.container {
  background-color: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Typography */
h1 {
  margin-top: 0;
  color: #007bff;
}

h2 {
  color: #007bff;
}

.description {
  color: #444;
  margin-bottom: 24px;
}

.description a {
  color: #007bff;
  text-decoration: none;
}

.description a:hover {
  text-decoration: underline;
}

/* Form Elements */
.input-section {
  margin-bottom: 20px;
}

.input-section label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 500;
}

select,
textarea,
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1em;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* File Inputs */
input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px dashed #ddd;
  border-radius: 5px;
  background: #f8f9fa;
}

.file-info {
  margin-top: 4px;
  font-size: 0.9em;
  color: #666;
}

/* Buttons */
button {
  padding: 12px 24px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background 0.2s;
}

button:hover {
  background-color: #0056b3;
}

button[type="submit"] {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
}

button[type="submit"]:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.button-text {
  display: inline-block;
}

/* Loading Spinner */
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
  margin-left: 10px;
}

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

/* Results Section */
.result-section {
  margin-top: 30px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
}

.result-section h2 {
  margin-top: 0;
  color: #007bff;
}

/* Error Section */
.error-section {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
  border-radius: 6px;
  padding: 12px;
  margin-top: 20px;
}

/* Tooltips */
.tooltip {
  cursor: help;
  position: relative;
}

.tooltip:hover::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: #333;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  white-space: nowrap;
  z-index: 1;
  margin-left: 8px;
}

/* Model Selection */
.model-select-section {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-select-section label {
  font-weight: 500;
}

.model-select-section select {
  padding: 7px 12px;
  border-radius: 5px;
  border: 1px solid #ddd;
  font-size: 1em;
  width: auto;
}

/* Download Button */
.download-button {
  display: block;
  width: 100%;
  padding: 12px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background 0.2s;
}

.download-button:hover {
  background: #218838;
}

/* Grid Layouts */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* Checkbox Groups */
.checkbox-section {
  display: flex;
  align-items: center;
}

.checkbox-section label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Status Indicators */
.status-value {
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.status-value.safe {
  background-color: #d4edda;
  color: #155724;
}

.status-value.flagged {
  background-color: #f8d7da;
  color: #721c24;
}

/* Warning Banner */
.warning-banner {
  background-color: #ffebee;
  color: #c62828;
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 20px;
  border: 1px solid #ef9a9a;
}

.warning-banner a {
  color: #c62828;
  text-decoration: underline;
}

.warning-banner a:hover {
  color: #b71c1c;
}

/* Back Button */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #666;
  text-decoration: none;
  margin-bottom: 16px;
  transition: color 0.2s;
  font-size: 1.1em;
  position: relative;
  z-index: 1;
}

.back-button:hover {
  color: #007bff;
}

.back-button::before {
  content: "←";
  font-size: 1.2em;
}
