@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
  --primary: #003087;
  --accent: #e8001c;
  --bg-body: #e2e8f0;
  --bg-page: #ffffff;
  --border: #333333;
  --border-light: #aaaaaa;
  --border-mid: #666666;
  --bg-section: #dce6f1;
  --bg-subsection: #eef2f8;
  --bg-gray: #f4f4f4;
  --text: #111111;
  
  --transition: all 0.2s ease;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* ─────────────────────────────────────────────────────────────
   GLOBAL & LAYOUT STYLES
   ───────────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans KR', 'Inter', 'Malgun Gothic', sans-serif;
  background-color: var(--bg-body);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Sticky top bar for shop staff */
.top-bar {
  background: var(--primary);
  color: #ffffff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.top-bar-brand span {
  font-size: 0.75rem;
  background: rgba(255,255,255,0.15);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.btn-print {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: var(--transition);
}

.btn-print:hover {
  background: #cc0016;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.btn-print:active {
  transform: translateY(0);
}

.document-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}

/* ─────────────────────────────────────────────────────────────
   A4 SHEET SIMULATION
   ───────────────────────────────────────────────────────────── */
.page {
  width: 210mm;
  height: 297mm;
  background: var(--bg-page);
  padding: 8mm 8mm 6mm;
  margin-bottom: 25px;
  box-shadow: var(--shadow);
  border: 1px solid #cbd5e1;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* ─────────────────────────────────────────────────────────────
   TABLE & FORM CONTROLS
   ───────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
}

td, th {
  border: 1px solid var(--border-light);
  padding: 3.5px 5px;
  vertical-align: middle;
}

.td-label {
  background: var(--bg-section);
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
  width: 80px;
}

.td-auto {
  background: #f5f8ff;
  color: var(--primary);
  font-weight: 700;
  text-align: center;
  font-size: 8.5pt;
}

/* Modernized native inputs inside table cells */
input[type="text"], select {
  border: none;
  border-bottom: 1.5px solid var(--border-mid);
  background: transparent;
  font-family: inherit;
  font-size: 8.5pt;
  width: 100%;
  padding: 1px 3px;
  outline: none;
  color: var(--text);
  transition: var(--transition);
}

input[type="text"]:focus, select:focus {
  border-bottom-color: var(--primary);
  background: #eff6ff;
}

select {
  cursor: pointer;
}

input[type="checkbox"], input[type="radio"] {
  width: 12px;
  height: 12px;
  cursor: pointer;
  accent-color: var(--primary);
  vertical-align: middle;
}

.lbl {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 10px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 8.5pt;
}

/* Conditional visibility helper */
.cond-off {
  opacity: 0.35;
  pointer-events: none;
}

.inline-side {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  white-space: nowrap;
  vertical-align: middle;
}

.inline-mark {
  margin: 0 3px;
  font-size: 8pt;
}

/* ─────────────────────────────────────────────────────────────
   A4 BRAND HEADER
   ───────────────────────────────────────────────────────────── */
.doc-header {
  display: flex;
  align-items: stretch;
  border: 2px solid var(--border);
  margin-bottom: 5px;
}

.logo-cell {
  background: #ffffff;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
}

.logo-svg-wrap {
  width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-svg-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.title-cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18pt;
  font-weight: 700;
  letter-spacing: 4px;
  border-left: 2px solid var(--border);
}

/* ─────────────────────────────────────────────────────────────
   A4 SHEET SECTION BLOCKS
   ───────────────────────────────────────────────────────────── */
.sec-wrap {
  border: 1.5px solid var(--border);
  margin-bottom: 3px;
}

.sec-head {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 8pt;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sec-num {
  background: rgba(255,255,255,0.22);
  border-radius: 2px;
  padding: 0 6px;
  font-size: 8pt;
  font-weight: 700;
}

.sec-body {
  padding: 3px 4px;
}

/* ─────────────────────────────────────────────────────────────
   NOTICE BOX, AGREEMENT BLOCK
   ───────────────────────────────────────────────────────────── */
.notice-box {
  background: #fffde7;
  border: 1px solid #e8d800;
  border-left: 3px solid #c0a000;
  padding: 3px 6px;
  font-size: 6.6pt;
  color: #444444;
  line-height: 1.45;
  margin: 2px 0;
}

.nr {
  display: flex;
  gap: 4px;
}

.nr-sym {
  color: #997700;
  font-weight: 700;
  min-width: 9px;
}

.agree-block {
  border: 1px solid #ffb3b3;
  background: #fff8f8;
  padding: 4px 6px;
  font-size: 7.5pt;
  line-height: 1.5;
  margin-bottom: 3px;
}

.agree-row {
  display: flex;
  gap: 5px;
  align-items: flex-start;
  margin-bottom: 2px;
}

.agree-row:last-child {
  margin-bottom: 0;
}

.badge {
  display: inline-block;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 6.5pt;
  padding: 0 4px;
  border-radius: 2px;
  margin-left: 3px;
  vertical-align: middle;
}

/* ─────────────────────────────────────────────────────────────
   SIGNATURE BOXES
   ───────────────────────────────────────────────────────────── */
.sign-area {
  border: 2px solid var(--primary);
  background: #f0f5ff;
  padding: 6px 8px;
}

.sign-text {
  font-size: 8pt;
  line-height: 1.65;
  margin-bottom: 5px;
}

.sign-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
}

.sign-date-row {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9pt;
}

.sign-date-row input[type="text"] {
  width: 34px;
  text-align: center;
  border-bottom: 1px solid var(--border-mid);
}

.sign-box-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sign-label {
  font-size: 8pt;
  margin-bottom: 3px;
  text-align: center;
  font-weight: 600;
}

.p-sign-box {
  border: 1px solid var(--border-light);
  width: 120px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7.5pt;
  color: #888888;
  background: #eaffd5;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.p-sign-box:hover {
  background: #d4f2b5;
  border-color: var(--primary);
}

.p-sign-box.signed {
  background: #ffffff;
}

.p-sign-box img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
}

.p-sign-box.signed span {
  display: none;
}

/* ─────────────────────────────────────────────────────────────
   CONSENT PAGES STYLING (PAGE 2, 3)
   ───────────────────────────────────────────────────────────── */
.consent-page-title {
  text-align: center;
  font-size: 10pt;
  font-weight: 700;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 3px;
  margin-bottom: 4px;
  color: var(--primary);
}

.consent-agree {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  font-size: 6.7pt;
}

.consent-agree .lbl {
  margin-right: 0;
  white-space: nowrap;
}

.consent-agree-box {
  background: #eaffd5;
  border: 1px solid #9ccc65;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 700;
}

.consent-agree-box input {
  margin-right: 3px;
}

.prv-table-tight {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 5.7pt;
}

.prv-table-tight th,
.prv-table-tight td {
  border: 1px solid var(--border-light);
  padding: 1px 2px;
  line-height: 1.18;
  word-break: break-all;
  vertical-align: top;
}

.prv-table-tight th {
  background: var(--bg-section);
  font-weight: 700;
  text-align: center;
}

.consent-final-sign {
  margin-top: 5px;
  border: 1px solid var(--primary);
  background: #f0f5ff;
  padding: 8px 10px;
}

/* ─────────────────────────────────────────────────────────────
   UTILITY STYLES
   ───────────────────────────────────────────────────────────── */
.fw7   { font-weight: 700; }
.red   { color: var(--accent); }
.blue  { color: var(--primary); }
.small { font-size: 7.5pt; }
.xs    { font-size: 7pt; }
.mt3   { margin-top: 3px; }
.doc-footer {
  margin-top: 4px;
  font-size: 6.5pt;
  color: #555555;
  border-top: 1px solid var(--border-light);
  padding-top: 3px;
  text-align: center;
}

/* Error indicator classes */
.field-error, .select-error {
  border-bottom: 2px solid var(--accent) !important;
  background-color: #fff0f0 !important;
}

.check-error {
  outline: 2.5px solid var(--accent);
  border-radius: var(--radius-sm);
}

/* ─────────────────────────────────────────────────────────────
   MODALS (SIGNATURE & VALIDATION)
   ───────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  padding: 28px 32px 24px;
  width: 90%;
  max-width: 480px;
  border: 1px solid var(--border-light);
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-desc {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 16px;
}

.canvas-container {
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #f8fafc;
  height: 220px;
  width: 100%;
  position: relative;
  touch-action: none;
  overflow: hidden;
  margin-bottom: 18px;
}

.sig-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.canvas-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #94a3b8;
  font-size: 0.85rem;
  pointer-events: none;
  text-align: center;
}

.canvas-hint span {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 4px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  text-align: center;
}

.modal-btn-cancel {
  background: #e2e8f0;
  color: #475569;
}

.modal-btn-cancel:hover {
  background: #cbd5e1;
}

.modal-btn-apply {
  background: var(--primary);
  color: #ffffff;
}

.modal-btn-apply:hover {
  background: #002566;
}

/* Validation modal specifically */
.error-list-box {
  list-style: none;
  margin-bottom: 18px;
  max-height: 200px;
  overflow-y: auto;
}

.error-list-box li {
  font-size: 0.9rem;
  padding: 5px 0 5px 18px;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
  color: #334155;
}

.error-list-box li::before {
  content: '!';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Original validation modal styles */
#validModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#validModal.show {
  display: flex;
}
.modal-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  text-align: left;
}
.modal-list li {
  font-size: 9.5pt;
  padding: 5px 0 5px 18px;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
  color: #222;
}
.modal-list li::before {
  content: '!';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

#validModal .modal-btn {
  width: 100%;
  padding: 12px 24px;
  background: var(--primary);
  color: #ffffff;
  margin-top: 8px;
}

#validModal .modal-btn:hover {
  background: #002566;
}

/* ─────────────────────────────────────────────────────────────
   NETWORK FUNNEL LANDING & CONSTRUCTION SCREEN STYLES
   ───────────────────────────────────────────────────────────── */
.hidden-screen {
  display: none !important;
}

/* Landing Screen */
.landing-screen {
  background: radial-gradient(circle at top right, #1e293b, #0f172a);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  box-sizing: border-box;
}

.landing-container {
  width: 100%;
  max-width: 680px;
  margin: auto;
}

.landing-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 48px 40px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.landing-logo {
  width: 90px;
  height: 90px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 50%;
  padding: 16px;
}

.landing-logo svg {
  width: 100%;
  height: 100%;
}

.landing-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.landing-subtitle {
  font-size: 0.95rem;
  color: #475569;
  margin-bottom: 40px;
}

/* Grid & Cards */
.network-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 16px;
}

.network-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 32px 20px 24px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  font-family: inherit;
}

/* Hover effects for LG */
.network-card.network-lg:hover {
  border-color: #e6007e;
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px rgba(230, 0, 126, 0.3);
}

/* Hover effects for KT */
.network-card.network-kt:hover {
  border-color: #d71920;
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px rgba(215, 25, 32, 0.25);
}

.network-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.network-badge.lguplus {
  background: #fdf2f8;
  color: #db2777;
  border: 1px solid #fbcfe8;
}

.network-badge.kt {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.network-logo-wrapper {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
}

.network-logo-wrapper.lg-color-logo {
  background: linear-gradient(135deg, #ff007f 0%, #a3005b 100%);
  box-shadow: 0 6px 16px rgba(230, 0, 126, 0.2);
}

.network-logo-wrapper.kt-color-logo {
  background: linear-gradient(135deg, #333333 0%, #111111 100%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  border: 2px solid #d71920;
}

.network-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 28px;
}

.network-desc {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 24px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.network-btn-label {
  width: 100%;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  background: #f1f5f9;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.network-card.network-lg:hover .network-btn-label {
  background: #e6007e;
  color: #ffffff;
}

.network-card.network-kt:hover .network-btn-label {
  background: #d71920;
  color: #ffffff;
}

.network-btn-label.coming-soon {
  color: #64748b;
  background: #f1f5f9;
}

.landing-footer {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 36px;
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
}

/* KT Under Construction Screen */
.construction-screen {
  background: radial-gradient(circle at top right, #1e293b, #0f172a);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  box-sizing: border-box;
}

.construction-container {
  width: 100%;
  max-width: 500px;
}

.construction-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 48px 36px;
  text-align: center;
}

.construction-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff1f2;
  color: #e11d48;
  border-radius: 50%;
}

.construction-icon svg {
  width: 42px;
  height: 42px;
  animation: wrench-wiggle 2.5s ease-in-out infinite;
}

.construction-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
}

.construction-desc {
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 32px;
}

.btn-back {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 10px 24px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-back:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-1px);
}

/* Top bar back button style */
.btn-top-back {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 16px;
  font-family: inherit;
}

.btn-top-back:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
}

@keyframes wrench-wiggle {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(-12deg); }
  20% { transform: rotate(12deg); }
  30% { transform: rotate(-8deg); }
  40% { transform: rotate(8deg); }
  50% { transform: rotate(0deg); }
}

/* Responsive grid for landing */
@media (max-width: 600px) {
  .landing-card {
    padding: 32px 20px;
  }
  .network-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .network-card {
    padding: 24px 16px;
  }
}

/* ─────────────────────────────────────────────────────────────
   PRINT MEDIA QUERY
   ───────────────────────────────────────────────────────────── */
@media print {
  body {
    background-color: #ffffff !important;
    padding: 0;
    margin: 0;
    min-height: auto;
  }
  
  .top-bar, .no-print, .modal-overlay {
    display: none !important;
  }
  
  .document-container {
    padding: 0 !important;
    overflow: visible !important;
  }

  .page {
    width: 210mm;
    height: 297mm;
    margin: 0 !important;
    padding: 8mm 8mm 6mm !important;
    border: none !important;
    box-shadow: none !important;
    page-break-after: always;
  }
  
  .page:last-child {
    page-break-after: avoid;
  }
  
  input[type="text"], select {
    border-bottom: 1px solid #333333 !important;
  }
  
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  @page {
    size: A4;
    margin: 0;
  }
}
