/* ========================================================
   (주)진영일렉트릭 - 커뮤니티 & 견적 상담 게시판 전용 CSS
======================================================== */

.comm-hero {
  position: relative;
  padding: 140px 0 60px;
  background: linear-gradient(135deg, #051329 0%, #092042 50%, #0c2b59 100%);
  color: #ffffff;
  overflow: hidden;
}

.comm-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 15% 30%, rgba(0, 210, 255, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(0, 86, 224, 0.18) 0%, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  pointer-events: none;
}

.comm-hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 24px;
}

.comm-title-wrap h1 {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.comm-title-wrap p {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 620px;
  line-height: 1.6;
}

.comm-hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* 관리자 상태 배너 */
.admin-badge-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 107, 0, 0.15);
  border: 1px solid rgba(255, 107, 0, 0.4);
  color: #ff9944;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.admin-badge-bar .dot {
  width: 8px;
  height: 8px;
  background: #ff6b00;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff6b00;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* 메인 대시보드 통계 카드 */
.comm-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: -30px;
  position: relative;
  z-index: 10;
  margin-bottom: 40px;
}

.comm-stat-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 22px 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.comm-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-blue);
}

.comm-stat-info span {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.comm-stat-info strong {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-title);
  font-family: var(--font-en), var(--font-main);
}

.comm-stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.icon-blue { background: rgba(0, 86, 224, 0.1); color: var(--primary-blue); }
.icon-orange { background: rgba(255, 107, 0, 0.1); color: var(--accent-orange); }
.icon-cyan { background: rgba(0, 210, 255, 0.12); color: #0088b3; }
.icon-green { background: rgba(16, 185, 129, 0.12); color: #10b981; }

/* 커뮤니티 본문 레이아웃 */
.comm-main-section {
  padding-bottom: 90px;
}

.comm-container {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  padding: 32px;
}

/* 툴바 (필터 탭 + 검색/글쓰기/관리자) */
.comm-toolbar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 28px;
}

.comm-category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 16px;
}

.comm-tab-btn {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-body);
  background: #f1f5f9;
  border: 1px solid transparent;
  transition: var(--transition);
}

.comm-tab-btn:hover {
  background: #e2e8f0;
  color: var(--primary-blue);
}

.comm-tab-btn.active {
  background: var(--primary-blue);
  color: #ffffff;
  border-color: var(--primary-blue);
  box-shadow: 0 4px 12px rgba(0, 86, 224, 0.25);
}

.comm-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.comm-filter-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.comm-select {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: #ffffff;
  font-size: 0.9rem;
  color: var(--text-body);
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.comm-select:focus {
  border-color: var(--border-focus);
}

.comm-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.comm-search-input {
  width: 240px;
  padding: 10px 16px 10px 38px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
}

.comm-search-input:focus {
  width: 280px;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.comm-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.comm-filter-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 관리자 모드 전용 안내 띠 */
.admin-mode-banner {
  display: none;
  background: linear-gradient(90deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin-bottom: 20px;
  align-items: center;
  justify-content: space-between;
  color: #9a3412;
  font-size: 0.9rem;
}

.admin-mode-banner.active {
  display: flex;
}

.admin-mode-banner strong {
  color: #c2410c;
}

/* 게시판 테이블 스타일 */
.comm-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.comm-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9375rem;
}

.comm-table thead {
  background: #f8fafc;
  border-bottom: 2px solid var(--border-light);
}

.comm-table th {
  padding: 14px 16px;
  font-weight: 700;
  color: var(--text-title);
  white-space: nowrap;
}

.comm-table td {
  padding: 16px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-body);
  vertical-align: middle;
}

.comm-table tbody tr {
  transition: var(--transition);
  cursor: pointer;
}

.comm-table tbody tr:hover {
  background-color: #f8fafc;
}

.comm-table tbody tr.is-secret:hover {
  background-color: #fcfdfe;
}

/* 분류 뱃지 */
.tag-category {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tag-elec { background: #e0f2fe; color: #0284c7; }
.tag-ctrl { background: #ede9fe; color: #7c3aed; }
.tag-signal { background: #ecfdf5; color: #059669; }
.tag-gen { background: #fff7ed; color: #ea580c; }
.tag-general { background: #f1f5f9; color: #475569; }

/* 상태 뱃지 */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-pending { background: #fff1f2; color: #e11d48; border: 1px solid #fecdd3; }
.status-process { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.status-done { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

.status-dot-sm {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* 제목 행 */
.comm-post-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-title);
}

.comm-post-title:hover {
  color: var(--primary-blue);
}

.icon-lock {
  color: #f59e0b;
  display: inline-flex;
  align-items: center;
}

.reply-badge {
  background: #f1f5f9;
  color: var(--primary-blue);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* 빈 상태 */
.comm-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.comm-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  color: #cbd5e1;
}

/* 페이지네이션 */
.comm-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-body);
  border: 1px solid var(--border-light);
  background: #ffffff;
  transition: var(--transition);
}

.page-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.page-btn.active {
  background: var(--primary-blue);
  color: #ffffff;
  border-color: var(--primary-blue);
}

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

/* ========================================================
   모달 공통 스타일 및 전용 모달 (글쓰기, 상세보기, 로그인)
======================================================== */
.comm-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 32, 66, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  padding: 20px;
}

.comm-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.comm-modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transform: translateY(20px);
  transition: var(--transition);
  position: relative;
}

.comm-modal-backdrop.open .comm-modal-box {
  transform: translateY(0);
}

.comm-modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.comm-modal-header h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-title);
  display: flex;
  align-items: center;
  gap: 8px;
}

.comm-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
  background: #e2e8f0;
  cursor: pointer;
  transition: var(--transition);
}

.comm-modal-close:hover {
  background: #cbd5e1;
  color: var(--text-title);
}

.comm-modal-body {
  padding: 28px;
}

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

.comm-form-group {
  margin-bottom: 18px;
}

.comm-form-group.full {
  grid-column: span 2;
}

.comm-form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 8px;
}

.comm-form-label .req {
  color: #ef4444;
  margin-left: 2px;
}

.comm-input, .comm-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  background: #ffffff;
  color: var(--text-body);
  transition: var(--transition);
}

.comm-input:focus, .comm-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.comm-textarea {
  min-height: 120px;
  resize: vertical;
}

.comm-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--text-body);
}

.comm-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-blue);
  cursor: pointer;
}

.comm-modal-footer {
  padding: 18px 28px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #ffffff;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* 글 상세 보기 모달 전용 */
.post-detail-meta {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  font-size: 0.9rem;
}

.post-detail-meta strong {
  color: var(--text-title);
  margin-right: 6px;
}

.post-detail-content {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-body);
  white-space: pre-wrap;
  margin-bottom: 24px;
  min-height: 120px;
}

/* 관리자 답변 영역 */
.admin-reply-box {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
}

.admin-reply-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dbeafe;
}

.admin-reply-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--primary-blue);
  font-size: 0.95rem;
}

.admin-reply-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-reply-text {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #1e293b;
  white-space: pre-wrap;
}

/* 관리자 제어 패널 (상세 모달 내부) */
.admin-action-panel {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 20px;
}

.admin-action-panel h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #c2410c;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-control-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* 토스트 알림 */
.comm-toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.comm-toast {
  background: #0f1e3a;
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  font-size: 0.9375rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--accent-cyan);
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 반응형 */
@media (max-width: 992px) {
  .comm-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .comm-hero {
    padding: 120px 0 50px;
  }
}

@media (max-width: 768px) {
  .comm-stats-grid {
    grid-template-columns: 1fr;
    margin-top: 10px;
  }
  .comm-container {
    padding: 20px 16px;
  }
  .comm-form-grid {
    grid-template-columns: 1fr;
  }
  .comm-form-group.full {
    grid-column: span 1;
  }
  .post-detail-meta {
    grid-template-columns: 1fr;
  }
  .comm-filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  .comm-filter-left, .comm-filter-right {
    width: 100%;
    justify-content: space-between;
  }
  .comm-search-input {
    width: 100%;
  }
  .comm-search-box {
    flex: 1;
  }
}
