/**
 * Grammar Checker POC - Styles
 */

:root {
  /* Colors */
  --color-primary: #667eea;
  --color-primary-dark: #764ba2;
  --color-success: #38ef7d;
  --color-success-dark: #11998e;
  --color-error: #e53935;
  --color-error-dark: #c62828;

  /* Text colors */
  --color-text: #333;
  --color-text-muted: #666;
  --color-text-light: #888;

  /* Backgrounds */
  --color-bg: #f5f5f5;
  --color-bg-card: #fff;
  --color-bg-muted: #fafafa;

  /* Borders */
  --color-border: #eee;
  --color-border-dark: #ddd;

  /* Diff colors */
  --color-diff-del-bg: #ffcdd2;
  --color-diff-del-text: #c62828;
  --color-diff-ins-bg: #c8e6c9;
  --color-diff-ins-text: #2e7d32;

  /* Spacing & sizing */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

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

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #666;
  font-size: 0.9rem;
}

.nav-link {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.85rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}

.nav-link:hover {
  background: var(--color-primary);
  color: white;
}

/* Model Section */
.model-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.model-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 450px;
}

.model-selector label {
  font-weight: 500;
  color: var(--color-text-muted);
}

.model-selector select {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.9rem;
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.model-selector select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: white;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.download-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.download-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.download-btn.ready {
  background: linear-gradient(135deg, var(--color-success-dark), var(--color-success));
}

/* Progress */
.progress-container {
  width: 100%;
  max-width: 400px;
  height: 24px;
  background: #e0e0e0;
  border-radius: 12px;
  position: relative;
  display: none;
}

.progress-container.visible {
  display: block;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 12px;
  transition: width 0.3s;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Status */
.model-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
}

.model-status.loading .status-dot {
  background: #f5a623;
  animation: pulse 1s infinite;
}

.model-status.ready .status-dot {
  background: #38ef7d;
}

.model-status.error .status-dot {
  background: #e53935;
}

@keyframes pulse {
  50% { opacity: 0.5; }
}

/* Editor */
.editor-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}

.editor-header, .editor-footer {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--color-bg-muted);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.editor-header {
  border-bottom: 1px solid var(--color-border);
}

.editor-footer {
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
}

.inference-time {
  color: #667eea;
  font-weight: 500;
}

.editor {
  min-height: 300px;
  padding: 1rem;
  font-size: 1rem;
  line-height: 1.8;
  outline: none;
  white-space: pre-wrap;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: #aaa;
}

/* Grammar Error Underline - Grammarly style */
.grammar-error {
  cursor: pointer;
  position: relative;
  border-bottom: 2px solid var(--color-error);
  background: transparent;
}

.grammar-error:hover {
  background: rgba(229, 57, 53, 0.1);
}

/* Insert marker - underlined caret between words */
.grammar-insert-marker {
  display: inline-block;
  width: 6px;
  height: 1em;
  vertical-align: text-bottom;
  border-bottom: 2px solid var(--color-error);
  background: transparent;
  cursor: pointer;
}

.grammar-insert-marker:hover {
  background: rgba(229, 57, 53, 0.1);
}

/* Suggestion Dropdown */
.suggestion-dropdown {
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 280px;
  max-width: 400px;
  z-index: 1000;
  overflow: hidden;
}

.suggestion-header {
  padding: 12px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-light);
  background: var(--color-bg-muted);
  border-bottom: 1px solid var(--color-border);
}

.suggestion-change {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.suggestion-change .arrow {
  color: #999;
}

.suggestion-preview {
  padding: 10px 14px;
  background: var(--color-bg-muted);
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.suggestion-preview-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  margin-bottom: 6px;
}

.suggestion-actions {
  display: flex;
  border-top: 1px solid var(--color-border);
}

.suggestion-action {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
}

.suggestion-action:first-child {
  border-right: 1px solid var(--color-border);
}

.suggestion-action.accept {
  color: #4caf50;
}

.suggestion-action.accept:hover {
  background: #e8f5e9;
}

.suggestion-action.dismiss {
  color: #999;
}

.suggestion-action.dismiss:hover {
  background: #f5f5f5;
}

/* Diff highlighting in suggestions */
.diff-del {
  background: var(--color-diff-del-bg);
  color: var(--color-diff-del-text);
  text-decoration: line-through;
  padding: 1px 3px;
  border-radius: 2px;
}

.diff-ins {
  background: var(--color-diff-ins-bg);
  color: var(--color-diff-ins-text);
  padding: 1px 3px;
  border-radius: 2px;
}

/* Checking Indicator */
.checking-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #667eea;
}

.checking-indicator.hidden {
  display: none;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #e0e0e0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Footer */
footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-light);
}

footer a {
  color: #667eea;
  text-decoration: none;
}

footer p {
  margin-bottom: 0.25rem;
}

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 1rem; }
  header h1 { font-size: 1.5rem; }
  .editor { min-height: 200px; }
}
