/* ===== 賞味期限管理システム - カスタムCSS ===== */

:root {
  --sidebar-width: 260px;
  --header-height: 56px;
  --primary-color: #2563eb;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #3b82f6;
}

* {
  box-sizing: border-box;
}
body {
  font-family:
    "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    Meiryo, sans-serif;
  background: #f1f5f9;
  margin: 0;
}

/* ===== ログイン画面 ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem;
}
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* ===== サイドバー ===== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 1.2rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
}
.sidebar-user {
  padding: 0.8rem 1.5rem;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.sidebar-nav {
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav li a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.sidebar-nav li a.active {
  background: rgba(59, 130, 246, 0.15);
  color: #fff;
  border-left-color: var(--sidebar-active);
}
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-footer a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.85rem;
}
.sidebar-footer a:hover {
  color: #fff;
}
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1035;
}

/* ===== メインコンテンツ ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
}
.main-header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.main-body {
  padding: 1.5rem;
}

/* ===== カード ===== */
.stat-card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
}
.stat-card .card-body {
  padding: 1.25rem;
}
.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.stat-card .stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* ===== テーブル ===== */
.table-card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.table-card .card-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 1.25rem;
  font-weight: 600;
}
.table-card .table {
  margin-bottom: 0;
}
.table-card .table th {
  font-weight: 600;
  font-size: 0.85rem;
  color: #475569;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.table-card .table td {
  vertical-align: middle;
  font-size: 0.9rem;
}

/* ===== バッジ ===== */
.badge-expired {
  background: #dc2626 !important;
  color: #fff;
}
.badge-critical {
  background: #ea580c !important;
  color: #fff;
}
.badge-warning {
  background: #d97706 !important;
  color: #fff;
}
.badge-ok {
  background: #16a34a !important;
  color: #fff;
}

/* ===== フォーム ===== */
.form-card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.form-card .card-body {
  padding: 1.5rem;
}

/* ===== アラートバー ===== */
.alert-bar {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* ===== レスポンシブ ===== */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  .main-body {
    padding: 1rem;
  }
}

@media (max-width: 575.98px) {
  .stat-card .stat-number {
    font-size: 1.4rem;
  }
  .stat-card .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  .login-card {
    padding: 1.5rem;
  }
  .main-body {
    padding: 0.75rem;
  }
  .table-responsive {
    font-size: 0.85rem;
  }
}

/* ===== モーダル改善 ===== */
.modal-content {
  border-radius: 12px;
}
.modal-header {
  border-bottom-color: #e2e8f0;
}
.modal-footer {
  border-top-color: #e2e8f0;
}

/* ===== その他 ===== */
.cursor-pointer {
  cursor: pointer;
}
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
}
.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

/* ===== 進捗バー ===== */
.expiry-bar {
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  background: #e2e8f0;
}
.expiry-bar .bar-segment {
  height: 100%;
  float: left;
  transition: width 0.5s;
}
.bar-expired {
  background: #dc2626;
}
.bar-critical {
  background: #ea580c;
}
.bar-warning {
  background: #d97706;
}
.bar-ok {
  background: #16a34a;
}

/* Loading spinner */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}
