/*──────────────────────────────────────────────
  Design Tokens - Based on 3EA Design Kit
──────────────────────────────────────────────*/
:root {
  /* Brand Colors */
  --brand: #6366f1;
  --brand-hov: #4f46e5;
  --brand-light: #eef2ff;
  --brand-dark: #3730a3;

  /* Gray Scale */
  --g900: #18181b;
  --g700: #374151;
  --g500: #6b7280;
  --g300: #d4d4d8;
  --g200: #e5e7eb;
  --g100: #f3f4f6;
  --g50: white;

  /* Semantic Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Typography */
  --fs-h1: 2rem;
  --fs-h2: 1.5rem;
  --fs-h3: 1.25rem;
  --fs-p: 1rem;
  --fs-meta: 0.875rem;

  /* Spacing */
  --sp1: 4px;
  --sp2: 8px;
  --sp3: 12px;
  --sp4: 16px;
  --sp5: 20px;
  --sp6: 24px;
  --sp8: 48px;

  /* Effects */
  --radius-card: 16px;
  --shadow: 0 4px 32px rgba(0, 0, 0, 0.06), 0 2px 12px rgba(99, 102, 241, 0.10);
  --glass-bg: rgba(255, 255, 255, 0.9);
  --blur: 20px;
}

/*──────────────────────────────────────────────
  Reset & Base Styles
──────────────────────────────────────────────*/
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font: 500 var(--fs-p)/1.6 Pretendard, system-ui, sans-serif;
  color: var(--g700);
  background-attachment: fixed;
  min-height: 100vh;
  padding: 0;
}

/*──────────────────────────────────────────────
  Header
──────────────────────────────────────────────*/
header {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--g200);
  padding: var(--sp6) var(--sp4);
  text-align: center;
  box-shadow: var(--shadow);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-size: var(--fs-h1);
  font-weight: 700;
  color: var(--brand);
  margin-bottom: var(--sp2);
}

.subtitle {
  color: var(--g500);
  font-size: var(--fs-p);
}

/*──────────────────────────────────────────────
  Tab Navigation
──────────────────────────────────────────────*/
.tab-navigation {
  background: white;
  border-bottom: 2px solid var(--g200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tab-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: var(--sp2);
  padding: var(--sp3) var(--sp4) 0 var(--sp4);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  padding: var(--sp3) var(--sp5);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--g500);
  font-size: var(--fs-p);
  font-weight: 600;
  position: relative;
  top: 2px;
}

.tab-btn:hover {
  color: var(--brand);
  background: var(--g100);
  border-radius: 8px 8px 0 0;
}

.tab-btn.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  background: var(--g50);
}

.tab-icon {
  font-size: 1.25rem;
}

.tab-label {
  white-space: nowrap;
}

/*──────────────────────────────────────────────
  Tab Content
──────────────────────────────────────────────*/
.tab-content-wrapper {
  min-height: calc(100vh - 200px);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeInTab {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*──────────────────────────────────────────────
  Blog Links Tab Styles
──────────────────────────────────────────────*/
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp6) var(--sp4);
}

/* Main Blog Button - Hero Style */
.main-blog-button {
  display: flex;
  align-items: center;
  gap: var(--sp4);
  padding: var(--sp6);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hov) 100%);
  border: none;
  border-radius: 16px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.3);
  margin-bottom: var(--sp4);
  position: relative;
  overflow: hidden;
}

.main-blog-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.main-blog-button:hover::before {
  left: 100%;
}

.main-blog-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(99, 102, 241, 0.4);
}

.main-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp1);
}

.main-title {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.main-subtitle {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.main-arrow {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  transition: transform 0.3s ease;
}

.main-blog-button:hover .main-arrow {
  transform: translateX(8px);
}

/* Blog Management Button */
.management-button {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  padding: var(--sp4) var(--sp5);
  background: white;
  border: 2px solid var(--g300);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: var(--sp5);
}

.management-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--brand);
  background: var(--brand-light);
}

.management-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.management-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.management-title {
  font-size: var(--fs-p);
  font-weight: 600;
  color: var(--g900);
  line-height: 1.2;
}

.management-subtitle {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--g500);
}

.management-arrow {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--g500);
  transition: all 0.3s ease;
}

.management-button:hover .management-arrow {
  transform: translateX(4px);
  color: var(--brand);
}

/* Section Divider */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  margin: var(--sp5) 0 var(--sp4) 0;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--g200);
}

.divider-text {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--g500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.blog-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--sp3);
}

.blog-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp2);
  padding: var(--sp4);
  background: white;
  border: 1.5px solid var(--g200);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  min-height: 100px;
}

.blog-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--brand);
  background: var(--g50);
}

.blog-link:active {
  transform: translateY(0);
}

.link-icon {
  font-size: 1.75rem;
  transition: transform 0.25s ease;
}

.blog-link:hover .link-icon {
  transform: scale(1.15);
}

.link-text {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--g700);
  text-align: center;
  line-height: 1.3;
}

.blog-link:hover .link-text {
  color: var(--brand);
}

/*──────────────────────────────────────────────
  Main Content
──────────────────────────────────────────────*/
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp6) var(--sp4);
}

section {
  margin-bottom: var(--sp6);
}

/*──────────────────────────────────────────────
  Blog Tools Tab Styles
──────────────────────────────────────────────*/
.tool-section {
  margin-bottom: var(--sp6);
}

.tool-card {
  background: var(--glass-bg);
}

.tool-input {
  width: 100%;
  padding: var(--sp4);
  background: var(--g100);
  border: 2px solid transparent;
  border-radius: 12px;
  font: 500 var(--fs-p)/1.6 Pretendard, system-ui, sans-serif;
  color: var(--g900);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: var(--sp4);
}

.tool-input:focus {
  outline: none;
  background: white;
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tool-results {
  margin-top: var(--sp4);
  padding: var(--sp4);
  background: var(--g100);
  border-radius: 12px;
  min-height: 120px;
  display: none;
}

.tool-results.show {
  display: block;
}

.result-item {
  padding: var(--sp3) var(--sp4);
  background: white;
  border-radius: 8px;
  margin-bottom: var(--sp2);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--g200);
}

.result-item:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
  transform: translateX(4px);
}

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

/* Counter Stats */
.counter-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp3);
  margin-top: var(--sp4);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp4);
  background: var(--g100);
  border-radius: 12px;
  text-align: center;
}

.stat-label {
  font-size: var(--fs-meta);
  color: var(--g500);
  margin-bottom: var(--sp2);
  font-weight: 600;
}

.stat-value {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--brand);
}

/* Hashtag Results */
.hashtag-results {
  margin-top: var(--sp4);
  padding: var(--sp4);
  background: var(--g100);
  border-radius: 12px;
  min-height: 80px;
  display: none;
  line-height: 2;
}

.hashtag-results.show {
  display: block;
}

.hashtag-item {
  display: inline-block;
  padding: var(--sp2) var(--sp3);
  background: var(--brand-light);
  color: var(--brand-dark);
  border-radius: 9999px;
  margin: var(--sp1);
  font-size: var(--fs-meta);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hashtag-item:hover {
  background: var(--brand);
  color: white;
  transform: scale(1.05);
}

.badge-info {
  background: color-mix(in srgb, var(--info) 20%, transparent);
  color: var(--info);
}

/*──────────────────────────────────────────────
  Card Component
──────────────────────────────────────────────*/
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: var(--sp6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(99, 102, 241, 0.15);
}

/*──────────────────────────────────────────────
  Mode Selector
──────────────────────────────────────────────*/
.mode-card {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 2px solid var(--brand-light);
}

.mode-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp4);
  margin-bottom: var(--sp3);
}

.mode-label {
  font-weight: 600;
  color: var(--g900);
  font-size: var(--fs-h3);
}

.mode-toggle {
  position: relative;
  width: 60px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: var(--g300);
  transition: background 0.3s;
}

.mode-toggle.active .toggle-track {
  background: var(--brand);
}

.toggle-thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.mode-toggle.active .toggle-thumb {
  transform: translateX(28px);
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: var(--fs-meta);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.mode-badge-text {
  background: var(--g200);
  color: var(--g700);
}

.mode-badge-html {
  background: var(--brand);
  color: white;
}

.mode-description {
  text-align: center;
  color: var(--g500);
  font-size: var(--fs-meta);
  margin: 0;
}

.mode-info {
  display: block;
  transition: opacity 0.3s;
}

.mode-info.hidden {
  display: none;
}

.mode-toggle.active + .mode-badge + .mode-description [data-mode="text"] {
  display: none;
}

.mode-toggle.active + .mode-badge + .mode-description [data-mode="html"] {
  display: block;
}

/*──────────────────────────────────────────────
  Section Headers
──────────────────────────────────────────────*/
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp4);
}

h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--g900);
  margin: 0;
}

h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--g900);
  margin-bottom: var(--sp3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp3);
}

/*──────────────────────────────────────────────
  Badge Component
──────────────────────────────────────────────*/
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: var(--fs-meta);
  font-weight: 600;
}

.badge-primary {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.badge-success {
  background: color-mix(in srgb, var(--success) 20%, transparent);
  color: var(--success);
}

/*──────────────────────────────────────────────
  Textarea
──────────────────────────────────────────────*/
.textarea {
  width: 100%;
  min-height: 300px;
  padding: var(--sp4);
  background: var(--g100);
  border: 2px solid transparent;
  border-radius: 12px;
  font: 500 var(--fs-p)/1.6 Pretendard, system-ui, sans-serif;
  color: var(--g900);
  resize: vertical;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.textarea:focus {
  outline: none;
  background: white;
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.textarea[readonly] {
  background: var(--g50);
  cursor: default;
}

/*──────────────────────────────────────────────
  Buttons
──────────────────────────────────────────────*/
.controls {
  display: flex;
  gap: var(--sp4);
  justify-content: center;
}

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp2);
  padding: var(--sp4) var(--sp6);
  font: 600 var(--fs-p)/1 Pretendard;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  touch-action: manipulation;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: var(--brand-hov);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--g200);
  color: var(--g700);
}

.btn-secondary:hover {
  background: var(--g300);
}

.btn-outline {
  background: white;
  color: var(--brand);
  border: 2px solid var(--brand-light);
}

.btn-outline:hover {
  background: var(--brand-light);
  border-color: var(--brand);
}

.btn-sm {
  padding: var(--sp2) var(--sp4);
  font-size: var(--fs-meta);
  min-height: 36px;
}

.btn-icon {
  font-size: 1.2em;
}

/*──────────────────────────────────────────────
  Info Card
──────────────────────────────────────────────*/
.info-card {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-left: 4px solid var(--brand);
}

.info-list {
  list-style: none;
  padding: 0;
}

.info-list li {
  display: flex;
  align-items: start;
  gap: var(--sp3);
  padding: var(--sp2) 0;
  color: var(--g700);
}

.list-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-weight: 700;
}

/*──────────────────────────────────────────────
  Keyboard Shortcuts
──────────────────────────────────────────────*/
.shortcuts-card {
  text-align: center;
}

.shortcuts-grid {
  display: flex;
  gap: var(--sp4);
  justify-content: center;
  flex-wrap: wrap;
}

.shortcut-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp2);
  padding: var(--sp4);
  background: var(--g100);
  border-radius: 12px;
  min-width: 180px;
}

.shortcut-item span {
  color: var(--g500);
  font-size: var(--fs-meta);
}

kbd {
  display: inline-block;
  padding: 4px 8px;
  background: white;
  border: 1px solid var(--g300);
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: monospace;
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--g900);
}

/*──────────────────────────────────────────────
  Footer
──────────────────────────────────────────────*/
footer {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  border-top: 1px solid var(--g200);
  padding: var(--sp6) var(--sp4);
  text-align: center;
  margin-top: var(--sp8);
}

footer p {
  color: var(--g500);
  font-size: var(--fs-meta);
  margin: 0;
}

/*──────────────────────────────────────────────
  Notification
──────────────────────────────────────────────*/
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: var(--sp4) var(--sp6);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-weight: 600;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-success {
  background: var(--success);
  color: white;
}

.notification-warning {
  background: var(--warning);
  color: white;
}

.notification-info {
  background: var(--info);
  color: white;
}

.notification-error {
  background: var(--error);
  color: white;
}

/*──────────────────────────────────────────────
  Responsive Design
──────────────────────────────────────────────*/
@media (max-width: 768px) {
  :root {
    --fs-h1: 1.5rem;
    --fs-h2: 1.25rem;
    --fs-h3: 1.1rem;
  }

  main {
    padding: var(--sp4) var(--sp3);
  }

  header {
    padding: var(--sp4) var(--sp3);
  }

  .card {
    padding: var(--sp4);
  }

  .controls {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp3);
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .textarea {
    min-height: 200px;
  }

  .mode-selector {
    flex-wrap: wrap;
  }

  .shortcuts-grid {
    flex-direction: column;
  }

  .shortcut-item {
    width: 100%;
  }

  .notification {
    right: var(--sp3);
    left: var(--sp3);
    transform: translateX(0) translateY(-100px);
  }

  .notification.show {
    transform: translateX(0) translateY(0);
  }

  .blog-links-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--sp2);
  }

  .blog-link {
    padding: var(--sp3);
    min-height: 90px;
  }

  .link-icon {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 1.5rem;
  }

  .mode-label {
    font-size: var(--fs-p);
  }

  .mode-toggle {
    width: 50px;
    height: 28px;
  }

  .toggle-thumb {
    width: 20px;
    height: 20px;
  }

  .mode-toggle.active .toggle-thumb {
    transform: translateX(22px);
  }

  .blog-links-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .link-text {
    font-size: 0.75rem;
  }
}

/*──────────────────────────────────────────────
  Animations
──────────────────────────────────────────────*/
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Print Styles */
@media print {
  header,
  footer,
  .controls-section,
  .mode-section,
  .shortcuts-section {
    display: none;
  }

  body {
    background: white;
  }

  .card {
    box-shadow: none;
    border: 1px solid var(--g300);
  }
}
