/* ============================================
   EkichikaUp – Modern Dashboard CSS
   ============================================ */

/* ── Dark Theme (default) ── */
:root,
[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #21253a;
  --bg-card-hover: #282d45;
  --bg-input: #161925;
  --border-color: #2a2f45;
  --border-hover: #3d4460;
  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa8;
  --text-muted: #5c6078;
  --accent-blue: #4f8eff;
  --accent-blue-hover: #3a7aff;
  --accent-green: #22c55e;
  --accent-green-dim: rgba(34, 197, 94, 0.15);
  --accent-red: #ef4444;
  --accent-red-dim: rgba(239, 68, 68, 0.15);
  --accent-yellow: #f59e0b;
  --accent-yellow-dim: rgba(245, 158, 11, 0.15);
  --accent-purple: #a855f7;
  --accent-purple-dim: rgba(168, 85, 247, 0.15);
  --sidebar-width: 240px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: all 0.2s ease;
  --card-footer-bg: rgba(0, 0, 0, 0.1);
}

/* ── Light Theme ── */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fb;
  --bg-input: #f5f6f8;
  --border-color: #e0e3ea;
  --border-hover: #c8cdd8;
  --text-primary: #1a1d27;
  --text-secondary: #5c6078;
  --text-muted: #8b8fa8;
  --accent-blue: #3b7cff;
  --accent-blue-hover: #2563eb;
  --accent-green: #16a34a;
  --accent-green-dim: rgba(22, 163, 74, 0.1);
  --accent-red: #dc2626;
  --accent-red-dim: rgba(220, 38, 38, 0.08);
  --accent-yellow: #d97706;
  --accent-yellow-dim: rgba(217, 119, 6, 0.08);
  --accent-purple: #7c3aed;
  --accent-purple-dim: rgba(124, 58, 237, 0.08);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.1);
  --card-footer-bg: rgba(0, 0, 0, 0.02);
}

/* ── Theme Toggle ── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border: none;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  width: 100%;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.theme-toggle-icon {
  font-size: 16px;
  line-height: 1;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'LINE Seed JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-blue-hover);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 24px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.nav-menu {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
  margin-bottom: 4px;
}

.nav-link:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(79, 142, 255, 0.15), rgba(168, 85, 247, 0.1));
  color: var(--accent-blue);
  font-weight: 600;
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.status-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  flex: 1;
  min-height: 100vh;
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-description {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ── Alerts ── */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

.alert-success {
  background: var(--accent-green-dim);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--accent-green);
}

.alert-error {
  background: var(--accent-red-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  box-shadow: 0 2px 8px rgba(79, 142, 255, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(79, 142, 255, 0.4);
  transform: translateY(-1px);
  color: white;
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-green), #16a34a);
  color: white;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.btn-accent:hover {
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
  transform: translateY(-1px);
  color: white;
}

.btn-danger {
  background: var(--accent-red);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--border-hover);
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
}

/* ── Shop Cards ── */
.shop-grid {
  display: grid;
  gap: 20px;
}

.shop-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}

.shop-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.shop-card.disabled {
  opacity: 0.55;
}

.shop-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.shop-name {
  font-size: 18px;
  font-weight: 600;
}

.shop-email {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* Toggle Button */
.toggle-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.5px;
}

.toggle-btn.on {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.toggle-btn.off {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.toggle-btn:hover {
  transform: scale(1.05);
}

.toggle-btn-sm {
  padding: 3px 10px;
  border: none;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-btn-sm.on {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.toggle-btn-sm.off {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Schedule Section */
.shop-schedules {
  padding: 16px 24px;
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.schedule-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.no-schedules {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}

.schedule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-input);
  gap: 12px;
}

.schedule-item.disabled {
  opacity: 0.5;
}

.schedule-mode {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.schedule-detail {
  font-size: 13px;
  color: var(--text-secondary);
}

.schedule-max {
  font-size: 12px;
  color: var(--accent-yellow);
  margin-top: 2px;
}

.schedule-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.time-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(79, 142, 255, 0.12);
  border: 1px solid rgba(79, 142, 255, 0.25);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Shop Card Footer */
.shop-card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--card-footer-bg);
}

.shop-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Forms ── */
.form-container {
  max-width: 640px;
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(79, 142, 255, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

/* Mode Selector */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mode-option input[type="radio"] {
  display: none;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.mode-option input[type="radio"]:checked+.mode-card {
  border-color: var(--accent-blue);
  background: rgba(79, 142, 255, 0.08);
}

.mode-card:hover {
  border-color: var(--border-hover);
}

.mode-icon {
  font-size: 28px;
}

.mode-title {
  font-size: 14px;
  font-weight: 600;
}

.mode-desc {
  font-size: 12px;
  color: var(--text-muted);
}

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

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-blue);
}

.checkbox-text {
  font-size: 14px;
}

/* ── Filter Bar ── */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.filter-form {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group .form-input,
.filter-group .form-select {
  width: auto;
  min-width: 150px;
  padding: 8px 12px;
  font-size: 13px;
}

/* ── Data Table ── */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--bg-secondary);
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.td-nowrap {
  white-space: nowrap;
}

.td-small {
  font-size: 11px;
  max-width: 180px;
}

.td-message {
  max-width: 220px;
  font-size: 12px;
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-success {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.status-failed {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.status-skipped {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
}

.status-running {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
}

.status-unknown {
  background: rgba(100, 100, 100, 0.15);
  color: var(--text-muted);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 0;
}

.page-info {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar {
    width: 64px;
  }

  .sidebar-header {
    padding: 16px 12px;
  }

  .logo-text,
  .logo-sub,
  .nav-link span:last-child,
  .status-text {
    display: none;
  }

  .nav-link {
    justify-content: center;
    padding: 12px;
  }

  .main-content {
    margin-left: 64px;
    padding: 24px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .mode-selector {
    grid-template-columns: 1fr;
  }

  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group .form-input,
  .filter-group .form-select {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .shop-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .schedule-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .shop-actions {
    flex-direction: column;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px;
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}