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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "나눔고딕", sans-serif;
  background: #f4f6fa;
  color: #1a1d2e;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.main-content {
  padding: 36px 24px 64px;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  background: #1a2744;
  color: #fff;
  padding: 0 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.site-title-link {
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-secondary {
  background: #64748b;
  color: #fff;
}
.btn-secondary:hover:not(:disabled) {
  background: #475569;
}

.btn-outline {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: #fff;
}

/* Outline variant on light bg */
.card .btn-outline,
.form-actions .btn-outline {
  color: #2563eb;
  border-color: #2563eb;
}
.card .btn-outline:hover,
.form-actions .btn-outline:hover {
  background: #eff6ff;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.82rem;
  border-radius: 6px;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 1rem;
  border-radius: 10px;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  padding: 28px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a2744;
}

.case-count {
  font-size: 0.85rem;
  color: #64748b;
  background: #f1f5f9;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ============================================================
   Table
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
}

.case-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.case-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.case-table td {
  padding: 14px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.case-table tr:last-child td {
  border-bottom: none;
}

.case-table tr:hover td {
  background: #f8fafc;
}

.case-title .title-text {
  font-weight: 600;
  color: #1a2744;
  max-width: 320px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-cell {
  color: #64748b;
  font-size: 0.88rem;
  white-space: nowrap;
}

.action-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-gray   { background: #e2e8f0; color: #475569; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

.badge-lg {
  padding: 6px 16px;
  font-size: 0.9rem;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a2744;
  margin-bottom: 10px;
}

.empty-state p {
  color: #64748b;
  margin-bottom: 28px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a2744;
  margin-bottom: 6px;
}

.page-desc {
  color: #64748b;
  font-size: 0.95rem;
}

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
}

.tab-btn {
  padding: 10px 22px;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: #64748b;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.tab-btn:hover:not(.active) {
  color: #1a2744;
}

.tab-content {
  display: block;
}

.tab-content.hidden {
  display: none;
}

/* ============================================================
   Upload / Drop Zone
   ============================================================ */
.upload-card {
  padding: 32px;
}

.drop-zone {
  border: 2.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 52px 24px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 24px;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}

.drop-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.drop-text {
  color: #475569;
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.upload-label {
  cursor: pointer;
  color: #2563eb;
  border-color: #2563eb;
}

.drop-hint {
  margin-top: 12px;
  color: #94a3b8;
  font-size: 0.82rem;
}

.file-preview {
  background: #f1f5f9;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.file-preview-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-icon {
  font-size: 1.4rem;
}

.file-name {
  flex: 1;
  font-size: 0.92rem;
  color: #1a2744;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   Form Elements
   ============================================================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.form-textarea {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  color: #1a1d2e;
  background: #fff;
  transition: border-color 0.15s;
  line-height: 1.7;
}

.form-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-input {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: inherit;
  color: #1a1d2e;
  background: #fff;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.char-count {
  text-align: right;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 6px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* ============================================================
   Progress
   ============================================================ */
.progress-card {
  text-align: center;
  padding: 40px 32px;
}

.progress-card h3 {
  font-size: 1.2rem;
  color: #1a2744;
  margin-bottom: 20px;
}

.progress-bar-wrap {
  background: #e2e8f0;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-message {
  color: #475569;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.progress-percent {
  color: #94a3b8;
  font-size: 0.85rem;
}

/* ============================================================
   Modal
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.modal-box {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

.modal-box h3 {
  font-size: 1.15rem;
  color: #1a2744;
  margin-bottom: 22px;
  font-weight: 700;
}

.modal-box .progress-bar-wrap {
  margin-bottom: 14px;
}

.modal-actions {
  margin-top: 24px;
}

.modal-actions.hidden {
  display: none;
}

/* ============================================================
   Preview Page
   ============================================================ */
.preview-meta {
  padding: 20px 28px;
  margin-bottom: 20px;
}

.preview-meta-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meta-value {
  font-size: 0.95rem;
  color: #1a2744;
  font-weight: 500;
}

.hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hashtag {
  background: #eff6ff;
  color: #2563eb;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.preview-frame {
  padding: 0;
  overflow: hidden;
}

.preview-frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.preview-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.preview-hint {
  font-size: 0.78rem;
  color: #94a3b8;
}

.blog-content {
  padding: 32px 40px;
  max-width: 720px;
  margin: 0 auto;
  font-size: 0.95rem;
  line-height: 1.8;
  color: #1a1d2e;
}

.blog-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
  display: block;
}

.blog-content h1,
.blog-content h2,
.blog-content h3 {
  margin: 24px 0 12px;
  color: #1a2744;
}

.blog-content p {
  margin-bottom: 14px;
}

/* ============================================================
   Settings Page
   ============================================================ */
.settings-section {
  margin-bottom: 32px;
}

.settings-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1a2744;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Utility
   ============================================================ */
.hidden {
  display: none !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .site-header .container {
    height: auto;
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .site-title {
    font-size: 1rem;
  }

  .main-content {
    padding: 20px 16px 48px;
  }

  .card {
    padding: 18px;
  }

  .case-table th,
  .case-table td {
    padding: 10px 8px;
  }

  .action-cell {
    flex-direction: column;
    align-items: flex-start;
  }

  .blog-content {
    padding: 20px 16px;
  }

  .preview-meta-inner {
    flex-direction: column;
    gap: 14px;
  }

  .modal-box {
    margin: 16px;
    padding: 28px 20px;
  }
}
