/* shadcn/ui inspired design system */
:root {
  /* Colors - shadcn/ui style */
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;

  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;

  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;

  --primary: 221.2 83.2% 53.3%;
  --primary-foreground: 210 40% 98%;

  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;

  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;

  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;

  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;

  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 221.2 83.2% 53.3%;

  --radius: 0.5rem;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #1A1A1E;
  color: hsl(var(--foreground));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: 20px;
}

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

/* Header */
header {
  position: relative;
  margin-bottom: 2rem;
  padding: 1.5rem 0;
  background: transparent;
  border: none;
}

header h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.025em;
}

.user-info {
  position: absolute;
  top: 1.5rem;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Card Component */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: hsl(var(--foreground));
  letter-spacing: -0.025em;
}

.card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: hsl(var(--foreground));
}

/* Button Component - shadcn/ui style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  height: 2.5rem;
  margin-right: 0.5rem;
  margin-top: 0.5rem;
}

.btn:focus-visible {
  outline: none;
  ring: 2px;
  ring-color: hsl(var(--ring));
  ring-offset: 2px;
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
  font-weight: bold;
}

.btn-primary:hover {
  background: hsl(var(--primary) / 0.9);
}

.btn-secondary {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.btn-secondary:hover {
  background: hsl(var(--muted) / 0.8);
  border-color: hsl(var(--border));
}

.btn-success {
  background: hsl(142.1 76.2% 36.3%);
  color: hsl(var(--primary-foreground));
}

.btn-success:hover {
  background: hsl(142.1 76.2% 36.3% / 0.9);
}

.btn-danger {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.btn-danger:hover {
  background: hsl(var(--destructive) / 0.9);
}

.btn-sm {
  height: 2rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-back {
  font-weight: bold;
}

/* Form Components */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground));
}

.form-group input,
.form-group select {
  width: 100%;
  height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  transition: all 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: hsl(var(--ring));
  ring: 1px;
  ring-color: hsl(var(--ring));
}

.form-group input::placeholder {
  color: hsl(var(--muted-foreground));
}

.form-group small {
  display: block;
  margin-top: 0.375rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
}

/* Accordion Component - shadcn/ui style */
.accordion {
  border: 1px solid hsl(var(--border));
}

.accordion-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: all 0.15s;
  padding: 1rem 1.5rem;
  border-radius: calc(var(--radius) - 1px);
}

.accordion-header:hover {
  background: hsl(var(--accent));
}

.accordion-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.accordion-icon {
  font-size: 1rem;
  color: hsl(var(--muted-foreground));
  transition: transform 0.2s ease;
  font-weight: normal;
}

.accordion-icon.active {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  padding: 0 1.5rem;
}

.accordion-content.active {
  max-height: 2000px;
  padding: 0 1.5rem 1.5rem;
  transition: max-height 0.5s ease-in, padding 0.3s ease-in;
}

/* Searchable Select */
.searchable-select {
  position: relative;
  width: 100%;
}

.channel-select-input {
  width: 100%;
  height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.channel-select-input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 1px hsl(var(--ring));
}

.channel-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  margin-top: 0.25rem;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.channel-option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: hsl(var(--popover-foreground));
  transition: background-color 0.15s;
}

.channel-option:hover {
  background: hsl(var(--accent));
}

.channel-option-empty {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

/* Guild/Server Items */
.guild-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.guild-item:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--ring));
  transform: translateX(4px);
}

.guild-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
}

.guild-name {
  font-size: 1rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

/* Group Items */
.group-item {
  background: hsl(var(--muted));
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid hsl(var(--border));
}

.group-item h3 {
  color: hsl(var(--primary));
  margin-bottom: 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.channel-list {
  margin: 0.75rem 0;
}

.channel-item {
  padding: 0.75rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  margin: 0.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.channel-input {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.channel-input select {
  flex: 1;
}

.channel-input .searchable-select {
  flex: 2;
}

.channel-select {
  flex: 2;
}

.channel-lang {
  flex: 1;
}

/* Badge Component */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s;
}

.badge-ja {
  background: hsl(45 93% 47%);
  color: hsl(0 0% 0%);
}

.badge-en {
  background: hsl(221.2 83.2% 53.3%);
  color: hsl(210 40% 98%);
}

.badge-zh-CN {
  background: hsl(0 84.2% 60.2%);
  color: hsl(210 40% 98%);
}

.badge-ko {
  background: hsl(142.1 76.2% 36.3%);
  color: hsl(210 40% 98%);
}

.badge-fr {
  background: hsl(262.1 83.3% 57.8%);
  color: hsl(210 40% 98%);
}

.badge-de {
  background: hsl(24.6 95% 53.1%);
  color: hsl(210 40% 98%);
}

.badge-es {
  background: hsl(173.4 80.4% 40%);
  color: hsl(210 40% 98%);
}

.badge-pt {
  background: hsl(142.1 70.6% 45.3%);
  color: hsl(210 40% 98%);
}

/* Category Label */
.category-label {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 500;
}

/* Status/Toast Component */
.status {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  display: none;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
  border: 1px solid hsl(var(--border));
  max-width: 400px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.status.success {
  background: hsl(142.1 76.2% 36.3%);
  color: hsl(210 40% 98%);
  border-color: hsl(142.1 76.2% 36.3%);
}

.status.error {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  border-color: hsl(var(--destructive));
}

.status.info {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

/* Loading State */
.loading {
  text-align: center;
  padding: 2rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

/* Help Text */
.help-text {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  .container {
    max-width: 100%;
  }

  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  header h1 {
    margin: 0;
  }

  .user-info {
    position: static;
    margin: 0;
    gap: 0.5rem;
  }

  .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  .card {
    padding: 1rem;
  }

  .btn:not(.btn-sm) {
    width: 100%;
    margin-right: 0;
  }

  .channel-input {
    flex-direction: column;
  }

  .status {
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}

/* Utility Classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Usage Stats */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-label {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: hsl(var(--primary));
}

@media (max-width: 768px) {
  .stats-summary {
    grid-template-columns: 1fr 1fr;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

/* グロッサリーテーブル */
.glossary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.glossary-table th,
.glossary-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.glossary-table th {
  background: hsl(var(--muted));
  font-weight: 600;
  color: hsl(var(--foreground));
  white-space: nowrap;
}

.glossary-table td {
  color: hsl(var(--foreground));
}

.glossary-table tr:hover {
  background: hsl(var(--accent));
}

.glossary-table .btn {
  margin-top: 0;
  margin-right: 0.25rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.sync-status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.badge-success {
  background: hsl(142 76% 36% / 0.15);
  color: hsl(142 76% 36%);
}

.badge-error {
  background: hsl(0 84% 60% / 0.15);
  color: hsl(0 84% 60%);
}

.badge-warning {
  background: hsl(38 92% 50% / 0.15);
  color: hsl(38 92% 50%);
}

.badge-default {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

@media (max-width: 768px) {
  .glossary-table th:nth-child(5),
  .glossary-table td:nth-child(5) {
    display: none;
  }
}
