*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #333; background: #f5f5f5; line-height: 1.5;
}
a { color: #4a90d9; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #667eea; }
.login-box {
  background: #fff; padding: 40px; border-radius: 12px; width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-box h1 { text-align: center; margin-bottom: 30px; color: #333; }

/* Alert */
.alert { padding: 10px 15px; border-radius: 6px; margin-bottom: 15px; font-size: 14px; }
.alert-error { background: #fee; color: #c33; border: 1px solid #fcc; }

/* Forms */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #555; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: #4a90d9; box-shadow: 0 0 0 3px rgba(74,144,217,0.1);
}

/* Buttons */
.btn {
  display: inline-block; padding: 8px 16px; border: 1px solid #ddd;
  border-radius: 6px; font-size: 13px; cursor: pointer; background: #fff; color: #333;
  transition: all 0.2s;
}
.btn:hover { background: #f0f0f0; text-decoration: none; }
.btn-primary { background: #4a90d9; color: #fff; border-color: #4a90d9; }
.btn-primary:hover { background: #3a7bc8; }
.btn-danger { background: #e74c3c; color: #fff; border-color: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-replace { background: #f39c12; color: #fff; border-color: #f39c12; cursor: pointer; }
.btn-replace:hover { background: #e08e0b; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; padding: 12px; font-size: 15px; }

/* Admin Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: #2c3e50; color: #fff; display: flex;
  flex-direction: column; position: fixed; top: 0; bottom: 0;
}
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { font-size: 18px; }
.sidebar-nav { flex: 1; padding: 15px 0; }
.sidebar-nav a {
  display: block; padding: 10px 20px; color: #bdc3c7; font-size: 14px;
  transition: all 0.2s;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.sidebar-footer {
  padding: 15px 20px; border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 13px; display: flex; justify-content: space-between; align-items: center;
}
.sidebar-footer a { color: #bdc3c7; }

.admin-main { flex: 1; margin-left: 240px; }
.admin-header { padding: 20px 30px; background: #fff; border-bottom: 1px solid #eee; }
.admin-header h1 { font-size: 22px; color: #333; }
.admin-content { padding: 30px; }

/* Stats Grid */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}
.stat-card {
  background: #fff; border-radius: 10px; padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.stat-card.inactive { opacity: 0.5; }
.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.stat-header h3 { font-size: 16px; }
.stat-body { display: flex; gap: 30px; margin-bottom: 15px; }
.stat-item { }
.stat-label { display: block; font-size: 12px; color: #999; }
.stat-value { font-size: 24px; font-weight: 700; color: #333; }
.stat-footer { display: flex; gap: 10px; }
.stat-footer a { font-size: 13px; color: #4a90d9; }

/* Badges */
.badge { padding: 3px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #fce4ec; color: #c62828; }

/* Tables */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.data-table th { background: #f8f9fa; padding: 12px 15px; text-align: left; font-size: 13px; color: #666; border-bottom: 2px solid #eee; }
.data-table td { padding: 10px 15px; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.data-table tr:hover { background: #fafbfc; }
.row-inactive { opacity: 0.5; }
.status-select { padding: 4px 8px; border-radius: 4px; border: 1px solid #ddd; font-size: 12px; }

/* Form Card */
.form-card { background: #fff; padding: 25px; border-radius: 10px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.form-card h3 { margin-bottom: 15px; font-size: 18px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 10px; align-items: center; margin-top: 15px; flex-wrap: wrap; }
.inline-form input, .inline-form select { padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }

/* Image Browser */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.upload-form { display: flex; gap: 10px; align-items: center; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; }
.image-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.image-thumb { height: 150px; background: #f5f5f5; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.image-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-info { padding: 10px; }
.image-name { display: block; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-meta { font-size: 11px; color: #999; }
.image-actions { padding: 0 10px 10px; display: flex; gap: 5px; }

/* Image Nav */
.image-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; }
.card-link {
  display: block; background: #fff; padding: 20px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); transition: transform 0.2s;
}
.card-link:hover { transform: translateY(-3px); text-decoration: none; }
.card-link h3 { font-size: 16px; color: #333; margin-bottom: 5px; }
.card-link p { font-size: 13px; color: #999; }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 20px; }
.total-count { font-size: 14px; color: #666; }
.filter-form { display: flex; gap: 10px; }
.filter-form select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; }
.empty { text-align: center; color: #999; padding: 40px; }

/* Schedule Calendar */
.schedule-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.month-nav { display: flex; align-items: center; gap: 12px; }
.current-month { font-size: 20px; font-weight: 700; min-width: 120px; text-align: center; }

.schedule-matrix { overflow-x: auto; margin-bottom: 20px; }
.matrix-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  min-width: 900px;
}
.matrix-table th {
  background: #2c3e50; color: #fff; padding: 12px 10px;
  font-size: 13px; font-weight: 600; text-align: center;
}
.col-week { width: 80px; }
.col-region { width: calc((100% - 80px) / 5); }
.matrix-table td {
  border: 1px solid #eee; padding: 8px; vertical-align: top; min-height: 100px;
}
.cell-week {
  text-align: center; background: #f8f9fa; font-size: 13px; white-space: nowrap;
}
.week-dates { font-size: 11px; color: #999; }
.cell-empty { text-align: center; vertical-align: middle; }
.add-schedule {
  display: inline-block; width: 36px; height: 36px; line-height: 36px;
  border-radius: 50%; background: #f0f0f0; color: #999; font-size: 20px;
  text-align: center; transition: all 0.2s;
}
.add-schedule:hover { background: #4a90d9; color: #fff; text-decoration: none; }
.add-more {
  display: block; text-align: center; font-size: 11px; color: #999;
  margin-top: 6px; padding: 4px;
}
.add-more:hover { color: #4a90d9; text-decoration: none; }

.schedule-card {
  background: #fafbfc; border-radius: 8px; padding: 10px;
  margin-bottom: 8px; transition: box-shadow 0.2s;
}
.schedule-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.schedule-link { display: block; color: #333; }
.schedule-link:hover { text-decoration: none; }
.schedule-venue { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.schedule-domain { font-size: 11px; color: #4a90d9; margin-bottom: 4px; }
.schedule-dates { font-size: 11px; color: #666; }
.schedule-time { font-size: 11px; color: #999; }
.schedule-status {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; color: #fff; margin-top: 4px; font-weight: 600;
}
.schedule-actions {
  display: flex; gap: 4px; margin-top: 6px; padding-top: 6px;
  border-top: 1px solid #eee;
}
.schedule-actions .btn { font-size: 11px; padding: 3px 8px; }

.status-legend {
  display: flex; align-items: center; gap: 16px; font-size: 12px; color: #666;
  flex-wrap: wrap;
}
.legend-title { font-weight: 700; }
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Design Page */
.design-header {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; padding: 16px 20px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 24px;
  flex-wrap: wrap; gap: 12px;
}
.design-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.design-info strong { font-size: 18px; }
.design-meta { font-size: 13px; color: #888; }
.design-actions-top { display: flex; gap: 8px; flex-wrap: wrap; }

.design-section {
  background: #fff; border-radius: 10px; padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 20px;
}
.design-section h3 { font-size: 16px; margin-bottom: 4px; }
.design-section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.design-section-desc { font-size: 12px; color: #999; }
.upload-inline { display: flex; gap: 8px; align-items: center; }
.upload-input { font-size: 12px; }
.design-empty { text-align: center; color: #bbb; padding: 30px; font-size: 14px; }

.design-images {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px;
}
.design-image-card {
  background: #fafbfc; border-radius: 8px; overflow: hidden;
  border: 1px solid #eee;
}
.design-thumb {
  height: 160px; display: flex; align-items: center; justify-content: center;
  background: #f0f0f0; overflow: hidden;
}
.design-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.design-image-info { padding: 8px 10px; }
.design-image-actions {
  padding: 0 10px 10px; display: flex; gap: 6px;
}

/* Form Actions */
.form-actions {
  display: flex; gap: 10px; margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .admin-main { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* 미사용 이미지 표시 */
.design-image-card.unused {
  opacity: 0.5;
  border: 2px dashed #ccc;
}
.design-image-card.unused:hover {
  opacity: 0.8;
}
.badge-unused {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
  z-index: 1;
}
.design-image-card {
  position: relative;
}
