/* ========================================
   BOOKRUM Spell Checker - Design System
   Based on BOOKRUM Brand Guidelines
   ======================================== */

/* CSS Variables - BOOKRUM Colors */
:root {
  /* Primary Brand Colors */
  --primary: #7DD3C0;
  --primary-dark: #5fb3a1;

  /* Background Colors */
  --bg-primary: #F8F5F1;
  --bg-secondary: #FFFFFF;
  --card-bg: rgba(255, 255, 255, 0.9);

  /* Text Colors */
  --text-primary: #333333;
  --text-secondary: #666666;

  /* Accent Colors */
  --accent: #FFE4D6;
  --secondary-blue: #A0C4D8;

  /* Status Colors */
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Border & Divider */
  --border: rgba(102, 102, 102, 0.2);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Container */
.container {
  background-color: var(--bg-secondary);
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 900px;
  border: 1px solid var(--border);
}

/* Header */
header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--primary);
}

.logo {
  max-width: 200px;
  height: auto;
  margin: 0 auto 20px;
  display: block;
}

h1 {
  color: var(--text-primary);
  font-size: 2.2em;
  font-weight: 700;
  margin-bottom: 12px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.05em;
  line-height: 1.5;
}

/* Sections */
.section {
  margin: 24px 0;
}

.hidden {
  display: none !important;
}

/* File Input */
.file-input-wrapper {
  text-align: center;
  margin-bottom: 24px;
}

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

.file-input-label {
  display: inline-block;
  padding: 16px 32px;
  background-color: var(--bg-primary);
  border: 2px dashed var(--primary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 500;
}

.file-input-label:hover {
  background-color: var(--accent);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.file-input-label.file-selected {
  background-color: var(--primary);
  border-color: var(--primary-dark);
  color: white;
  border-style: solid;
}

#file-name {
  font-weight: 500;
}

/* Buttons */
.btn {
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 8px;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-success {
  background-color: var(--success);
  color: white;
  width: 100%;
  margin-top: 24px;
  padding: 14px 28px;
  font-size: 17px;
}

.btn-success:hover {
  background-color: #1ea34e;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: var(--text-secondary);
  color: white;
}

.btn-secondary:hover {
  background-color: var(--text-primary);
}

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

/* Loading Section */
#loading-section {
  text-align: center;
  padding: 60px 20px;
}

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

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

.loading-text {
  font-size: 1.2em;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 12px;
}

.loading-subtext {
  color: var(--text-secondary);
  font-size: 0.95em;
}

/* Results Section */
#results-section {
  margin-top: 32px;
}

.results-header {
  margin-bottom: 24px;
  padding: 20px;
  background-color: var(--bg-primary);
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}

.results-header h2 {
  color: var(--text-primary);
  margin-bottom: 12px;
  font-size: 1.8em;
}

.results-info {
  color: var(--text-secondary);
  font-size: 1.05em;
}

#suggestion-count,
#selected-count {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1em;
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

/* Suggestions Container */
#suggestions-container {
  margin-top: 24px;
}

#suggestions-form {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  max-height: 500px;
  overflow-y: auto;
}

/* Custom Scrollbar */
#suggestions-form::-webkit-scrollbar {
  width: 8px;
}

#suggestions-form::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

#suggestions-form::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

#suggestions-form::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* Suggestion Items */
.suggestion-item {
  padding: 16px;
  background-color: var(--bg-secondary);
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.suggestion-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.suggestion-item:last-child {
  margin-bottom: 0;
}

.suggestion-item label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  width: 100%;
}

.suggestion-item input[type="checkbox"] {
  margin-right: 16px;
  margin-top: 4px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

.suggestion-content {
  flex: 1;
}

.suggestion-text {
  margin-bottom: 10px;
  font-size: 1.05em;
  line-height: 1.5;
}

.suggestion-text .original {
  color: var(--error);
  text-decoration: line-through;
  font-weight: 600;
  background-color: rgba(239, 68, 68, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.suggestion-text .arrow {
  margin: 0 12px;
  color: var(--text-secondary);
  font-weight: bold;
}

.suggestion-text .suggestion {
  color: var(--success);
  font-weight: 700;
  background-color: rgba(34, 197, 94, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.suggestion-reason {
  font-size: 0.92em;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  padding-left: 4px;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}

/* Error Section */
#error-section {
  text-align: center;
  padding: 24px;
}

.error-box {
  background-color: rgba(239, 68, 68, 0.05);
  border: 2px solid var(--error);
  border-radius: 8px;
  padding: 32px;
}

.error-box h3 {
  color: var(--error);
  margin-bottom: 16px;
  font-size: 1.5em;
}

.error-box p {
  color: var(--text-primary);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Upload Section Centered */
#upload-section {
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .container {
    padding: 24px;
  }

  h1 {
    font-size: 1.8em;
  }

  .subtitle {
    font-size: 0.95em;
  }

  .btn {
    width: 100%;
    margin: 6px 0;
  }

  .controls {
    flex-direction: column;
  }

  #suggestions-form {
    max-height: 400px;
    padding: 16px;
  }

  .suggestion-item {
    padding: 12px;
  }

  .suggestion-text {
    font-size: 0.95em;
  }

  .results-header {
    padding: 16px;
  }

  .results-header h2 {
    font-size: 1.5em;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 20px;
  }

  h1 {
    font-size: 1.5em;
  }

  .logo {
    max-width: 150px;
  }

  .subtitle {
    font-size: 0.9em;
  }

  #suggestions-form {
    max-height: 320px;
    padding: 12px;
  }

  .suggestion-item {
    padding: 10px;
  }

  .file-input-label {
    padding: 12px 24px;
    font-size: 14px;
  }
}

/* Print Styles */
@media print {
  body {
    background-color: white;
  }

  .container {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .btn,
  .controls,
  #upload-section {
    display: none;
  }
}
