/**
 * Seonjesi Design System V01
 * Brand Colors: Main #3F9AAE, Sub #79C9C5
 */

:root {
  /* Primary */
  --sj-primary: #3F9AAE;
  --sj-primary-dark: #2D7A8E;
  --sj-primary-light: #5BB4C5;
  --sj-primary-rgb: 63, 154, 174;

  /* Secondary */
  --sj-secondary: #79C9C5;
  --sj-secondary-dark: #5BABA7;
  --sj-secondary-light: #A3DDD9;
  --sj-secondary-rgb: 121, 201, 197;

  /* Gradients */
  --sj-gradient: linear-gradient(135deg, #3F9AAE 0%, #79C9C5 100%);
  --sj-gradient-dark: linear-gradient(135deg, #2D7A8E 0%, #3F9AAE 100%);

  /* Backgrounds */
  --sj-bg: #F0F8F7;
  --sj-bg-card: #FFFFFF;
  --sj-bg-hover: rgba(63, 154, 174, 0.06);

  /* Text */
  --sj-text: #1A1A2E;
  --sj-text-secondary: #6B7280;
  --sj-text-muted: #9CA3AF;
  --sj-text-on-primary: #FFFFFF;

  /* Borders */
  --sj-border: #E5E7EB;
  --sj-border-light: #F0F0F0;

  /* Status (unchanged) */
  --sj-success: #28a745;
  --sj-warning: #fd7e14;
  --sj-danger: #dc3545;
  --sj-info: #3F9AAE;

  /* Shadows */
  --sj-shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --sj-shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --sj-shadow-lg: 0 12px 40px rgba(0,0,0,0.15);

  /* Radii */
  --sj-radius: 12px;
  --sj-radius-lg: 16px;
  --sj-radius-sm: 8px;

  /* Touch targets */
  --sj-touch-min: 44px;
}

/* ===== Common Reset ===== */
*, *::before, *::after { box-sizing: border-box; }

/* ===== iOS overscroll bounce fix ===== */
html {
  overscroll-behavior-y: none;
}

/* ===== Typography ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  color: var(--sj-text);
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* ===== Utility Classes ===== */
.sj-card {
  background: var(--sj-bg-card);
  border-radius: var(--sj-radius-lg);
  box-shadow: var(--sj-shadow-sm);
  border: 1px solid var(--sj-border);
}

.sj-btn-primary {
  background: var(--sj-primary);
  color: var(--sj-text-on-primary);
  border: none;
  border-radius: var(--sj-radius-sm);
  padding: 12px 24px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  min-height: var(--sj-touch-min);
}
.sj-btn-primary:hover { background: var(--sj-primary-dark); }
.sj-btn-primary:active { transform: scale(0.98); }
.sj-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.sj-btn-secondary {
  background: var(--sj-secondary);
  color: var(--sj-text-on-primary);
  border: none;
  border-radius: var(--sj-radius-sm);
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  min-height: var(--sj-touch-min);
}
.sj-btn-secondary:hover { background: var(--sj-secondary-dark); }

.sj-btn-outline {
  background: transparent;
  color: var(--sj-primary);
  border: 2px solid var(--sj-primary);
  border-radius: var(--sj-radius-sm);
  padding: 10px 22px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: var(--sj-touch-min);
}
.sj-btn-outline:hover {
  background: var(--sj-primary);
  color: var(--sj-text-on-primary);
}

/* ===== Stat Cards ===== */
.sj-stat-card {
  background: var(--sj-bg-card);
  border-radius: var(--sj-radius);
  padding: 16px 20px;
  box-shadow: var(--sj-shadow-sm);
  border-left: 4px solid var(--sj-primary);
}
.sj-stat-card .stat-label {
  font-size: 13px;
  color: var(--sj-text-secondary);
  margin-bottom: 4px;
}
.sj-stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--sj-text);
}

/* ===== Quick Actions (2x2 grid on mobile) ===== */
.sj-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.sj-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--sj-radius);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--sj-text-on-primary);
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
  min-height: var(--sj-touch-min);
}
.sj-quick-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--sj-shadow-md);
}
.sj-quick-action i { font-size: 20px; }

@media (max-width: 480px) {
  .sj-quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Empty States ===== */
.sj-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--sj-text-secondary);
}
.sj-empty-state i {
  font-size: 3rem;
  color: var(--sj-secondary-light);
  margin-bottom: 12px;
  display: block;
}
.sj-empty-state h3 {
  font-size: 1.1rem;
  color: var(--sj-text-secondary);
  margin-bottom: 8px;
}
.sj-empty-state p {
  font-size: 0.9rem;
  color: var(--sj-text-muted);
  margin-bottom: 16px;
}

/* ===== Match Score Badge Colors ===== */
.score-excellent { color: var(--sj-success); }  /* 90+ */
.score-good { color: var(--sj-primary); }        /* 70-89 */
.score-fair { color: var(--sj-secondary); }      /* 50-69 */
.score-low { color: var(--sj-text-muted); }      /* <50 */

/* ===== Form Inputs ===== */
.sj-input,
.sj-select,
.form-control {
  border-radius: var(--sj-radius-sm);
  border: 1.5px solid var(--sj-border);
  padding: 12px 14px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: var(--sj-touch-min);
}
/* 셀렉트박스 글자 잘림 방지 */
select.sj-select,
select.form-control {
  height: auto;
  min-height: var(--sj-touch-min);
  line-height: 1.4;
  padding-top: 10px;
  padding-bottom: 10px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
}

.sj-input:focus,
.sj-select:focus,
.form-control:focus {
  border-color: var(--sj-primary);
  box-shadow: 0 0 0 3px rgba(var(--sj-primary-rgb), 0.15);
  outline: none;
}

/* ===== Top Navigation ===== */
.sj-top-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: 56px; background: var(--sj-gradient);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.sj-top-nav .nav-title { color: #fff; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sj-top-nav .nav-back { color: #fff; text-decoration: none; font-size: 1.2rem; margin-right: 12px; }
.sj-top-nav .nav-actions { display: flex; gap: 8px; }
.sj-top-nav .nav-actions a {
  color: #fff; text-decoration: none; width: 36px; height: 36px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.15); transition: background 0.2s; position: relative;
}
.sj-top-nav .nav-actions a:hover { background: rgba(255,255,255,0.3); }

/* ===== Section Card ===== */
.sj-section {
  background: #fff;
  border-radius: var(--sj-radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--sj-shadow-sm);
}
.sj-section h5 {
  color: var(--sj-text);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--sj-primary);
}

/* ===== Responsive helpers ===== */
@media (max-width: 768px) {
  .sj-hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .sj-hide-desktop { display: none !important; }
}

/* ===== Bottom Tab Bar (Mobile) ===== */
.sj-bottom-tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  height: 60px; background: #fff;
  display: flex; align-items: stretch; justify-content: space-around;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  border-top: 1px solid var(--sj-border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.sj-bottom-tabs a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-decoration: none; color: var(--sj-text-muted);
  font-size: 10px; font-weight: 500; gap: 2px;
  transition: color 0.2s; position: relative;
}
.sj-bottom-tabs a i { font-size: 20px; }
.sj-bottom-tabs a.active { color: var(--sj-primary); font-weight: 700; }
.sj-bottom-tabs a.active::after {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 32px; height: 3px; background: var(--sj-primary); border-radius: 0 0 3px 3px;
}
.sj-bottom-tabs .tab-badge {
  position: absolute; top: 4px; right: calc(50% - 18px);
  background: var(--sj-danger); color: #fff; font-size: 9px;
  min-width: 14px; height: 14px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; padding: 0 3px;
}
@media (min-width: 769px) {
  .sj-bottom-tabs { display: none; }
}
.has-bottom-tabs { padding-bottom: 68px; }
@media (min-width: 769px) {
  .has-bottom-tabs { padding-bottom: 0; }
}
