/* Base styles - shared across all AI Helper apps */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --success-color: #10b981;
  --success-hover: #059669;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --secondary-color: #6b7280;
  --secondary-hover: #4b5563;
  --text-color: #111827;
  --text-secondary: #6b7280;
  --bg-color: #ffffff;
  --bg-secondary: #f9fafb;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 0.5rem;
  --radius-sm: 0.375rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

header {
  background: linear-gradient(135deg, var(--primary-color), #1e40af);
  color: white; padding: 2rem 1rem; text-align: center; box-shadow: var(--shadow-lg);
}
header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; font-weight: 700; }
header p { font-size: 1.125rem; opacity: 0.9; max-width: 600px; margin: 0 auto; }

main { flex: 1; padding: 2rem 1rem; max-width: 1200px; margin: 0 auto; width: 100%; }

.controls, .result-section {
  background: var(--bg-secondary); padding: 2rem; border-radius: var(--radius);
  margin-bottom: 2rem; border: 1px solid var(--border-color);
}

.input-section h2, .model-section h2, .result-section h2 {
  margin-bottom: 1rem; font-size: 1.25rem; font-weight: 600;
}

.input-options { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }

.file-input-container { position: relative; }

textarea {
  flex: 1; min-width: 200px; padding: 0.75rem; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); font-size: 1rem; font-family: inherit; resize: vertical;
}

.model-select {
  width: 100%; padding: 0.75rem; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); font-size: 1rem; background: white; margin-bottom: 0.5rem;
}
.model-info { opacity: 0.7; }

.action-controls { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn {
  padding: 0.75rem 1.5rem; border: none; border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease;
  display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); }
.btn-success { background: var(--success-color); color: white; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); transform: translateY(-1px); }
.btn-danger { background: var(--danger-color); color: white; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary-color); color: white; }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-hover); transform: translateY(-1px); }

.progress-section { margin-bottom: 2rem; }
.progress-container {
  display: flex; align-items: center; gap: 1rem; padding: 1rem;
  background: white; border-radius: var(--radius); border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}
.progress-bar { flex: 1; height: 8px; background: var(--bg-secondary); border-radius: 4px; overflow: hidden; }
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary-color), var(--success-color));
  width: 0%; transition: width 0.3s ease; border-radius: 4px;
}
.progress-text { font-weight: 500; min-width: 200px; }

.result-container { margin-bottom: 1rem; }
#result-text {
  width: 100%; min-height: 200px; padding: 1rem; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 1rem; line-height: 1.7;
  resize: vertical; background: var(--bg-color);
}
.image-preview img { max-width: 100%; border-radius: var(--radius-sm); }
.result-actions { display: flex; gap: 1rem; justify-content: flex-end; flex-wrap: wrap; }

.status {
  text-align: center; padding: 1rem; background: var(--bg-secondary);
  border-radius: var(--radius); border: 1px solid var(--border-color);
}
.status-text { font-weight: 500; color: var(--text-secondary); }

footer { background: var(--text-color); color: white; text-align: center; padding: 1.5rem 1rem; margin-top: auto; }
footer p { font-size: 0.875rem; opacity: 0.8; }

@media (max-width: 768px) {
  header { padding: 1.5rem 1rem; }
  header h1 { font-size: 2rem; }
  main { padding: 1rem; }
  .controls, .result-section { padding: 1.5rem; }
  .input-options { flex-direction: column; align-items: stretch; }
  .btn { padding: 0.625rem 1.25rem; font-size: 0.875rem; }
  .action-controls { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
  .progress-container { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .progress-text { text-align: center; min-width: unset; }
  .result-actions { flex-direction: column; align-items: stretch; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.controls, .result-section, .progress-container, .status { animation: fadeIn 0.3s ease-out; }
.recording #mic-icon { animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #f9fafb; --text-secondary: #d1d5db; --bg-color: #111827;
    --bg-secondary: #1f2937; --border-color: #374151;
  }
  body { background: var(--bg-color); }
  .controls, .result-section, .progress-container, .status {
    background: var(--bg-secondary); border-color: var(--border-color);
  }
  #result-text { background: var(--bg-secondary); border-color: var(--border-color); color: var(--text-color); }
}

.btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary-color); outline-offset: 2px;
}
