/* ========================================
   Commerce System Presentation Styles
   Color Concept: Black & White
   ======================================== */

/* ========== CSS Variables ========== */
:root {
  /* Colors */
  --color-primary: #000000;
  --color-secondary: #333333;
  --color-text: #1a1a1a;
  --color-text-light: #666666;
  --color-bg: #ffffff;
  --color-bg-light: #f8f8f8;
  --color-border: #e0e0e0;
  --color-accent: #2c2c2c;

  /* Typography */
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
  --font-mono: 'SF Mono', 'Consolas', 'Monaco', monospace;

  /* Sizes */
  --page-width: 1200px;
  --page-height: 900px; /* 16:9 ratio */
  --padding-page: 45px; /* 전체 슬라이드 통일 패딩 */
  --padding-content: 40px;

  /* Font Sizes */
  --font-size-h1: 56px;
  --font-size-h2: 42px;
  --font-size-h3: 32px;
  --font-size-h4: 24px;
  --font-size-body: 18px;
  --font-size-small: 14px;
  --font-size-tiny: 12px;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
}

/* ========== Base Styles ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  color: var(--color-text);
  background-color: #1a1a1a;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== Slide Container ========== */
.slide-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 40px;
}

.slide {
  width: var(--page-width);
  height: var(--page-height);
  background-color: var(--color-bg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  page-break-after: always;
}

/* ========== 1. Cover Slide (표지) ========== */
.slide-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #000000 0%, #2c2c2c 100%);
  color: var(--color-bg);
}

.slide-cover .cover-content {
  text-align: center;
  max-width: 900px;
  padding: var(--padding-page);
}

.slide-cover .cover-title {
  font-size: var(--font-size-h1);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
  line-height: 1.2;
}

.slide-cover .cover-subtitle {
  font-size: var(--font-size-h3);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-xl);
  letter-spacing: -0.01em;
}

.slide-cover .cover-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  font-size: var(--font-size-body);
  color: rgba(255, 255, 255, 0.6);
  margin-top: var(--space-xl);
}

.slide-cover .cover-divider {
  width: 80px;
  height: 3px;
  background-color: var(--color-bg);
  margin: var(--space-xl) auto;
}

/* ========== 2. Section Title Slide (중간 타이틀) ========== */
.slide-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--color-primary);
  color: var(--color-bg);
  position: relative;
}

.slide-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background-color: var(--color-bg);
}

.slide-section .section-content {
  text-align: center;
  max-width: 800px;
  padding: var(--padding-page);
}

.slide-section .section-number {
  font-size: var(--font-size-body);
  font-weight: 300;
  letter-spacing: 0.3em;
  margin-bottom: var(--space-md);
  opacity: 0.6;
}

.slide-section .section-title {
  font-size: var(--font-size-h2);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
  line-height: 1.2;
}

.slide-section .section-subtitle {
  font-size: var(--font-size-h4);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: -0.01em;
}

/* ========== 3. Content Slide (메인 페이지) ========== */
.slide-content {
  display: flex;
  flex-direction: column;
  padding: var(--padding-page);
}

/* Header */
.slide-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md); /* lg → md: 콘텐츠 영역 확대 */
  min-height: 80px; /* 100px → 80px: 콘텐츠 영역 확대 */
  position: relative;
}

.slide-title-area {
  flex: 1;
  padding-right: var(--space-lg);
}

/* Work In Progress Badge */
.wip-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(238, 90, 111, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: wipPulse 2s ease-in-out infinite;
}

.wip-badge::before {
  content: '🔴';
  font-size: 12px;
  animation: wipBlink 1.5s ease-in-out infinite;
}

@keyframes wipPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(238, 90, 111, 0.3);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(238, 90, 111, 0.5);
  }
}

@keyframes wipBlink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.slide-title {
  font-size: var(--font-size-h3);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.slide-summary {
  font-size: var(--font-size-body);
  color: var(--color-text-light);
  line-height: 1.6;
  margin-top: var(--space-sm);
}

.slide-logo {
  width: 120px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.slide-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.slide-logo-placeholder {
  width: 100%;
  height: 100%;
  border: 2px dashed var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-tiny);
  color: var(--color-text-light);
}

/* Body */
.slide-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto; /* 스크롤 허용 */
  padding-bottom: var(--space-md); /* lg → md: 콘텐츠 영역 확대 */
}

/* Footer */
.slide-footer {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xs); /* sm → xs: 콘텐츠 영역 확대 */
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: auto;
}

.slide-page-number {
  font-size: var(--font-size-small);
  color: var(--color-text-light);
  font-weight: 500;
}

/* ========== Content Elements ========== */

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--color-primary);
}

/* Lists */
ul, ol {
  margin-left: var(--space-md);
  margin-bottom: var(--space-md);
}

li {
  font-size: var(--font-size-body);
  line-height: 1.8;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

ul li {
  list-style-type: none;
  position: relative;
  padding-left: var(--space-md);
}

ul li::before {
  content: '■';
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-size: 0.7em;
}

/* Nested list indentation (중첩 리스트 들여쓰기) */
.slide-body ul ul {
  margin-left: var(--space-md);
  margin-top: var(--space-xs);
  margin-bottom: var(--space-xs);
}

.slide-body ul ul li::before {
  content: '◦';
  font-size: 0.8em;
}

/* Code blocks */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--color-bg-light);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--color-primary);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  background-color: var(--color-bg-light);
  padding: var(--space-md);
  border-radius: 4px;
  overflow-x: auto;
  border-left: 3px solid var(--color-primary);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-md);
  font-size: var(--font-size-body);
}

thead {
  background-color: var(--color-primary);
  color: var(--color-bg);
}

th {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--color-primary);
}

td {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
}

tbody tr:nth-child(even) {
  background-color: var(--color-bg-light);
}

tbody tr:hover {
  background-color: #f0f0f0;
}

/* Emphasis */
strong {
  font-weight: 700;
  color: var(--color-primary);
}

em {
  font-style: italic;
  color: var(--color-secondary);
}

/* Divider */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-md) 0;
}

/* ========== Utility Classes ========== */

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Spacing */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* Layout helpers */
.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.three-column {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-md);
}

/* Content overflow warning (개발 중 확인용) */
.slide-body.overflow-warning {
  outline: 3px solid red;
  outline-offset: -3px;
}

.slide-body.overflow-warning::after {
  content: '⚠️ Content Overflow!';
  position: absolute;
  top: 10px;
  right: 10px;
  background: red;
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 3px;
  z-index: 1000;
}

/* Compact mode for dense content */
.slide-compact .slide-body {
  gap: var(--space-sm);
  font-size: calc(var(--font-size-body) * 0.9);
}

.slide-compact h3 {
  font-size: calc(var(--font-size-h3) * 0.9);
  margin-bottom: var(--space-xs);
}

.slide-compact h4 {
  font-size: calc(var(--font-size-h4) * 0.9);
  margin-bottom: var(--space-xs);
}

.slide-compact li {
  line-height: 1.5;
  margin-bottom: 4px;
}

.slide-compact table {
  font-size: calc(var(--font-size-body) * 0.85);
}

.slide-compact th,
.slide-compact td {
  padding: var(--space-xs) var(--space-sm);
}

/* ========== Print Styles ========== */
@media print {
  body {
    background-color: white;
  }

  .slide-container {
    padding: 0;
    gap: 0;
  }

  .slide {
    box-shadow: none;
    page-break-after: always;
  }
}

/* ========== ERD Diagram Styles ========== */
.erd-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: var(--space-md);
  overflow: auto; /* 스크롤 허용 */
}

.erd-container .mermaid {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center;
}

.erd-container svg {
  max-width: 100%;
  max-height: 100%;
  width: auto !important;  /* 자동 너비 조정 */
  height: auto !important; /* 자동 높이 조정 */
  object-fit: contain; /* PDF export: 비율 유지하며 크기 맞춤 */
  
  /* ERD 가독성 향상: 여백 확보 */
  margin: 10px;
}

/* ERD 슬라이드 헤더 최적화 */
.slide-erd .slide-header {
  margin-bottom: var(--space-sm); /* 콘텐츠 영역 확보 */
  min-height: 70px;
}

/* ERD 레이아웃별 최적화 */
.erd-layout-lr .erd-container svg {
  /* 좌우 배치시 너비 최대화 */
  max-width: 100%;
}

.erd-layout-tb .erd-container svg {
  /* 상하 배치시 높이 최대화 */
  max-height: 100%;
}

.erd-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--color-text-light);
  font-size: var(--font-size-small);
}

.erd-error {
  color: #cc0000;
  background-color: #fff5f5;
  padding: var(--space-md);
  border-left: 3px solid #cc0000;
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ERD 전용 슬라이드 레이아웃 */
.slide-erd .slide-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.slide-erd .erd-container {
  flex: 1;
  min-height: 400px;
}

/* Mermaid 다이어그램 오버라이드 */
.mermaid .er.entityBox {
  fill: var(--color-bg) !important;
  stroke: var(--color-primary) !important;
  stroke-width: 1.5px !important;
}

.mermaid .er.relationshipLine {
  stroke: var(--color-primary) !important;
  stroke-width: 1.5px !important;
}

.mermaid .er.relationshipLabel {
  fill: var(--color-text) !important;
  font-size: 12px !important;
}

.mermaid .er.entityLabel {
  fill: var(--color-primary) !important;
  font-weight: 700 !important;
  font-size: 14px !important;
}

.mermaid .er.attributeBoxEven,
.mermaid .er.attributeBoxOdd {
  fill: var(--color-bg-light) !important;
  stroke: var(--color-border) !important;
}

/* ========== Deprecated Styles ========== */
.deprecated-box {
  position: relative;
  opacity: 0.4;
  filter: grayscale(100%);
}

.deprecated-box::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: #ff0000;
  transform: translateY(-50%);
  z-index: 10;
}

.deprecated-box::after {
  content: '❌';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 28px;
  z-index: 10;
}

/* ========== Quick Links Buttons ========== */
.slide-quick-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.quick-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 2px solid;
  cursor: pointer;
}

.quick-link-btn span:first-child {
  font-size: 16px;
  line-height: 1;
}

.quick-link-btn span:last-child {
  line-height: 1;
}

/* ERD Button */
.quick-link-erd {
  background: #e6ffe6;
  color: #00aa00;
  border-color: #00aa00;
}

.quick-link-erd:hover {
  background: #00aa00;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 170, 0, 0.3);
}

/* Admin Button */
.quick-link-admin {
  background: #fff5e6;
  color: #ff8c00;
  border-color: #ff8c00;
}

.quick-link-admin:hover {
  background: #ff8c00;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 140, 0, 0.3);
}

/* Store Button */
.quick-link-store {
  background: #f3e5f5;
  color: #9c27b0;
  border-color: #9c27b0;
}

.quick-link-store:hover {
  background: #9c27b0;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(156, 39, 176, 0.3);
}

/* Disabled Button */
.quick-link-disabled {
  background: #f0f0f0;
  color: #999;
  border-color: #ddd;
  cursor: not-allowed;
  opacity: 0.5;
}

/* Header Layout Adjustment - Only when Quick Links exist */
.slide-header:has(.slide-header-right) {
  display: flex !important;
  justify-content: space-between;
  align-items: flex-start;
}

.slide-title-area {
  flex: 1;
}

.slide-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
  margin-left: 20px;
}

/* ========== Responsive (for preview) ========== */
@media screen and (max-width: 1300px) {
  .slide {
    transform: scale(0.8);
    transform-origin: center;
  }
}

@media screen and (max-width: 1000px) {
  .slide {
    transform: scale(0.6);
    transform-origin: center;
  }
}
