/* ============================================
   매거진 기사 관리 통합 스타일시트
   article_form, article_links, article_blocks, article_taxonomy
   ============================================ */

select{
    height: 40px !important;
}

/* ----- 공통 레이아웃 ----- */
#con_main {
  margin-top: 10px;
  margin-bottom: 20px;
  padding-left: 10px;
  padding-right: 10px;
  background: #fff;
}

/* ----- 기사 정보 영역 ----- */
.article-info {
  background: #f5f5f5;
  padding: 15px;
  margin-bottom: 20px;
  border-left: 4px solid #2196f3;
}

.article-info h2 {
  margin: 0 0 5px 0;
  color: #333;
}

.article-info .meta {
  font-size: 13px;
  color: #666;
}

/* ----- 정보 박스 ----- */
.info-box {
  background: #e3f2fd;
  padding: 12px;
  margin: 10px 0;
  border-left: 4px solid #2196f3;
  font-size: 13px;
  color: #333;
}

.info-box-help {
  background: #fff3cd;
  padding: 12px;
  margin: 15px 0;
  border-left: 4px solid #ff9800;
  font-size: 13px;
}

/* ----- 폼 요소 ----- */
.input {
  width: 95%;
  height: 28px;
  background: #fff;
  border: 0;
  margin-bottom: 8px;
  border: 1px solid #ccc;
}

.textarea {
  width: 95%;
  height: 80px;
  background: #fff;
  border: 0;
  margin-bottom: 8px;
  border: 1px solid #ccc;
}

label {
  display: block;
  margin: 6px 0 4px 0;
  color: #666;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #333;
}

.form-group .input,
.form-group .textarea{
  width: 98%;
  padding: 1%;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}
.form-group select {
  width: 98%;
  padding: 1%;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}
.form-group .textarea {
  min-height: 150px;
  font-family: monospace;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea{
  width: 98%;
  padding: 1%;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

/* ----- 버튼 ----- */
.btn {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid #cdcdcd;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit {
  background: #2196f3;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  margin-right: 5px;
}

.btn-edit:hover {
  background: #1976d2;
}

.btn-delete {
  background: #f44336;
  color: white;
}

.btn-delete:hover {
  background: #d32f2f;
}

.btn-group {
  text-align: center;
  margin-top: 20px;
  padding: 20px 0;
}

.btn-group .btn {
  margin: 0 5px;
}

/* ----- 그리드 레이아웃 ----- */
/* ============================================
   테이블 그리드 스타일
   ============================================ */

/* ----- 기본 그리드 테이블 ----- */
table.grid {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin-bottom: 20px;
}

table.grid thead {
  background: #f9f9f9;
  border-bottom: 2px solid #ddd;
}

table.grid th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: #333;
  border-bottom: 2px solid #ddd;
}

table.grid th[width] {
  white-space: nowrap;
}

table.grid td {
  padding: 10px;
  vertical-align: top;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  color: #333;
}

table.grid tbody tr {
  transition: background 0.2s;
}

table.grid tbody tr:hover {
  background: #f9f9f9;
}

table.grid tbody tr:last-child td {
  border-bottom: none;
}

/* ----- 테이블 내부 요소 ----- */
table.grid td strong {
  font-weight: 600;
  color: #222;
}

table.grid td a {
  color: #2196f3;
  text-decoration: none;
  transition: color 0.2s;
}

table.grid td a:hover {
  color: #1976d2;
  text-decoration: underline;
}

/* 체크박스 정렬 */
table.grid th input[type="checkbox"],
table.grid td input[type="checkbox"] {
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
}

/* 텍스트 정렬 */
table.grid .text-center {
  text-align: center;
}

table.grid .text-right {
  text-align: right;
}

/* ----- 빈 테이블 상태 ----- */
table.grid tbody tr.empty-row td {
  padding: 40px 20px;
  text-align: center;
  color: #999;
  font-style: italic;
}

/* ----- 반응형 (모바일) ----- */
@media (max-width: 799px) {
  table.grid {
    font-size: 12px;
  }
  
  table.grid th,
  table.grid td {
    padding: 8px 6px;
  }
  
  /* 좁은 화면에서 긴 텍스트 처리 */
  table.grid td {
    word-break: break-word;
  }
}

/* ----- 테이블 내 버튼들 ----- */
table.grid .btn,
table.grid .btn-small {
  margin: 0 2px;
}

/* ----- 스크롤 가능한 테이블 래퍼 (옵션) ----- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table.grid {
  min-width: 800px;
}

/* ----- 테이블 상단 액션 영역 ----- */
.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px 0;
}

.table-actions-left {
  display: flex;
  gap: 10px;
  align-items: center;
}

.table-actions-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ----- 페이지네이션 (테이블과 함께 사용) ----- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: #fff;
  color: #333;
  text-decoration: none;
  border-radius: 3px;
  font-size: 13px;
  transition: all 0.2s;
}

.pagination a:hover {
  background: #f5f5f5;
  border-color: #4CAF50;
}

.pagination span.current {
  background: #4CAF50;
  color: white;
  border-color: #4CAF50;
  font-weight: 600;
}

.pagination span.disabled {
  color: #ccc;
  cursor: not-allowed;
}

/* ----- 테이블 내 배지 정렬 ----- */
table.grid .badge,
table.grid .ai-badge {
  vertical-align: middle;
}

/* ----- 정렬 아이콘 (sortable 테이블) ----- */
table.grid th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 25px;
}

table.grid th.sortable:hover {
  background: #f0f0f0;
}

table.grid th.sortable::after {
  content: '⇅';
  position: absolute;
  right: 8px;
  color: #999;
  font-size: 11px;
}

table.grid th.sortable.asc::after {
  content: '▲';
  color: #4CAF50;
}

table.grid th.sortable.desc::after {
  content: '▼';
  color: #4CAF50;
}

/* ----- 숫자 컬럼 우측 정렬 ----- */
table.grid th.num,
table.grid td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ----- 줄바꿈 방지 (ID, 날짜 등) ----- */
table.grid th.nowrap,
table.grid td.nowrap {
  white-space: nowrap;
}

/* ----- 강조 행 ----- */
table.grid tbody tr.highlight {
  background: #fff3cd;
}

table.grid tbody tr.highlight:hover {
  background: #ffe69c;
}

/* ----- 비활성화 행 ----- */
table.grid tbody tr.disabled {
  opacity: 0.5;
}

table.grid tbody tr.disabled:hover {
  background: transparent;
  cursor: not-allowed;
}

/* ----- Taxonomy 섹션 ----- */
.taxonomy-section {
  margin-bottom: 30px;
  padding: 20px;
  background: #f9f9f9;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}

.taxonomy-section h3 {
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #4CAF50;
  color: #333;
}

/* ----- 체크박스 리스트 ----- */
.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 15px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.checkbox-item:hover {
  border-color: #4CAF50;
  background: #f5f5f5;
}

.checkbox-item input {
  margin-right: 8px;
}

.checkbox-item label {
  cursor: pointer;
  margin: 0;
  flex: 1;
}

/* ----- 국가 그리드 ----- */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 15px;
}

.country-item {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

.country-item input {
  margin-right: 6px;
}

/* ----- 대표 유형 섹션 ----- */
.primary-type-section {
  margin-top: 15px;
  padding: 12px;
  background: #fff3cd;
  border-left: 4px solid #ff9800;
}


/* ----- 블록 관련 스타일 (article_blocks.php 전용) ----- */
.blocks-container,
.relations-container {
  margin-top: 20px;
}
/* 드래그 앤 드롭 스타일 */
.blocks-container {
  position: relative;
}

.block-item {
  transition: all 0.2s ease;
  position: relative;
}

.block-item.dragging {
  opacity: 0.5;
  background: #f0f0f0;
}

.block-header {
  cursor: move !important;
  user-select: none;
}

.block-header::before {
  content: '⋮⋮';
  display: inline-block;  /* ✅ width를 적용하려면 필수 */
  width: 20px;            /* ✅ 원하는 너비 설정 */
  margin-right: 8px;
  color: #999;
  font-size: 16px;
  vertical-align: middle;
  text-align: center;     /* 아이콘 중앙 정렬 */
}

.ui-sortable-placeholder {
  border: 2px dashed #4CAF50 !important;
  background: #e8f5e9 !important;
  visibility: visible !important;
  height: 60px !important;
  margin: 10px 0;
}

.ui-sortable-helper {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: rotate(2deg);
}

/* 블록 아이템 - 드래그 가능 버전 (article_blocks.php) */
.blocks-container .block-item {
  background: white;
  border: 2px solid #e5e5e5;
  border-radius: 4px;
  margin-bottom: 15px;
  overflow: hidden;
  transition: all 0.2s;
  position: relative;
  padding-left: 0px;  /* 드래그 핸들 공간 확보 */
  cursor: move;
}

.blocks-container .block-item:hover {
  border-color: #4CAF50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.blocks-container .block-item.ui-sortable-helper {
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  opacity: 0.9;
}

.blocks-container .block-item.ui-sortable-placeholder {
  border: 2px dashed #4CAF50;
  background: #f0f8f0;
  visibility: visible !important;
}

/* 관계 아이템 - 일반 버전 (article_links.php) */
.relation-item {
  background: white;
  border: 2px solid #e5e5e5;
  border-radius: 4px;
  margin-bottom: 15px;
  overflow: hidden;
  transition: all 0.2s;
}

.relation-item:hover {
  border-color: #4CAF50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.block-header,
.relation-header {
  background: #f9f9f9;
  padding: 12px 15px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.block-header .left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 70%;
}

/* ----- 뱃지 스타일 ----- */
.block-type-badge,
.relation-type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: white;
}

/* 블록 타입별 색상 */
.block-type-badge.paragraph { background: #2196f3; }
.block-type-badge.heading { background: #ff9800; }
.block-type-badge.image { background: #e91e63; }
.block-type-badge.quote { background: #9c27b0; }
.block-type-badge.info { background: #00bcd4; }
.block-type-badge.list { background: #4caf50; }
.block-type-badge.embed { background: #f44336; }
.block-type-badge.recipe { background: #ff5722; }
.block-type-badge.table { background: #795548; }

/* 관계 타입별 색상 */
.relation-type-badge.food { background: #4CAF50; }
.relation-type-badge.restaurant { background: #ff9800; }
.relation-type-badge.article { background: #2196f3; }

.food-source-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 8px;
}

.food-source-badge.ai { background: #673ab7; color: white; }
.food-source-badge.manual { background: #607d8b; color: white; }

.block-sort {
  font-size: 13px;
  color: #666;
  font-weight: 600;
}

.block-actions,
.relation-actions {
  display: flex;
  gap: 8px;
  min-width: 25%;
}

/* ----- 블록/관계 컨텐츠 ----- */
.block-content,
.relation-content {
  padding: 15px;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

.block-content h2,
.block-content h3,
.relation-content h2,
.relation-content h3 {
  margin: 0 0 10px 0;
  color: #333;
}

.block-content .info-box {
  background: #e3f2fd;
  padding: 12px;
  border-left: 4px solid #2196f3;
  margin: 10px 0;
}

.block-content blockquote {
  border-left: 4px solid #ccc;
  padding-left: 15px;
  margin: 10px 0;
  font-style: italic;
  color: #666;
}

.block-content ul,
.block-content ol {
  margin: 10px 0;
  padding-left: 25px;
}

.block-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 10px 0;
}

.block-preview {
  background: #fafafa;
  padding: 10px;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
  max-height: 100px;
  overflow: hidden;
  position: relative;
}

.block-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(transparent, #fafafa);
}

/* ----- 추가 섹션 ----- */
.add-block-section,
.add-relation-section {
  background: #f5f5f5;
  padding: 20px;
  margin-top: 30px;
  border-radius: 4px;
  border: 2px dashed #ccc;
}

.add-block-section h3,
.add-relation-section h3 {
  margin: 0 0 15px 0;
  color: #333;
}

/* ----- 빈 상태 ----- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 15px;
}

/* ----- 관계 상세 정보 ----- */
.relation-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.relation-detail-item {
  font-size: 13px;
  color: #666;
}

.relation-detail-item strong {
  color: #333;
  margin-right: 5px;
}

/* ----- 모달 스타일 (article_blocks.php 전용) ----- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
}

.modal-overlay.active {
  display: block;
}

.block-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 700px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.block-modal.active {
  display: block;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #eee;
}

.modal-close {
  font-size: 28px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

/* ----- 블록 타입 선택 ----- */
.type-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.type-option {
  padding: 15px 10px;
  border: 2px solid #ddd;
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.type-option:hover {
  border-color: #4CAF50;
  background: #f0f8f0;
}

.type-option.active {
  border-color: #4CAF50;
  background: #e8f5e9;
  font-weight: bold;
}

.type-option .icon {
  font-size: 24px;
  margin-bottom: 5px;
}

/* ----- 리스트 아이템 ----- */
.list-items .list-item {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.list-items .list-item input {
  flex: 1;
}

.list-items .btn-remove {
  background: #f44336;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* ----- 이미지 업로드 ----- */
.image-upload {
  border: 2px dashed #ddd;
  border-radius: 4px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.image-upload:hover {
  border-color: #4CAF50;
  background: #f9f9f9;
}

.image-preview {
  margin-top: 10px;
  text-align: center;
}

.image-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 4px;
}

/* ----- 반응형 디자인 ----- */
@media (max-width: 768px) {
  .checkbox-list {
    grid-template-columns: 1fr;
  }
  
  .country-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  
  .block-header,
  .relation-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .block-actions,
  .relation-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .relation-details {
    grid-template-columns: 1fr;
  }
  
  .type-selector {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ----- 유틸리티 클래스 ----- */
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* ============================================
   AI Generator 전용 스타일
   ============================================ */

/* ----- AI 통계 그리드 ----- */
.ai-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.ai-stat-box {
  background: #f5f5f5;
  padding: 20px;
  border-radius: 4px;
  text-align: center;
  border-left: 4px solid #4CAF50;
}

.ai-stat-box h3 {
  font-size: 32px;
  margin: 0 0 8px 0;
  color: #333;
}

.ai-stat-box p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

/* ----- AI 배치 액션 ----- */
.ai-batch-actions {
  margin: 15px 0;
  padding: 15px;
  background: #e3f2fd;
  border-radius: 4px;
}

.ai-batch-actions label {
  margin-right: 10px;
  font-weight: 600;
}

/* ----- AI 생성 버튼 (btn-small 확장) ----- */
.ai-btn-generate {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
}

.ai-btn-generate:hover {
  background: #45a049;
}

.ai-btn-generate:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ----- AI 배지 (상태별) ----- */
.ai-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.ai-badge-draft {
  background: #fff3cd;
  color: #856404;
}

.ai-badge-ready {
  background: #d1ecf1;
  color: #0c5460;
}

.ai-badge-published {
  background: #d4edda;
  color: #155724;
}

/* ----- 로딩 인디케이터 ----- */
.loading-indicator {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 9999;
  text-align: center;
}

.loading-indicator.active {
  display: block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4CAF50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

/* ============================================
   품질 점수 배지
   ============================================ */

.quality-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}

.quality-badge.score-good {
  background: #4CAF50;
  color: white;
}

.quality-badge.score-ok {
  background: #FF9800;
  color: white;
}

.quality-badge.score-bad {
  background: #f44336;
  color: white;
}

/* ============================================
   품질 문제 표시
   ============================================ */

.quality-issues {
  animation: slideDown 0.3s ease-out;
}

.quality-issues .issue-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.quality-summary {
  animation: fadeIn 0.5s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ----- 반응형 (모바일) ----- */
@media (max-width: 799px) {
  .ai-stats-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================
   매거진 메인 페이지 스타일
   ============================================ */

/* 매거진 메인 컨테이너 */
.magazin-main {
    clear: both;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
}

/* 헤더 */
.magazin-hero {
    text-align: center;
    padding: 60px 20px;
    background: #efefef;
    color: white;
    border-radius: 12px;
    margin-bottom: 50px;
}

.magazin-hero h1 {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 15px;
    margin-top: 0;
}

.magazin-hero p {
    font-size: 20px;
    opacity: 0.9;
    margin: 0;
}

/* 헤드라인 그리드 */
.headline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.headline-card {
    position: relative;
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.headline-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    text-decoration: none;
}

.headline-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.headline-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: white;
}

.headline-card-category {
    display: inline-block;
    padding: 4px 12px;
    background: #FD9449;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
}

.headline-card-title {
    font-size: 24px;
    font-weight: bold;
    line-height: 1.3;
    margin-bottom: 10px;
    margin-top: 0;
}

.headline-card-meta {
    font-size: 14px;
    opacity: 0.8;
}

/* 기사 그리드 */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.article-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    background: white;
    display: block;
}

.article-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-4px);
    text-decoration: none;
}

.article-card-image {
    width: 100% !important;
    max-width: 100% !important;
    height: 200px;
    object-fit: cover;
    display: block;
}

.article-card-content {
    padding: 20px;
}

.article-card-category {
    display: inline-block;
    padding: 4px 10px;
    background: #f0f0f0;
    color: #666;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 10px;
}

.article-card-title {
    font-size: 18px;
    font-weight: bold;
    color: #2D2F30;
    margin-bottom: 10px;
    margin-top: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-summary {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-meta {
    font-size: 13px;
    color: #999;
    display: flex;
    gap: 10px;
}

/* 카테고리 필터 */
.category-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 8px;
}
.category-filter a{
    color: #555;
    font-size: 12px;
}

.filter-btn {
    padding: 5px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    background: white;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.filter-btn:hover,
.filter-btn.active {
    background: #FD9449;
    color: white;
    border-color: #FD9449;
    text-decoration: none;
}

/* 더보기 버튼 */
.load-more {
    text-align: center;
    margin: 40px 0;
}

.load-more-btn {
    display: inline-block;
    padding: 15px 40px;
    background: #FD9449;
    color: white;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
}

.load-more-btn:hover {
    background: #5aa9b7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(106, 190, 204, 0.3);
    text-decoration: none;
}

.headline_con{
    float: left;
    width: 100%;
}
.headline-grid{
    margin-top: 30px;
}

/* 반응형 - 태블릿 */
@media (max-width: 999px) {
    .magazin-main {
        padding: 15px;
    }
    
    .magazin-hero {
        padding: 40px 20px;
        margin-bottom: 35px;
    }
    
    .magazin-hero h1 {
        font-size: 36px;
    }
    
    .headline-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
    
    .article-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
}

/* 반응형 - 모바일 */
@media (max-width: 768px) {
    .magazin-main {
        padding: 10px;
    }
    
    .magazin-hero {
        padding: 30px 15px;
        margin-bottom: 25px;
    }
    
    .magazin-hero h1 {
        font-size: 28px;
    }
    
    .magazin-hero p {
        font-size: 16px;
    }
    
    
    .headline-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 30px;
    }
    
    .headline-card {
        height: 350px;
    }
    
    .headline-card-title {
        font-size: 20px;
    }
    
    .article-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 30px;
    }
    
    .category-filter {
        padding: 15px;
        gap: 8px;
    }
    
    .filter-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .load-more {
        margin: 30px 0;
    }
    
    .load-more-btn {
        padding: 12px 30px;
        font-size: 14px;
    }
}

/* 반응형 - 작은 모바일 */
@media (max-width: 480px) {
    .magazin-hero h1 {
        font-size: 24px;
    }
    
    .magazin-hero p {
        font-size: 14px;
    }
    
    .headline-card {
        height: 300px;
    }
    
    .headline-card-overlay {
        padding: 20px;
    }
    
    .headline-card-title {
        font-size: 18px;
    }
    
    .article-card-content {
        padding: 15px;
    }
}

/* ============================================
   AI 기사 작성 폼 전용 스타일 (article_form_ai.php)
   ============================================ */

/* ----- AI 폼 섹션 ----- */
.ai-form-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e5e5;
}

.ai-form-section:last-child {
  border-bottom: none;
}

.ai-form-section h3 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #333;
  padding: 8px 10px;
  background: #f5f5f5;
  border-left: 4px solid #4CAF50;
}

.ai-form-section .description {
  color: #777;
  font-size: 13px;
  margin-bottom: 12px;
  padding-left: 10px;
}

/* ----- 체크박스/라디오 그룹 (AI 폼용) ----- */
.checkbox-group, .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.radio-item {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

.radio-item:hover {
  border-color: #4CAF50;
  background: #f9f9f9;
}

.radio-item input:checked + label {
  font-weight: 600;
  color: #4CAF50;
}

.radio-item input {
  margin-right: 6px;
  cursor: pointer;
}

.radio-item label {
  cursor: pointer;
  margin: 0;
}

/* ----- 음식 검색 UI ----- */
.food-search-wrapper {
  padding: 10px;
}

.food-search {
  position: relative;
  margin-bottom: 15px;
}

.food-search input {
  width: 100%;
  max-width: 600px;
  padding: 10px 12px;
  border: 1px solid #cdcdcd;
  border-radius: 4px;
  font-size: 14px;
}

.food-search input:focus {
  outline: none;
  border-color: #4CAF50;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-width: 600px;
  background: white;
  border: 1px solid #cdcdcd;
  border-top: none;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: #f5f5f5;
}

.search-result-item .food-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.search-result-item .food-meta {
  font-size: 12px;
  color: #666;
}

/* ----- 배지 (AI 폼용 추가) ----- */
.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

.badge.ai {
  background: #f3e5f5;
  color: #7b1fa2;
}

.badge.official {
  background: #e3f2fd;
  color: #1976d2;
}

.badge.enriched {
  background: #e8f5e9;
  color: #388e3c;
}

/* ----- 선택된 음식 태그 ----- */
.selected-foods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.food-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #e3f2fd;
  border-radius: 15px;
  font-size: 13px;
  color: #1976d2;
}

.food-tag button {
  background: none;
  border: none;
  color: #1976d2;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.food-tag button:hover {
  color: #d32f2f;
}

/* ----- 로딩 오버레이 ----- */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.loading-overlay.active {
  display: flex;
}

.loading-box {
  background: white;
  padding: 40px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* ----- 초안 편집기 ----- */
.draft-editor {
  display: none;
}

.draft-editor.active {
  display: block;
}

.draft-header {
  background: #e8f5e9;
  padding: 15px;
  margin-bottom: 20px;
  border-left: 4px solid #4CAF50;
}

.draft-header h3 {
  margin: 0 0 5px 0;
  color: #2e7d32;
}

.draft-actions {
  margin-top: 10px;
}

.draft-actions .btn {
  margin-right: 8px;
}

/* ----- 그리드 2열 ----- */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 799px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
  
  .food-search input {
    max-width: 100%;
  }
}