/* ========================================================
   Komapos 新UIデザインシステム - pos-theme.css
   現場の物理アフォーダンスとUI工学を極めたデザイン定義
   ======================================================== */

:root {
  --shadow-card-store: 0 4px 0 #cbd5e1, 0 6px 12px rgba(0, 0, 0, 0.06);
  --color-store-primary: #ea580c;
  --color-store-dark: #9a3412;
  --color-navy-action: #1e3a8a;
  --color-navy-dark: #0f172a;
  --color-neon-green: #10b981;
  --color-neon-dark: #047857;
  --color-slate-shadow: #94a3b8;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  background-color: #cbd5e1;
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  font-weight: 700;
}

/* 20pxピッチの方眼グリッド（カッターマット・製図方眼パターン） */
.bg-grid-pattern {
  background-color: #f1f5f9;
  background-image: 
    linear-gradient(to right, rgba(148, 163, 184, 0.2) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.2) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* 物理的な押し込みフィードバック（ソリッドシャドウ＋2px沈み込み） */
.btn-tactile {
  transition: transform 0.08s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.08s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-tactile:active:not(:disabled) {
  transform: translateY(2px) !important;
}

/* ソリッドボタンスタイル */
.shadow-btn-orange {
  box-shadow: 0 4px 0 #9a3412, 0 6px 12px rgba(234,88,12,.25);
}
.shadow-btn-orange:active:not(:disabled) {
  box-shadow: 0 1px 0 #9a3412 !important;
}

.shadow-btn-navy {
  box-shadow: 0 4px 0 #0f172a, 0 6px 12px rgba(30,58,138,.25);
}
.shadow-btn-navy:active:not(:disabled) {
  box-shadow: 0 1px 0 #0f172a !important;
}

.shadow-btn-green {
  box-shadow: 0 4px 0 #047857, 0 6px 12px rgba(16,185,129,.3);
}
.shadow-btn-green:active:not(:disabled) {
  box-shadow: 0 1px 0 #047857 !important;
}

.shadow-btn-slate {
  box-shadow: 0 3px 0 #94a3b8;
}
.shadow-btn-slate:active:not(:disabled) {
  box-shadow: 0 1px 0 #94a3b8 !important;
}

/* 店舗用：立体浮き出しカード */
.card-store {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: var(--shadow-card-store);
  border: 2px solid #e2e8f0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.25s ease;
}

/* 四角形商品タイル */
.tile-product-box {
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 4px 0 #cbd5e1, 0 6px 12px rgba(0,0,0,0.06);
  border: 2px solid #e2e8f0;
  padding: 9px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

/* 非表示商品のグレーアウトスタイル */
.tile-product-box.is-hidden-product {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  filter: grayscale(0.85);
  opacity: 0.75;
}
.tile-product-box.is-hidden-product .btn-toggle-hidden-sunken {
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.4) !important;
  background-color: #0f172a !important;
  transform: translateY(2px);
}

/* 不可視44×44pxタップ領域 */
.touch-target-44 {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* くぼみインセット表現 ＆ 指で触れやすい太い入力欄 */
.inset-sunken {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
  border: 1.5px solid #cbd5e1;
  padding-top: 0.625rem !important; /* 10px */
  padding-bottom: 0.625rem !important; /* 10px */
  min-height: 44px;
  box-sizing: border-box;
}
textarea.inset-sunken {
  min-height: 80px;
}

/* スクロール領域 */
.scroll-container {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* 180度反転カード（対面のお客様向け撮影用） */
.rotate-180-card {
  transform: rotate(180deg);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ステップナビゲーション (シェブロン構造) */
.chevron-step {
  flex: 1;
  text-align: center;
  padding: 8px 10px 8px 16px;
  background: #e2e8f0;
  color: #64748b;
  font-size: 11px;
  font-weight: bold;
  clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%, 10% 50%);
  margin-left: -5%;
  position: relative;
  transition: all 0.2s ease;
  cursor: default;
}
.chevron-step:first-child {
  padding-left: 10px;
  clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%);
  margin-left: 0;
  z-index: 30;
}
.chevron-step:nth-child(2) { z-index: 20; }
.chevron-step:nth-child(3) { 
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 10% 50%);
  z-index: 10; 
}
.chevron-step.active {
  background: #ea580c;
  color: white;
}

/* アニメーション */
@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
  animation: fadeIn 0.2s ease-out forwards;
}

@keyframes popBounce {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.animate-pop-bounce {
  animation: popBounce 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* 新規注文が画面に入ってきた時（左からスライドイン） */
@keyframes slideInLeft {
  0% {
    opacity: 0;
    transform: translateX(-100%);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}
.animate-slide-in-left {
  animation: slideInLeft 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* 呼出・完了で画面から消える時（右へスライドアウト） */
@keyframes slideOutRight {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 500px;
    margin-bottom: 0.75rem;
  }
  70% {
    opacity: 0.3;
    transform: translateX(110%) scale(0.95);
  }
  100% {
    opacity: 0;
    transform: translateX(120%) scale(0.9);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    overflow: hidden;
  }
}
.ticket-dismiss-anim,
.animate-slide-out-right {
  animation: slideOutRight 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards !important;
  pointer-events: none !important;
}

/* 電卓拡大モード */
.calc-card-expanded {
  width: 98vw !important; max-width: 36rem !important;
  height: calc(100dvh - 1rem - env(safe-area-inset-bottom)) !important; max-height: calc(100dvh - 1rem - env(safe-area-inset-bottom)) !important;
  padding: 0.5rem !important; display: flex !important;
  flex-direction: column !important; justify-content: space-between !important;
  border-radius: 1.25rem !important;
}
.calc-card-expanded #calc-modal-header { padding-bottom: 0.25rem !important; flex-shrink: 0 !important; }
.calc-card-expanded #calc-display-container { padding: 0.5rem 0.75rem !important; flex-shrink: 0 !important; }
.calc-card-expanded #calc-pad-normal:not(.hidden), .calc-card-expanded #calc-pad-coins:not(.hidden) {
  flex: 1 1 0% !important; min-height: 0 !important; display: flex !important; flex-direction: column !important;
  margin-top: 0.25rem !important; margin-bottom: 0.25rem !important;
}
.calc-card-expanded #calc-pad-normal .grid { display: grid !important; grid-template-rows: repeat(5, minmax(0, 1fr)) !important; flex: 1 1 0% !important; min-height: 0 !important; gap: 0.375rem !important; }
.calc-card-expanded #calc-pad-coins .grid { display: grid !important; grid-template-rows: repeat(4, minmax(0, 1fr)) !important; flex: 1 1 0% !important; min-height: 0 !important; gap: 0.375rem !important; }
.calc-card-expanded button.calc-num-btn, .calc-card-expanded button.calc-op-btn, .calc-card-expanded button.coin-add-btn,
.calc-card-expanded #calc-btn-equal, .calc-card-expanded #calc-btn-backspace, .calc-card-expanded #calc-btn-clear,
.calc-card-expanded #calc-coins-btn-undo, .calc-card-expanded #calc-coins-btn-clear, .calc-card-expanded #calc-btn-exact-normal, .calc-card-expanded #calc-btn-exact-coins {
  height: 100% !important; min-height: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important;
  font-size: clamp(0.9rem, 2.8dvh, 1.4rem) !important; display: flex !important; align-items: center !important; justify-content: center !important;
}
.calc-card-expanded #btn-hold-for-checkout { padding-top: 0.625rem !important; padding-bottom: 0.625rem !important; font-size: clamp(0.875rem, 2.2dvh, 1.125rem) !important; min-height: 0 !important; flex-shrink: 0 !important; }

/* 縦幅の狭いスマホ向け電卓最適化 */
@media (max-height: 700px) {
  #calc-modal-card {
    padding: 0.5rem !important;
    gap: 0.25rem !important;
  }
  #calc-display-container {
    padding: 0.375rem 0.625rem !important;
  }
  #calc-change-amount {
    font-size: 1.5rem !important;
    line-height: 1.75rem !important;
  }
  .calc-num-btn, .coin-add-btn {
    min-height: 2.1rem !important;
    font-size: 1rem !important;
  }
  #btn-hold-for-checkout {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
}

/* ========================================================
   Emergency Management Window Styles (緊急強制切断ウィンドウ)
   ======================================================== */

.emergency-trigger-btn {
  background-color: #ef4444;
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1.5px solid #fca5a5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
  box-shadow: 0 2px 0 #991b1b, 0 4px 8px rgba(239, 68, 68, 0.35);
  user-select: none;
  -webkit-user-select: none;
}

.emergency-window-overlay {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.emergency-window-overlay.active {
  display: flex;
}

.emergency-window-overlay.show {
  opacity: 1;
}

.emergency-hazard-border {
  width: 100%;
  max-width: 360px;
  height: auto;
  min-height: 400px;
  max-height: 500px;
  border-radius: 40px;
  padding: 8px;
  background: repeating-linear-gradient(-45deg, #eab308, #eab308 12px, #171717 12px, #171717 24px);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
  box-sizing: border-box;
}

@keyframes warningGlow {
  0%, 100% {
    box-shadow: inset 0 0 25px rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: inset 0 0 45px rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 0.8);
  }
}

.emergency-warning-inner {
  width: 100%;
  background-color: #0f0f12;
  border-radius: 32px;
  border: 2px solid rgba(239, 68, 68, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 24px;
  position: relative;
  animation: warningGlow 2.5s infinite ease-in-out;
  box-sizing: border-box;
}

.emergency-countdown-badge {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) scale(0.75);
  background-color: #facc15;
  color: #0a0a0a;
  padding: 8px 24px;
  border-radius: 16px;
  font-weight: 900;
  font-size: 36px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  transition: all 0.1s ease;
  opacity: 0;
  pointer-events: none;
  z-index: 9100;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid #fef08a;
  box-sizing: border-box;
  white-space: nowrap;
}

.emergency-countdown-badge.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.emergency-countdown-badge::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px;
  border-style: solid;
  border-color: #facc15 transparent transparent transparent;
}

.emergency-btn-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  position: relative;
  margin: 16px 0;
}

.emergency-btn-disconnect {
  width: 100%;
  height: 120px;
  background-color: #FF0000;
  border: none;
  color: #ffffff;
  font-size: 32px;
  font-weight: 800;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(255, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
}

.emergency-btn-disconnect:active {
  opacity: 0.9;
}

.emergency-status-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  flex-shrink: 0;
  position: relative;
}

.emergency-status-indicator-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.emergency-status-dot {
  height: 12px;
  width: 12px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.emergency-status-text {
  color: #737373;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.emergency-device-count-text {
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.05em;
  text-align: center;
}

.emergency-device-count-num {
  font-size: 32px;
  color: #facc15;
  font-family: monospace;
  font-weight: 800;
  padding: 0 4px;
}

.emergency-btn-back {
  margin-top: 8px;
  padding: 8px 20px;
  background: transparent;
  border: 1px solid #3f3f46;
  color: #a1a1aa;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
}
.emergency-btn-back:hover {
  color: #ffffff;
  border-color: #71717a;
}
