/* 共通スタイル */

:root {
  /* カラーパレット - 暖色系 */
  --primary: #ff9900;
  --primary-dark: #e68a00;
  --primary-light: #fff3e0;
  --primary-contrast: #FFFFFF;

  --secondary: #8b7355;
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --info: #ff9900;

  --bg-app: #fdfaf5;
  --bg-surface: #FFFFFF;
  --bg-header: #fdece2;
  --bg-card: #FFFFFF;
  
  --text-primary: #603e2b;
  --text-secondary: #8b7355;
  --text-muted: #a89580;
  
  --border: #f5e6d3;
  --divider: #f5e6d3;

  /* サイズ */
  --card-radius: 16px;
  --radius: 8px;
  --radius-sm: 6px;
  --card-shadow: 0 18px 50px rgba(0,0,0,.10);
  --shadow: 0 10px 20px rgba(0,0,0,.08);
  --shadow-sm: 0 4px 12px rgba(0,0,0,.06);

  /* フォント */
  --font-family: 'Roboto', 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
}

/* リセット */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-app);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ユーティリティ - ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: 0 10px 20px rgba(0, 151, 167, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 151, 167, 0.3);
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.28);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #15803d;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-small {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.btn-toggle-password {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-left: none;
  padding: 0 0.75rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.btn-toggle-password:hover {
  color: var(--text-primary);
}

/* バッジ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.05);
  color: var(--text-primary);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge-success {
  background: rgba(22, 163, 74, 0.15);
  color: #15803d;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.badge-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #b91c1c;
}

.badge-info {
  background: rgba(14, 165, 233, 0.15);
  color: #0369a1;
}

/* ステータスバッジ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge--active {
  background: rgba(22, 163, 74, 0.15);
  color: #15803d;
}

.status-badge--inactive {
  background: rgba(248, 113, 113, 0.18);
  color: #b91c1c;
}

/* カード */
.card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

/* フォーム */
.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 151, 167, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group .btn-toggle-password {
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.checkbox-inline input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.invalid-feedback {
  display: none;
  margin-top: 0.25rem;
  color: var(--danger);
  font-size: 0.8rem;
}

.form-control.is-invalid ~ .invalid-feedback {
  display: block;
}

.error-message {
  padding: 0.75rem;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* テーブル */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: rgba(15, 23, 42, 0.04);
}

th,
td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

tbody tr:hover {
  background: rgba(0, 151, 167, 0.05);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* モーダル */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border-radius: var(--card-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* 通知 */
.notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  padding: 1rem 1.5rem;
  min-width: 300px;
  z-index: 2000;
  display: none;
  animation: slideIn 0.3s ease;
}

.notification.active {
  display: block;
}

.notification.success {
  border-left: 4px solid var(--success);
}

.notification.error {
  border-left: 4px solid var(--danger);
}

.notification.info {
  border-left: 4px solid var(--info);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ローディング */
.loading {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.loading i {
  font-size: 2rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 空状態 */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ユーティリティ */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.hidden {
  display: none !important;
}

/* サイト共通ヘッダー */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  margin: -20px -20px 20px -20px;
  border-radius: 8px 8px 0 0;
}

.site-header__brand {
  display: flex;
  align-items: center;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ユーザー名表示 */
.current-user {
  padding: 0.4rem 0.75rem;
  background: rgba(255, 153, 0, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.current-user--clickable {
  cursor: pointer;
  transition: background 0.2s;
}

.current-user--clickable:hover {
  background: rgba(255, 153, 0, 0.18);
}

/* ロゴ共通スタイル */
.brand-logo {
  height: 45px;
  width: auto;
}

.auth-logo {
  height: 120px;
  width: auto;
  margin: 0px 0 0x 0;
}

.header-logo {
  height: 40px;
  width: auto;
}
