/**
 * スクリプト管理画面スタイル
 */

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

.scripts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.scripts-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* スクリプト作成フォーム */
.script-form {
  padding: 24px;
  margin-bottom: 24px;
}

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

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

.form-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--fg);
  font-size: 15px;
  box-shadow: var(--shadow);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* スクリプト一覧 */
.scripts-list {
  display: grid;
  gap: 16px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 8px;
  
  /* カスタムスクロールバー */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.scripts-list::-webkit-scrollbar {
  width: 8px;
}

.scripts-list::-webkit-scrollbar-track {
  background: transparent;
}

.scripts-list::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 4px;
}

.scripts-list::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent);
}

.script-item {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform .04s ease, box-shadow .2s ease;
}

.script-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .08), 0 16px 32px rgba(0, 0, 0, .08);
}

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

.script-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}

.script-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity .2s ease;
}

.script-item:hover .script-actions {
  opacity: 1;
}

.script-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all .2s ease;
}

.script-btn:hover {
  background: var(--bg);
  color: var(--fg);
}

.script-btn.danger:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.script-content {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
  max-height: 120px;
  overflow-y: auto;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  
  /* カスタムスクロールバー */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.script-content::-webkit-scrollbar {
  width: 6px;
}

.script-content::-webkit-scrollbar-track {
  background: transparent;
}

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

.script-content::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent);
}

.script-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 40px;
  height: 20px;
  background: linear-gradient(to right, transparent, var(--card));
}

.script-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

/* 空状態 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

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

.empty-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--fg);
}

.empty-description {
  margin-bottom: 24px;
}

/* ローディング状態 */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-radius: 50%;
  border-top: 2px solid var(--accent);
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* エラー状態 */
.error-message {
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 16px;
}

.success-message {
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  color: #166534;
  font-size: 14px;
  margin-bottom: 16px;
}