/* Hongguo Manga Studio - Style */
:root {
  --primary: #c92a2a;
  --primary-hover: #b02525;
  --primary-light: #ffe3e3;
  --bg-main: #f8f9fa;
  --bg-card: #ffffff;
  --text-main: #212529;
  --text-muted: #868e96;
  --border-color: #e9ecef;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.top-header {
  background: #ffffff;
  border-bottom: 2px solid #ffc9c9;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: var(--primary);
  color: white;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #c92a2a;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-tab-btn {
  background: none;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-tab-btn:hover {
  background: #f1f3f5;
  color: var(--primary);
}

.nav-tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(201, 42, 42, 0.3);
}

.style-selector {
  display: flex;
  background: #f1f3f5;
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.style-btn {
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: #495057;
  transition: all 0.2s;
}

.style-btn.active {
  background: #212529;
  color: white;
}

/* Main Layout */
.main-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  flex: 1;
  width: 100%;
}

.content-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Notice Box */
.notice-box {
  background: #fff5f5;
  border: 1px solid #ffc9c9;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 0.9rem;
  color: #495057;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notice-steps {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.step-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.step-num {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

/* Filters */
.filter-card {
  background: var(--bg-card);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border-color);
}

.search-bar-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #ced4da;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201, 42, 42, 0.15);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #495057;
  min-width: 48px;
}

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s;
}

.pill-btn:hover {
  background: #e9ecef;
  color: var(--primary);
}

.pill-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.char-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.char-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #ffa8a8;
}

.char-card-header {
  padding: 14px 16px 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.char-avatar-box {
  width: 76px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #e9ecef;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.1);
  position: relative;
}

.char-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.6rem;
  font-weight: bold;
}

.char-meta-top {
  flex: 1;
  min-width: 0;
}

.char-name-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.char-no {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
}

.char-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #212529;
}

.char-archetype {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.char-tags-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.char-tag {
  background: #f1f3f5;
  color: #495057;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
}

.char-tag.role {
  background: #ffe3e3;
  color: #c92a2a;
  font-weight: 600;
}

.char-body {
  padding: 0 16px 12px;
  font-size: 0.85rem;
  color: #495057;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.char-desc-line {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.char-card-actions {
  padding: 10px 16px;
  background: #f8f9fa;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
}

.btn-primary-sm {
  background: var(--primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: background 0.2s;
}

.btn-primary-sm:hover {
  background: var(--primary-hover);
}

.btn-secondary-sm {
  background: #ffffff;
  border: 1px solid #ced4da;
  color: #495057;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary-sm:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

/* Sidebar / Cast Drawer */
.sidebar-sticky {
  position: sticky;
  top: 80px;
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cast-drawer-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-count {
  font-weight: bold;
  color: var(--primary);
  background: #ffe3e3;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.cast-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.cast-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  border: 1px solid #e9ecef;
}

.cast-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cast-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.85rem;
}

.cast-item-del {
  background: none;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.cast-item-del:hover {
  color: #e03131;
  background: #ffe3e3;
}

.empty-cast-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 30px 10px;
}

.btn-proceed-drama {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(201, 42, 42, 0.25);
  transition: all 0.2s;
}

.btn-proceed-drama:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-proceed-drama:disabled {
  background: #ced4da;
  cursor: not-allowed;
  box-shadow: none;
}

/* 12-Shot Section */
.drama-studio-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drama-meta-header {
  border-bottom: 2px solid #ffc9c9;
  padding-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.drama-title-box h2 {
  font-size: 1.4rem;
  color: #212529;
}

.drama-title-box p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.shots-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.shot-card {
  border: 1px solid #dee2e6;
  border-radius: var(--radius-md);
  background: #ffffff;
  overflow: hidden;
  transition: border-color 0.2s;
}

.shot-card:hover {
  border-color: #ffa8a8;
}

.shot-header {
  background: #f8f9fa;
  padding: 10px 18px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.shot-title-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shot-badge {
  background: #212529;
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
}

.shot-type-pill {
  background: #e7f5ff;
  color: #1971c2;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.shot-tags {
  display: flex;
  gap: 6px;
  font-size: 0.8rem;
  color: #495057;
}

.shot-body-content {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shot-action-row {
  font-size: 0.95rem;
  color: #212529;
}

.shot-dialogue-box {
  background: #fff9db;
  border-left: 4px solid #fcc419;
  padding: 8px 14px;
  font-weight: 600;
  color: #664d03;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.shot-keyframes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: #f8f9fa;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #e9ecef;
}

.keyframe-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kf-label {
  font-size: 0.8rem;
  font-weight: bold;
  color: #495057;
  display: flex;
  justify-content: space-between;
}

.kf-text {
  font-size: 0.82rem;
  color: #495057;
  background: white;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #495057;
}

.form-input, .form-select, .form-textarea {
  padding: 10px 14px;
  border: 1px solid #ced4da;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201, 42, 42, 0.15);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #212529;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
  .main-wrapper {
    grid-template-columns: 1fr;
  }
  .sidebar-sticky {
    position: static;
  }
}
