/* ==========================================
   NiraiDesk レンタル管理スタイル (rental.css)
   css/ ディレクトリに配置
   ========================================== */

/* --- ページ共通 --- */
.rental-page {
  padding: 0;
}

.rental-loading {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-size: 14px;
}

.rental-empty {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-size: 14px;
}

/* --- フィルタバー --- */
.rental-filters {
  background: var(--card, #fff);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.rf-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.rf-sep {
  color: #94a3b8;
  font-size: 13px;
  flex-shrink: 0;
}

.rf-input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  min-width: 0;
}

.rf-input:focus {
  outline: none;
  border-color: #0891b2;
}

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

.rf-btn-filter {
  padding: 10px 16px;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
}

.rf-btn-filter:active {
  background: #e2e8f0;
}

.rf-btn-add {
  flex: 1;
  padding: 10px 16px;
  background: #0891b2;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.rf-btn-add:active {
  background: #0e7490;
}

/* --- 予約カードリスト --- */
.rental-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rental-card {
  background: var(--card, #fff);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.rental-card:active {
  transform: scale(0.98);
}

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

.rc-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.rc-date {
  font-size: 12px;
  color: #94a3b8;
}

.rc-body {
  margin-bottom: 8px;
}

.rc-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.rc-meta {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

.rc-items {
  font-size: 13px;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.rc-period {
  font-size: 12px;
  color: #94a3b8;
}

.rc-total {
  font-size: 16px;
  font-weight: 700;
  color: #0891b2;
}

.rc-badge-signed {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  color: #10b981;
  background: #f0fdf4;
  padding: 2px 8px;
  border-radius: 10px;
}

/* --- モーダル（詳細・作成共通） --- */
.rental-modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.rental-modal {
  background: white;
  border-radius: 16px 16px 0 0;
  max-height: 92vh;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.rm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.rm-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.rm-close {
  width: 32px; height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rm-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.rm-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
}

.rm-status-select {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.rm-section {
  margin-bottom: 20px;
}

.rm-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 10px;
}

.rm-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rm-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.rm-info .lbl {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

/* --- 品目詳細 --- */
.rd-item {
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 8px;
}

.rd-item-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.rd-size {
  background: #e0f2fe;
  color: #0284c7;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  margin-left: 6px;
}

.rd-item-detail {
  font-size: 13px;
  color: #64748b;
}

.rd-item-returned {
  font-size: 12px;
  color: #10b981;
  margin-top: 4px;
}

/* --- 料金 --- */
.rm-price-grid {
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
}

.rm-price-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}

.rm-price-row.ext {
  color: #ef4444;
}

.rm-price-total {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 0;
  margin-top: 8px;
  border-top: 2px solid #0891b2;
  font-size: 16px;
  font-weight: 700;
  color: #0891b2;
}

.rm-payment {
  margin-top: 8px;
  font-size: 13px;
  color: #64748b;
}

/* --- 申込書 --- */
.rm-badge-ok {
  color: #10b981;
  font-size: 14px;
  font-weight: 600;
}

.rm-badge-pending {
  color: #f59e0b;
  font-size: 14px;
  margin-bottom: 8px;
}

.rm-btn-link {
  background: #f1f5f9;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

/* --- メモ --- */
.rm-memo {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.rm-memo:focus {
  outline: none;
  border-color: #0891b2;
}

/* --- フッターボタン --- */
.rm-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
  background: white;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.rm-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  background: #f1f5f9;
  color: #475569;
}

.rm-btn:active { opacity: 0.8; }

.rm-btn-save {
  background: #0891b2;
  color: white;
}

.rm-btn-return {
  background: #10b981;
  color: white;
}

.rm-btn-extend {
  background: #f59e0b;
  color: white;
}

.rm-btn-delete {
  background: #fef2f2;
  color: #ef4444;
}

/* --- ダイアログ（返却/延長） --- */
.rental-dialog-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.rental-dialog {
  background: white;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  animation: popIn 0.25s ease;
}

@keyframes popIn {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.rental-dialog h3 {
  font-size: 17px;
  margin-bottom: 16px;
}

.rd-field {
  margin-bottom: 14px;
}

.rd-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
}

.rd-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.rd-actions .rm-btn {
  flex: 1;
}

/* --- 在庫マトリクス --- */
.inventory-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inv-category {
  background: var(--card, #fff);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.inv-cat-header {
  padding: 10px 14px;
  background: #f8fafc;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.inv-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f8fafc;
}

.inv-item:last-child { border: none; }

.inv-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.inv-name {
  font-size: 14px;
  font-weight: 600;
}

.inv-price {
  font-size: 12px;
  color: #94a3b8;
}

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

.inv-bar-bg {
  flex: 1;
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.inv-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.inv-count {
  font-size: 13px;
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

.inv-reserved {
  color: #f59e0b;
  font-size: 11px;
}

/* --- 新規予約 商品選択 --- */
.rc-category {
  margin-bottom: 12px;
}

.rc-cat-label {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 6px;
}

.rc-product-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
}

.rc-product-item:has(input:checked) {
  border-color: #0891b2;
  background: #ecfeff;
}

.rc-product-item input[type="checkbox"] {
  accent-color: #0891b2;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.rc-prod-name {
  flex: 1;
}

.rc-prod-price {
  color: #0891b2;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

/* --- ナイトテーマ対応 --- */
[data-theme="night"] .rental-card,
[data-theme="night"] .rental-filters,
[data-theme="night"] .inv-category {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="night"] .rf-input {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="night"] .rental-modal,
[data-theme="night"] .rental-dialog {
  background: #1e293b;
  color: #e2e8f0;
}

[data-theme="night"] .rm-header,
[data-theme="night"] .rm-footer {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="night"] .rm-close {
  background: #334155;
  color: #e2e8f0;
}

[data-theme="night"] .rm-body {
  background: #1e293b;
}

[data-theme="night"] .rd-item {
  background: #0f172a;
}

[data-theme="night"] .rm-price-grid {
  background: #0f172a;
}

[data-theme="night"] .rc-product-item {
  border-color: #334155;
}

[data-theme="night"] .rc-product-item:has(input:checked) {
  background: #164e63;
  border-color: #0891b2;
}

[data-theme="night"] .inv-cat-header {
  background: #0f172a;
}

[data-theme="night"] .inv-bar-bg {
  background: #334155;
}

[data-theme="night"] .rm-memo {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="night"] .rc-name {
  color: #f1f5f9;
}

[data-theme="night"] .rm-btn-link {
  background: #334155;
  color: #e2e8f0;
}
