/* ============================================================
   common.css  —  StrategyAI 공통 스타일
   원칙:
     - Bootstrap 클래스 최대 활용
     - 단일 목적 유틸리티 클래스만 추가
     - px 부동소수점 없이 정수만 사용
     - inline style 대신 이 파일의 클래스 사용
   ============================================================ */

/* ─── CSS 변수 ─── */
:root {
  --primary:   #1a3a5f;
  --secondary: #3498db;
  --accent:    #e67e22;
  --success:   #27ae60;
  --danger:    #e74c3c;
  --bg:        #f4f7f9;
  --white:     #ffffff;
  --text:      #2c3e50;
  --border:    #dee2e6;
}

/* ─── 전역 ─── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ─── 색상 ─── */
.text-primary-custom { color: var(--primary) !important; }
.text-accent         { color: var(--accent)  !important; }
.bg-primary-custom   { background-color: var(--primary) !important; }
.bg-accent           { background-color: var(--accent)  !important; }
.bg-page             { background-color: var(--bg)      !important; }

/* ─── Gradient ─── */
.bg-gradient-primary { background: linear-gradient(135deg, #1a3a5f 0%, #2356a0 60%, #3498db 100%) !important; }
.bg-gradient-accent  { background: linear-gradient(135deg, #f39c12, #e67e22) !important; }
.bg-gradient-card    { background: linear-gradient(135deg, #1a3a5f, #3498db) !important; }

/* ─── 그림자 ─── */
.shadow-sm-custom { box-shadow: 0 2px 8px rgba(0,0,0,.06) !important; }
.shadow-md-custom { box-shadow: 0 4px 20px rgba(0,0,0,.09) !important; }
.shadow-lg-custom { box-shadow: 0 10px 40px rgba(0,0,0,.12) !important; }

/* ─── 보더 ─── */
.border-top-primary    { border-top: 4px solid var(--primary)   !important; }
.border-top-accent     { border-top: 4px solid var(--accent)    !important; }
.border-top-success    { border-top: 4px solid var(--success)   !important; }
.border-top-secondary  { border-top: 4px solid var(--secondary) !important; }
.border-top-purple     { border-top: 4px solid #8e44ad !important; }
.border-top-danger     { border-top: 4px solid var(--danger)    !important; }
.border-top-teal       { border-top: 4px solid #16a085 !important; }
.border-left-primary   { border-left: 5px solid var(--primary)   !important; }
.border-left-accent    { border-left: 4px solid var(--accent)    !important; }
.border-left-success   { border-left: 4px solid var(--success)   !important; }
.border-left-danger    { border-left: 4px solid var(--danger)    !important; }
.border-left-secondary { border-left: 4px solid var(--secondary) !important; }
.border-left-pending   { border-left: 4px solid #f39c12          !important; }
.border-dashed-custom  { border: 2px dashed var(--border) !important; }

/* ─── 카드 ─── */
.card-custom {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,.09);
  border: none;
  overflow: hidden;
}
.card-hover { transition: transform .2s, box-shadow .2s; }
.card-hover:hover { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(0,0,0,.12); }
.card-header-primary {
  background: var(--primary) !important;
  color: #fff !important;
  border-radius: 16px 16px 0 0 !important;
}

/* ─── 버튼 ─── */
.btn-primary-custom { background: var(--primary); color: #fff !important; border: none; font-weight: 600; }
.btn-primary-custom:hover { background: #142d4a; color: #fff; }
.btn-accent-custom  { background: var(--accent);  color: #fff !important; border: none; font-weight: 600; }
.btn-accent-custom:hover { background: #d35400; color: #fff; }
.btn-hero { padding: 16px 40px; font-size: 1rem; font-weight: 700; }
.btn-hero-outline {
  background: transparent;
  color: #fff !important;
  border: 2px solid rgba(255,255,255,.6);
}
.btn-hero-outline:hover { border-color: #fff; background: rgba(255,255,255,.1); }
.btn-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-submit-full {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all .2s;
}
.btn-submit-full:hover { background: #142d4a; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(26,58,95,.3); }
.btn-submit-full:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }

/* ─── 커서 ─── */
.cursor-pointer     { cursor: pointer; }
.cursor-default     { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* ─── 폰트 ─── */
.fw-900         { font-weight: 900  !important; }
.fw-800         { font-weight: 800  !important; }
.fs-hero        { font-size: clamp(2rem, 5vw, 3.5rem) !important; }
.fs-section-title { font-size: 2rem !important; }
.ls-wide        { letter-spacing: 2px !important; }
.section-tag    { color: var(--secondary); font-weight: 700; font-size: .85rem;
                  text-transform: uppercase; letter-spacing: 2px; }

/* ─── 폼 ─── */
.form-control-custom {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
}
.form-control-custom:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(52,152,219,.15);
  outline: none;
}
.form-label-custom { font-weight: 600; color: var(--primary); font-size: .9rem; margin-bottom: 6px; }
.input-optional    { font-weight: 400; color: #aaa; font-size: .8rem; }
.char-count        { font-size: .78rem; color: #aaa; }

/* ─── 뱃지 ─── */
.badge-plan-free       { background: #95a5a6; color: #fff; }
.badge-plan-basic      { background: var(--secondary); color: #fff; }
.badge-plan-pro        { background: var(--accent); color: #fff; }
.badge-plan-enterprise { background: #8e44ad; color: #fff; }
.badge-xs { padding: 3px 10px; border-radius: 12px; font-size: .72rem; font-weight: 600; }
.badge-sm { padding: 4px 12px; border-radius: 14px; font-size: .78rem; font-weight: 600; }
.badge-status-completed  { background: #d4edda; color: #155724; }
.badge-status-processing { background: #cce5ff; color: #004085; }
.badge-status-pending    { background: #fff3cd; color: #856404; }
.badge-status-failed     { background: #f8d7da; color: #721c24; }
.badge-status-active     { background: #d4edda; color: #155724; }
.badge-status-expired    { background: #f8d7da; color: #721c24; }
.badge-status-cancelled  { background: #e9ecef; color: #495057; }

/* ─── 네비게이션 ─── */
.navbar-custom     { background: var(--primary) !important; padding: 12px 16px; }
.navbar-brand-custom { font-weight: 800; font-size: 1.4rem; color: #fff !important; }
.navbar-brand-accent { color: var(--accent) !important; }
.nav-link-custom   { color: rgba(255,255,255,.85) !important; font-weight: 500; }
.nav-link-custom:hover { color: #fff !important; }
.navbar-cta-btn    { background: var(--accent) !important; color: #fff !important;
                     border-radius: 30px; padding: 6px 20px !important; font-weight: 700; }

/* ─── 토스트 ─── */
.toast-top-right { position: fixed; top: 70px; right: 20px; z-index: 9999; min-width: 260px; }

/* ─── 섹션 패딩 ─── */
.section-pad    { padding: 80px 0; }
.section-pad-sm { padding: 50px 0; }

/* ─── 히어로 ─── */
.hero-section     { color: #fff; padding: 100px 0 80px; text-align: center; }
.stats-bar-hero   { background: rgba(0,0,0,.2); padding: 24px 0; margin-top: 60px; }
.stat-hero-num    { font-size: 2rem; font-weight: 900; color: #f39c12; }
.stat-hero-label  { font-size: .85rem; opacity: .8; }

/* ─── 프레임워크 체크 카드 ─── */
.fw-check-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all .2s;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fw-check-card:hover   { border-color: var(--secondary); background: #f0f7ff; }
.fw-check-card.is-checked { border-color: var(--primary); background: #eef4ff; }
.fw-check-card.is-locked  { opacity: .5; cursor: not-allowed; }
.fw-check-card.is-locked:hover { border-color: var(--border) !important; background: #fff !important; }
.fw-check-icon  { font-size: 1.2rem; width: 24px; text-align: center; flex-shrink: 0; }
.fw-check-name  { font-weight: 600; font-size: .88rem; display: block; }
.fw-check-desc  { color: #888; font-size: .76rem; }

/* ─── 파일 드롭존 ─── */
.file-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fafafa;
}
.file-dropzone:hover,
.file-dropzone.is-dragover { border-color: var(--secondary); background: #f0f7ff; }
.file-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: .85rem;
  margin-top: 6px;
}
.file-remove-btn { cursor: pointer; color: var(--danger); margin-left: auto; }

/* ─── 분석 진행 애니메이션 ─── */
.brain-ring {
  position: absolute;
  border-radius: 50%;
  border: 3px solid transparent;
  animation: spin-ring linear infinite;
}
.ring-1 { width: 120px; height: 120px; top: 0;  left: 0;  border-top-color: var(--primary);   animation-duration: 2s;   }
.ring-2 { width: 90px;  height: 90px;  top: 15px; left: 15px; border-top-color: var(--secondary); animation-duration: 1.5s; }
.ring-3 { width: 60px;  height: 60px;  top: 30px; left: 30px; border-top-color: var(--accent);    animation-duration: 1s;   }
@keyframes spin-ring { to { transform: rotate(360deg); } }

.step-icon-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
  transition: all .3s;
}
.step-icon-done   { background: var(--success);   color: #fff; }
.step-icon-active { background: var(--secondary); color: #fff; animation: pulse-dot 1s infinite; }
.step-icon-wait   { background: #e9ecef; color: #aaa; }
@keyframes pulse-dot { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }

/* ─── 진행 바 ─── */
.progress-custom      { height: 10px; border-radius: 10px; background: #e9ecef; overflow: hidden; }
.progress-bar-custom  { background: linear-gradient(90deg, var(--primary), var(--secondary));
                         border-radius: 10px; transition: width .8s ease; }

/* ─── 완료/오류 아이콘 ─── */
.icon-done-anim  { font-size: 4rem; color: var(--success); animation: bounce-in .6s; }
.icon-error-anim { font-size: 3rem; color: var(--danger); }
@keyframes bounce-in { 0%{transform:scale(0)} 60%{transform:scale(1.2)} 100%{transform:scale(1)} }

/* ─── 보고서 뷰어 ─── */
.viewer-grid { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
@media (max-width: 992px) { .viewer-grid { grid-template-columns: 1fr; } }

.section-tab-pill {
  padding: 4px 14px; border-radius: 20px; font-size: .8rem;
  cursor: pointer; border: 1px solid var(--border);
  background: #fff; transition: all .2s; display: inline-block;
}
.section-tab-pill:hover,
.section-tab-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── 채팅 ─── */
.chat-messages-wrap {
  height: 420px; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-bubble-base {
  padding: 12px 16px; max-width: 85%;
  font-size: .9rem; line-height: 1.55;
  animation: fade-slide-in .3s ease;
}
.chat-bubble-user {
  background: var(--primary); color: #fff; align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
}
.chat-bubble-ai {
  background: #f0f4f8; color: var(--text); align-self: flex-start;
  border-radius: 16px 16px 16px 4px;
}
@keyframes fade-slide-in { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

.typing-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #aaa; display: inline-block;
  animation: typing-bounce .8s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typing-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

.chat-input-textarea {
  flex: 1; border: 1px solid var(--border); border-radius: 24px;
  padding: 10px 18px; font-size: .9rem; outline: none;
  resize: none; overflow: hidden; max-height: 120px; transition: border-color .2s;
}
.chat-input-textarea:focus { border-color: var(--secondary); }
.chat-send-btn { background: var(--secondary); color: #fff; border: none; cursor: pointer; transition: background .2s; }
.chat-send-btn:hover    { background: var(--primary); }
.chat-send-btn:disabled { background: #ccc; cursor: not-allowed; }
.quick-q-btn { font-size: .78rem; padding: 4px 14px; border-radius: 20px; cursor: pointer; }

/* ─── 토큰 바 ─── */
.token-progress      { height: 4px; background: #e9ecef; border-radius: 4px; overflow: hidden; }
.token-progress-fill { height: 100%; border-radius: 4px;
                       background: linear-gradient(90deg, var(--success), var(--secondary));
                       transition: width .5s; }
.token-progress-warn { background: var(--danger) !important; }

/* ─── 관리자 사이드바 ─── */
.adm-sidebar {
  width: 240px; background: var(--primary); color: #fff;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
  display: flex; flex-direction: column;
}
.adm-sidebar-brand  { padding: 22px 20px; font-size: 1.3rem; font-weight: 900;
                       border-bottom: 1px solid rgba(255,255,255,.1); }
.adm-sidebar-nav    { flex: 1; padding: 14px 0; overflow-y: auto; }
.adm-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: rgba(255,255,255,.75);
  text-decoration: none; font-size: .88rem; font-weight: 500; transition: all .15s;
}
.adm-nav-link:hover          { background: rgba(255,255,255,.1); color: #fff; }
.adm-nav-link.active         { background: rgba(255,255,255,.15); color: #fff; border-right: 3px solid var(--accent); }
.adm-nav-link i              { width: 18px; text-align: center; }
.adm-main-content            { margin-left: 240px; flex: 1; padding: 26px; }
.adm-sidebar-footer          { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.1);
                                font-size: .78rem; opacity: .6; }

/* ─── 요금제 카드 ─── */
.pricing-card {
  background: #fff; border-radius: 20px; padding: 36px 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,.07); text-align: center;
  border: 2px solid transparent; transition: all .2s; height: 100%;
}
.pricing-card.is-popular { border-color: var(--accent); transform: scale(1.03);
                            box-shadow: 0 12px 40px rgba(230,126,34,.2); }
.pricing-card.is-current { border-color: var(--primary); }
.pricing-price           { font-size: 2.8rem; font-weight: 900; color: var(--primary); }
.pricing-period          { font-size: .9rem; color: #888; }
.pricing-feature-list    { list-style: none; padding: 0; text-align: left; font-size: .88rem; margin: 0; }
.pricing-feature-list li { padding: 9px 0; border-bottom: 1px solid #f5f5f5;
                            display: flex; align-items: center; gap: 10px; }
.fi-check { color: var(--success); }
.fi-cross  { color: #ccc; }
.btn-pricing {
  width: 100%; padding: 12px; border-radius: 10px; font-weight: 700; font-size: .95rem;
  border: 2px solid var(--primary); background: transparent; color: var(--primary);
  cursor: pointer; transition: all .2s; text-decoration: none; display: block; text-align: center;
}
.btn-pricing:hover            { background: var(--primary); color: #fff; }
.btn-pricing.is-popular       { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-pricing.is-popular:hover { background: #d35400; border-color: #d35400; }
.btn-pricing.is-active        { background: var(--primary); border-color: var(--primary); color: #fff; cursor: default; }

/* ─── 대시보드 프로젝트 카드 ─── */
.project-card-wrap {
  background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: all .2s; height: 100%; display: flex; flex-direction: column;
  border-left: 4px solid var(--border);
}
.project-card-wrap:hover      { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.project-card-completed       { border-left-color: var(--success)   !important; }
.project-card-processing      { border-left-color: var(--secondary) !important; }
.project-card-pending         { border-left-color: #f39c12          !important; }
.project-card-failed          { border-left-color: var(--danger)    !important; }
.fw-chip { background: #f0f4f8; color: var(--primary); padding: 2px 10px;
           border-radius: 12px; font-size: .73rem; font-weight: 600; }
.new-project-btn {
  border: 2px dashed var(--border); background: #fafafa;
  border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 40px 24px;
  cursor: pointer; transition: all .2s; text-decoration: none; color: #888; min-height: 200px;
}
.new-project-btn:hover { border-color: var(--secondary); background: #f0f7ff; color: var(--primary); }

/* ─── 업그레이드 배너 ─── */
.upgrade-banner {
  border-radius: 12px; padding: 18px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 24px;
}

/* ─── 인증 페이지 ─── */
.auth-card-wrap { max-width: 460px; margin: 60px auto; }
.auth-card { background: #fff; border-radius: 20px; padding: 44px 40px; box-shadow: 0 10px 40px rgba(0,0,0,.12); }

/* ─── Demo 미리보기 ─── */
.demo-bar { background: var(--primary); padding: 12px 20px; display: flex; align-items: center; gap: 8px; }
.demo-dot   { width: 12px; height: 12px; border-radius: 50%; }
.demo-dot-r { background: #ff5f57; }
.demo-dot-y { background: #febc2e; }
.demo-dot-g { background: #28c840; }

/* ─── SWOT ─── */
.swot-cell-strength    { background: #e8f5e9; border: 2px solid #4caf50; border-radius: 8px; padding: 16px; }
.swot-cell-weakness    { background: #ffebee; border: 2px solid #f44336; border-radius: 8px; padding: 16px; }
.swot-cell-opportunity { background: #e3f2fd; border: 2px solid #2196f3; border-radius: 8px; padding: 16px; }
.swot-cell-threat      { background: #fff3e0; border: 2px solid #ff9800; border-radius: 8px; padding: 16px; }
.usp-banner { background: var(--primary); color: #fff; padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; }

/* ─── 마크다운 콘텐츠 ─── */
.md-content h1,.md-content h2,.md-content h3 { margin-top: 1.2em; }
.md-content table  { width: 100%; border-collapse: collapse; }
.md-content th, .md-content td { border: 1px solid #ddd; padding: 8px 12px; }
.md-content th     { background: #f8f9fa; }
.md-content code   { background: #f0f0f0; padding: 2px 6px; border-radius: 4px; font-size: .85em; }
.md-content pre    { background: #f8f9fa; padding: 16px; border-radius: 8px; overflow-x: auto; }

/* ─── 테이블 ─── */
.table-custom th { background: #f8f9fa; color: var(--primary); font-weight: 600;
                   border-bottom: 2px solid #eee; white-space: nowrap; }
.table-custom tbody tr:hover td { background: #fafafa; }

/* ─── 푸터 ─── */
.footer-custom { background: var(--primary); color: rgba(255,255,255,.65); padding: 28px 0; font-size: .85rem; text-align: center; }
.footer-link   { color: rgba(255,255,255,.65); text-decoration: none; }
.footer-link:hover { color: #fff; }

/* ─── 유틸 ─── */
.min-h-screen  { min-height: 100vh; }
.sticky-top-20 { position: sticky; top: 20px; }
.overflow-x-auto { overflow-x: auto; }
.lh-1 { line-height: 1 !important; }

/* ─── 통계 아이콘 배경 ─── */
.icon-bg-blue   { background: #e3f2fd; color: #3498db; }
.icon-bg-orange { background: #fff3e0; color: #e67e22; }
.icon-bg-green  { background: #e8f5e9; color: #27ae60; }
.icon-bg-pink   { background: #fce4ec; color: #e91e63; }
.icon-bg-purple { background: #f3e5f5; color: #9c27b0; }
.icon-bg-teal   { background: #e0f2f1; color: #009688; }

/* ─── 반응형 ─── */
@media (max-width: 768px) {
  .adm-sidebar     { transform: translateX(-100%); }
  .adm-main-content { margin-left: 0; padding: 16px; }
  .auth-card       { padding: 28px 20px; }
  .hero-section    { padding: 60px 0 50px; }
  .section-pad     { padding: 50px 0; }
}
@media print {
  body            { background: #fff; }
  .no-print       { display: none !important; }
}
