/* ... (기존 변수 및 기본 스타일 유지) ... */
:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #10b981;
  --bg-color: #f8fafc;
  --sidebar-bg: #ffffff;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  background-color: #ffffff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-color);
  letter-spacing: -0.5px;
}

.search-container input {
  padding: 0.7rem 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 30px;
  width: 350px;
  outline: none;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.search-container input:focus {
  border-color: var(--primary-color);
  width: 400px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.main-layout {
  display: flex;
  flex: 1;
}

.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  padding: 2rem 1.2rem;
}

.category-list {
  list-style: none;
}

.category-item {
  padding: 0.9rem 1.2rem;
  margin-bottom: 0.4rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
}

.category-item:hover {
  background-color: #f1f5f9;
  color: var(--text-color);
}

.category-item.active {
  background-color: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.content-area {
  flex: 1;
  padding: 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-section {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-section h2 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.8rem;
  color: #0f172a;
}

.hero-section p {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.8rem;
}

.calc-card {
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.calc-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.calc-card .icon-box {
  width: 48px;
  height: 48px;
  background-color: #eff6ff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  margin-bottom: 1.2rem;
}

.calc-card h3 {
  margin-bottom: 0.6rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
}

.calc-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.active-calculator-view {
  max-width: 850px;
  margin: 0 auto;
  background-color: #ffffff;
  padding: 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.back-btn {
  background: #f1f5f9;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2rem;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.back-btn:hover {
  background: #e2e8f0;
}

.footer {
  text-align: center;
  padding: 4rem 2rem;
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  margin-top: 4rem;
}

.footer-links {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary-color);
}

.footer p {
  color: #94a3b8;
  font-size: 0.85rem;
}

/* Calculator specific styles */
.calc-header {
  margin-bottom: 2.5rem;
}

.calc-header h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.calc-guide {
  background-color: #f8fafc;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2.5rem;
  font-size: 0.9rem;
  color: #475569;
  border-left: 4px solid var(--primary-color);
}

.input-group {
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: #334155;
}

.input-group input, .input-group select {
  width: 100%;
  padding: 0.9rem 1.1rem;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: var(--primary-color);
  outline: none;
}

.btn-calculate {
  width: 100%;
  padding: 1.1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1rem;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-calculate:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.result-area {
  margin-top: 3rem;
  padding: 2rem;
  background-color: #f0f9ff;
  border-radius: 16px;
  border: 1px solid #bae6fd;
}

.result-area h4 {
  margin-bottom: 1.2rem;
  color: #0369a1;
  font-size: 1.1rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e0f2fe;
}

.result-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.result-label {
  color: #64748b;
  font-weight: 500;
}

.result-value {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary-color);
}

/* Standard Calculator UI */
.standard-calc-ui {
  background: #f1f5f9;
  padding: 1.5rem;
  border-radius: 20px;
}

#calc-display {
  width: 100%;
  padding: 1.5rem;
  font-size: 2rem;
  text-align: right;
  border: none;
  background: white;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  font-family: 'Courier New', Courier, monospace;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

.calc-buttons button {
  padding: 1.2rem;
  font-size: 1.2rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.calc-buttons button:hover {
  background: #f8fafc;
  transform: translateY(-2px);
}

.calc-buttons .btn-op {
  background: #eff6ff;
  color: var(--primary-color);
}

.calc-buttons .btn-equal {
  background: var(--primary-color);
  color: white;
  grid-row: span 2;
}

@media (max-width: 900px) {
  .sidebar {
    width: 200px;
  }
  .search-container input {
    width: 180px;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    gap: 0;
  }

  .logo-container {
    width: auto;
    order: 1;
  }

  .search-container {
    width: 100%;
    order: 2;
    margin-top: 0.8rem;
  }

  .search-container input {
    width: 100% !important;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  .main-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 0.8rem;
    position: sticky;
    top: 108px; /* Header height (48 logo + 48 search + padding) */
    background: #fff;
    z-index: 90;
    overflow-x: auto;
    box-shadow: 0 4px 6px -4px rgba(0,0,0,0.1);
  }

  .category-list {
    display: flex;
    overflow-x: auto;
    gap: 0.4rem;
    padding-bottom: 0.2rem;
    scrollbar-width: none;
  }

  .category-list::-webkit-scrollbar {
    display: none;
  }

  .category-item {
    white-space: nowrap;
    margin-bottom: 0;
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    flex-shrink: 0;
    background: #f8fafc;
  }

  .content-area {
    padding: 1rem;
    padding-top: 1.5rem;
  }

  .hero-section {
    margin-bottom: 1.5rem;
  }

  .hero-section h2 {
    font-size: 1.3rem;
  }

  .hero-section p {
    font-size: 0.85rem;
  }

  .calculator-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .active-calculator-view {
    padding: 1.2rem;
    border-radius: 0;
    margin-top: 0;
  }

  .calc-header h2 {
    font-size: 1.4rem;
  }

  .footer {
    padding: 2rem 1rem;
    margin-top: 2rem;
  }
}
