/**
 * REBORN Inventory Management System - Comprehensive Theme
 * Bootstrap 5ベースのREBORNブランドカスタムテーマ
 *
 * @version 3.1
 * @date 2025-11-13
 * @update-reason Cloudflareキャッシュ強制更新
 * @author Claude (Frontend Architect)
 * @description REBORNブランドカラー(#40B4E5)を軸にしたBootstrap 5完全カスタマイズ
 */

/* ============================================
   BOOTSTRAP COLOR OVERRIDES
   Bootstrap 5のデフォルトカラーをREBORNブランドに上書き
   ============================================ */

:root {
  /* Bootstrap Primary → REBORN Primary */
  --bs-primary: #40B4E5;
  --bs-primary-rgb: 64, 180, 229;

  /* Bootstrap Info → REBORN Primary */
  --bs-info: #40B4E5;
  --bs-info-rgb: 64, 180, 229;

  /* REBORN Accent (新規追加) */
  --bs-accent: #FF8C42;
  --bs-accent-rgb: 255, 140, 66;

  /* Semantic Colors (既存維持) */
  --bs-success: #10b981;
  --bs-success-rgb: 16, 185, 129;

  --bs-warning: #f59e0b;
  --bs-warning-rgb: 245, 158, 11;

  --bs-danger: #ef4444;
  --bs-danger-rgb: 239, 68, 68;

  /* Link Colors */
  --bs-link-color: #1E8FBF;
  --bs-link-hover-color: #1A7AA3;

  /* Border Radius (モダンな角丸) */
  --bs-border-radius: 8px;
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: 12px;
  --bs-border-radius-xl: 16px;

  /* Shadows (洗練された影) */
  --bs-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --bs-box-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --bs-box-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);

  /* Focus Ring (アクセシビリティ向上) */
  --bs-focus-ring-color: rgba(64, 180, 229, 0.25);
  --bs-focus-ring-width: 3px;
}

/* ============================================
   BUTTONS - ボタンの完全カスタマイズ
   ============================================ */

/* Primary Button (REBORN Blue) */
.btn-primary {
  --bs-btn-bg: #40B4E5;
  --bs-btn-border-color: #40B4E5;
  --bs-btn-hover-bg: #1E8FBF;
  --bs-btn-hover-border-color: #1E8FBF;
  --bs-btn-active-bg: #1A7AA3;
  --bs-btn-active-border-color: #1A7AA3;
  --bs-btn-disabled-bg: #A8E1F7;
  --bs-btn-disabled-border-color: #A8E1F7;
  background-color: #40B4E5 !important;
  border-color: #40B4E5 !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(64, 180, 229, 0.2);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background-color: #1E8FBF !important;
  border-color: #1E8FBF !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(64, 180, 229, 0.3);
}

.btn-primary:active {
  background-color: #1A7AA3 !important;
  border-color: #1A7AA3 !important;
  transform: translateY(0);
}

/* Info Button (Primary と同じ) */
.btn-info {
  --bs-btn-bg: #40B4E5;
  --bs-btn-border-color: #40B4E5;
  --bs-btn-hover-bg: #1E8FBF;
  --bs-btn-hover-border-color: #1E8FBF;
  --bs-btn-active-bg: #1A7AA3;
  --bs-btn-active-border-color: #1A7AA3;
  --bs-btn-color: #ffffff;
  --bs-btn-hover-color: #ffffff;
  font-weight: 600;
}

/* Accent Button (REBORN Orange) */
.btn-accent {
  --bs-btn-color: #ffffff;
  --bs-btn-bg: #FF8C42;
  --bs-btn-border-color: #FF8C42;
  --bs-btn-hover-bg: #E67535;
  --bs-btn-hover-border-color: #E67535;
  --bs-btn-active-bg: #CC6329;
  --bs-btn-active-border-color: #CC6329;
  --bs-btn-hover-color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(255, 140, 66, 0.2);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(255, 140, 66, 0.3);
}

/* Outline Primary Button */
.btn-outline-primary {
  --bs-btn-color: #1E8FBF;
  --bs-btn-border-color: #40B4E5;
  --bs-btn-hover-bg: #40B4E5;
  --bs-btn-hover-border-color: #40B4E5;
  --bs-btn-active-bg: #1E8FBF;
  --bs-btn-active-border-color: #1E8FBF;
  color: #1E8FBF !important;
  border-color: #40B4E5 !important;
  font-weight: 600;
}

.btn-outline-primary:hover {
  background-color: #40B4E5 !important;
  border-color: #40B4E5 !important;
  color: #ffffff !important;
}

/* Outline Accent Button */
.btn-outline-accent {
  --bs-btn-color: #E67535;
  --bs-btn-border-color: #FF8C42;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #FF8C42;
  --bs-btn-hover-border-color: #FF8C42;
  --bs-btn-active-bg: #E67535;
  --bs-btn-active-border-color: #E67535;
  font-weight: 600;
}

/* Success/Warning/Danger Buttons (洗練されたスタイル) */
.btn-success {
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-warning {
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.btn-danger {
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

/* ============================================
   LINKS - リンクの統一
   ============================================ */

/* Note: リンク色は変更しない（ユーザー要望により元の色を維持） */
/* a {
  color: #1E8FBF !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #1A7AA3 !important;
  text-decoration: underline;
} */

a:focus {
  outline: 2px solid rgba(64, 180, 229, 0.5);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================
   BADGES - バッジの統一
   ============================================ */

.badge {
  font-weight: 600;
  padding: 0.35em 0.65em;
  border-radius: 6px;
}

/* Primary Badge */
.badge.bg-primary,
.badge-primary {
  background-color: #40B4E5 !important;
  color: #ffffff !important;
}

/* Info Badge (Primary と同じ) */
.badge.bg-info,
.badge-info {
  background-color: #40B4E5 !important;
  color: #ffffff !important;
}

/* Accent Badge */
.badge.bg-accent,
.badge-accent {
  background-color: #FF8C42 !important;
  color: #ffffff !important;
}

/* Text Badge (Outline) */
.badge.text-bg-primary {
  background-color: rgba(64, 180, 229, 0.1) !important;
  color: #1E8FBF !important;
  border: 1px solid #40B4E5;
}

/* ============================================
   CARDS - カードの洗練
   ============================================ */

.card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.card-header {
  background: linear-gradient(135deg, #40B4E5 0%, #1E8FBF 100%);
  color: #ffffff;
  font-weight: 600;
  border-bottom: none;
  border-radius: 12px 12px 0 0 !important;
}

/* Accent Card Header */
.card-header.bg-accent {
  background: linear-gradient(135deg, #FF8C42 0%, #E67535 100%);
}

/* ============================================
   FORMS - フォーム要素の改善
   ============================================ */

.form-control:focus,
.form-select:focus {
  border-color: #40B4E5;
  box-shadow: 0 0 0 3px rgba(64, 180, 229, 0.15);
}

.form-check-input:checked {
  background-color: #40B4E5;
  border-color: #40B4E5;
}

.form-check-input:focus {
  border-color: #40B4E5;
  box-shadow: 0 0 0 3px rgba(64, 180, 229, 0.15);
}

/* Input Group */
.input-group-text {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  color: #4b5563;
}

/* ============================================
   ALERTS - アラートの改善
   ============================================ */

.alert {
  border-radius: 8px;
  border-left-width: 4px;
  font-weight: 500;
}

.alert-primary {
  background-color: rgba(64, 180, 229, 0.1);
  border-color: #40B4E5;
  color: #1A7AA3;
}

.alert-info {
  background-color: rgba(64, 180, 229, 0.1);
  border-color: #40B4E5;
  color: #1A7AA3;
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #065f46;
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
  color: #78350f;
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #991b1b;
}

/* ============================================
   MODALS - モーダルの改善
   ============================================ */

.modal-header {
  background: linear-gradient(135deg, #40B4E5 0%, #1E8FBF 100%);
  color: #ffffff;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}

.modal-content {
  border-radius: 12px;
  border: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-footer {
  border-top: 1px solid #e5e7eb;
  background-color: #f9fafb;
  border-radius: 0 0 12px 12px;
}

/* ============================================
   PAGINATION - ページネーション
   ============================================ */

.pagination {
  --bs-pagination-active-bg: #40B4E5;
  --bs-pagination-active-border-color: #40B4E5;
  --bs-pagination-hover-bg: rgba(64, 180, 229, 0.1);
  --bs-pagination-hover-border-color: #40B4E5;
  --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(64, 180, 229, 0.15);
}

.page-link {
  color: #1E8FBF;
  font-weight: 500;
}

.page-link:hover {
  color: #1A7AA3;
}

/* ============================================
   PROGRESS - プログレスバー
   ============================================ */

.progress {
  background-color: #e5e7eb;
  border-radius: 8px;
  height: 12px;
}

.progress-bar {
  background: linear-gradient(90deg, #40B4E5 0%, #1E8FBF 100%);
  border-radius: 8px;
}

.progress-bar.bg-accent {
  background: linear-gradient(90deg, #FF8C42 0%, #E67535 100%);
}

/* ============================================
   SPINNERS - ローディング
   ============================================ */

.spinner-border-primary,
.spinner-border.text-primary {
  --bs-spinner-border-color: #40B4E5;
  --bs-spinner-border-color-rgb: 64, 180, 229;
}

/* ============================================
   NAVBAR - ナビゲーション
   ============================================ */

.navbar-primary {
  background: linear-gradient(135deg, #40B4E5 0%, #1E8FBF 100%);
}

.navbar-primary .navbar-brand,
.navbar-primary .nav-link {
  color: #ffffff !important;
  font-weight: 600;
}

.navbar-primary .nav-link:hover {
  color: rgba(255, 255, 255, 0.85) !important;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

/* ============================================
   TABLES - テーブルの改善
   ============================================ */

.table {
  --bs-table-striped-bg: rgba(64, 180, 229, 0.03);
  --bs-table-hover-bg: rgba(64, 180, 229, 0.05);
}

.table-primary {
  --bs-table-bg: rgba(64, 180, 229, 0.1);
  --bs-table-color: #1A7AA3;
}

.table thead {
  background-color: #f9fafb;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
}

/* ============================================
   BREADCRUMBS - パンくずリスト
   ============================================ */

.breadcrumb {
  --bs-breadcrumb-divider-color: #9ca3af;
  --bs-breadcrumb-item-active-color: #1E8FBF;
  background-color: transparent;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: #9ca3af;
}

.breadcrumb-item a {
  color: #1E8FBF;
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb-item a:hover {
  color: #1A7AA3;
}

/* ============================================
   TOOLTIPS & POPOVERS - ツールチップ
   ============================================ */

.tooltip-inner {
  background-color: #1f2937;
  font-weight: 500;
  border-radius: 6px;
}

.popover {
  border-color: #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.popover-header {
  background-color: #40B4E5;
  color: #ffffff;
  font-weight: 600;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

/* ============================================
   DROPDOWNS - ドロップダウン
   ============================================ */

.dropdown-menu {
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown-item:hover {
  background-color: rgba(64, 180, 229, 0.08);
  color: #1E8FBF;
}

.dropdown-item.active,
.dropdown-item:active {
  background-color: #40B4E5;
  color: #ffffff;
}

/* ============================================
   LIST GROUPS - リストグループ
   ============================================ */

.list-group-item.active {
  background-color: #40B4E5;
  border-color: #40B4E5;
}

.list-group-item-primary {
  background-color: rgba(64, 180, 229, 0.1);
  color: #1E8FBF;
}

.list-group-item-primary.list-group-item-action:hover {
  background-color: rgba(64, 180, 229, 0.15);
  color: #1A7AA3;
}

/* ============================================
   TABS - タブ
   ============================================ */

.nav-tabs {
  border-bottom-color: #e5e7eb;
}

.nav-tabs .nav-link {
  color: #6b7280;
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link:hover {
  color: #40B4E5;
  border-bottom-color: rgba(64, 180, 229, 0.3);
}

.nav-tabs .nav-link.active {
  color: #40B4E5;
  background-color: transparent;
  border-color: transparent transparent #40B4E5;
  font-weight: 600;
}

/* Pills Navigation */
.nav-pills .nav-link.active {
  background-color: #40B4E5;
}

.nav-pills .nav-link {
  color: #6b7280;
  font-weight: 500;
}

.nav-pills .nav-link:hover {
  color: #40B4E5;
  background-color: rgba(64, 180, 229, 0.1);
}

/* ============================================
   ACCORDION - アコーディオン
   ============================================ */

.accordion-button:not(.collapsed) {
  background-color: rgba(64, 180, 229, 0.1);
  color: #1E8FBF;
}

.accordion-button:focus {
  border-color: #40B4E5;
  box-shadow: 0 0 0 3px rgba(64, 180, 229, 0.15);
}

/* ============================================
   OFFCANVAS - オフキャンバス
   ============================================ */

.offcanvas-header {
  background: linear-gradient(135deg, #40B4E5 0%, #1E8FBF 100%);
  color: #ffffff;
}

/* ============================================
   BORDERS - ボーダーカラー
   ============================================ */

.border-primary {
  border-color: #40B4E5 !important;
}

.border-accent {
  border-color: #FF8C42 !important;
}

/* ============================================
   BACKGROUNDS - 背景カラー
   ============================================ */

.bg-primary {
  background-color: #40B4E5 !important;
}

.bg-primary-light {
  background-color: rgba(64, 180, 229, 0.1) !important;
}

.bg-primary-gradient {
  background: linear-gradient(135deg, #40B4E5 0%, #1E8FBF 100%) !important;
}

.bg-accent {
  background-color: #FF8C42 !important;
}

.bg-accent-light {
  background-color: rgba(255, 140, 66, 0.1) !important;
}

/* ============================================
   TEXT COLORS - テキストカラー
   ============================================ */

.text-primary {
  color: #40B4E5 !important;
}

.text-primary-dark {
  color: #1E8FBF !important;
}

.text-accent {
  color: #FF8C42 !important;
}

/* ============================================
   UTILITIES - ユーティリティクラス
   ============================================ */

/* Shadow utilities with REBORN color */
.shadow-primary {
  box-shadow: 0 4px 12px rgba(64, 180, 229, 0.2) !important;
}

.shadow-accent {
  box-shadow: 0 4px 12px rgba(255, 140, 66, 0.2) !important;
}

/* Hover effects */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Focus visible (アクセシビリティ) */
*:focus-visible {
  outline: 2px solid #40B4E5;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================
   RESPONSIVE ENHANCEMENTS
   ============================================ */

/* タッチデバイス用の改善 */
@media (hover: none) {
  .btn:active {
    transform: scale(0.98);
  }

  .card:hover {
    transform: none;
  }
}

/* モバイル最適化 */
@media (max-width: 767.98px) {
  .modal-fullscreen-sm-down {
    border-radius: 0;
  }

  .btn {
    padding: 0.625rem 1rem;
    font-size: 1rem;
  }
}

/* ============================================
   DARK MODE SUPPORT (オプション)
   ============================================ */

@media (prefers-color-scheme: dark) {
  /* 将来的なダークモード対応の準備 */
  /* 現在は実装しない（Phase 2以降で検討） */
}

/* ============================================
   PRINT STYLES
   ============================================ */

/* ============================================
   UNIFIED HEADER SYSTEM - 統一ヘッダーシステム
   UI-017: 全メニューヘッダーUI統一化
   ============================================ */

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 16px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
}

.back-button {
  width: 40px;
  height: 40px;
  border: none;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
  color: #374151;
  font-size: 20px;
}

.back-button:hover {
  background: #f3f4f6;
}

.back-button:active {
  background: #e5e7eb;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.header-title i {
  font-size: 20px;
}

/* レスポンシブ調整 */
@media (max-width: 767px) {
  .header {
    padding: 10px 12px;
  }

  .header-title {
    font-size: 16px;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .btn,
  .nav,
  .navbar,
  .modal,
  .dropdown {
    display: none !important;
  }

  .card {
    border: 1px solid #000;
    box-shadow: none;
  }
}
