/* エイベンス アプリプラットフォーム - スマートデンモク風タブレットUI */

:root {
  --dam-bg:     #14141f;
  --dam-bg2:    #1e1e2e;
  --dam-orange: #ff7a00;
  --dam-red:    #e60012;
  --dam-grad:   linear-gradient(135deg, #ff9a2e 0%, #ff5e00 45%, #e60012 100%);
  --dam-grad-hover: linear-gradient(135deg, #ff8514 0%, #ee4e00 45%, #c8000f 100%);
}

body {
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ===== ダーク筐体背景（デンモクのステージ感） ===== */
body.dam-body {
  background: radial-gradient(circle at 50% -8%, #2c2c48 0%, #15151f 52%, #0c0c14 100%);
  background-attachment: fixed;
  color: #e8eaf0;
  min-height: 100vh;
  padding-bottom: 92px; /* 下部ナビ分の余白 */
}

/* ===== ログイン画面（デンモク風ダークカード） ===== */
.dam-login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #20202f 0%, #181824 100%);
  border: 1px solid rgba(255, 122, 0, 0.25);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.03) inset;
}
.dam-login-logo {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: var(--dam-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800; color: #fff;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(230, 0, 18, 0.5);
}
.dam-login-title {
  font-size: 26px; font-weight: 800; color: #fff; margin-top: 16px;
}
.dam-login-sub { font-size: 12px; color: #ff9a5e; margin-top: 4px; }
.dam-login-label {
  display: block; font-size: 13px; font-weight: 600; color: #c7cbd9; margin-bottom: 6px;
}
.dam-login-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  color: #fff;
  transition: border-color .15s, background .15s;
}
.dam-login-input::placeholder { color: #6b7280; }
.dam-login-input:focus {
  outline: none;
  border-color: var(--dam-orange);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.2);
}
.dam-login-input option { background: #20202f; color: #fff; }
.dam-login-btn {
  width: 100%;
  background: var(--dam-grad);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  padding: 15px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(230, 0, 18, 0.4);
  transition: transform .1s, box-shadow .15s;
  margin-top: 4px;
}
.dam-login-btn:hover { box-shadow: 0 10px 30px rgba(230, 0, 18, 0.55); }
.dam-login-btn:active { transform: scale(0.97); }

/* ===== ヘッダー ===== */
.dam-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(20, 20, 31, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid transparent;
  border-image: var(--dam-grad) 1;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
}
.dam-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dam-brand { display: flex; align-items: center; gap: 10px; }
.dam-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--dam-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  box-shadow: 0 4px 14px rgba(230, 0, 18, 0.45);
}
.dam-brand h1 { font-size: 18px; font-weight: 800; color: #fff; line-height: 1.1; margin: 0; }
.dam-sub { font-size: 11px; color: #ff9a5e; margin: 0; }

.dam-header-actions { display: flex; align-items: center; gap: 8px; }
.dam-user-chip {
  font-size: 12px; color: #cbd5e1;
  display: flex; align-items: center; gap: 4px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dam-icon-btn {
  position: relative;
  min-width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  transition: background .15s;
}
.dam-icon-btn:hover { background: rgba(255, 255, 255, 0.16); }

/* ===== 下部ナビ（デンモクの操作バー） ===== */
.dam-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 45;
  display: flex;
  background: rgba(22, 22, 34, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 122, 0, 0.25);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.dam-bottom-nav .nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 4px 12px;
  min-height: 64px;
  background: none; border: none; cursor: pointer;
  color: #8b8ba3;
  transition: color .15s, transform .1s;
  position: relative;
}
.dam-bottom-nav .nav-btn:active { transform: scale(0.93); }
.dam-bottom-nav .bn-icon { font-size: 24px; line-height: 1; filter: grayscale(0.4) opacity(0.7); transition: filter .15s; }
.dam-bottom-nav .bn-label { font-size: 11px; font-weight: 600; }
.dam-bottom-nav .nav-btn.active { color: #fff; }
.dam-bottom-nav .nav-btn.active .bn-icon { filter: none; transform: translateY(-1px); }
.dam-bottom-nav .nav-btn.active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 40%; height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--dam-grad);
  box-shadow: 0 0 10px rgba(255, 94, 0, 0.7);
}
.dam-bottom-nav .nav-btn.active .bn-label {
  background: var(--dam-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== ドロワー（設定メニュー） ===== */
#drawerOverlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 55;
}
#drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 300px; max-width: 85vw;
  background: var(--dam-bg2);
  color: #e8eaf0;
  z-index: 56;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex; flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}
#drawer.open { transform: translateX(0); }
.drawer-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #e8eaf0;
  font-size: 14px; text-align: left;
  border: none; cursor: pointer;
  margin-bottom: 8px;
  transition: background .15s;
}
.drawer-item:hover { background: rgba(255, 255, 255, 0.12); }
.drawer-item.danger { color: #ff8a8a; }

/* ===== セクション見出し（ダーク背景上） ===== */
.view > div > h2,
#view-support > div > div > h2 { color: #ffffff; }
.view .text-slate-500 { color: #9aa0b4; }

/* ===== カード（デンモクのタイル風に白で浮かせる） ===== */
.app-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transition: transform .15s, box-shadow .15s;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #1e293b;
}
.app-card:hover {
  box-shadow: 0 10px 28px rgba(255, 94, 0, 0.3);
  transform: translateY(-3px);
}
.app-card:active { transform: scale(0.98); }

.app-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  margin-bottom: 12px;
}

/* 白カード内はダークテキストに固定 */
.app-card h3, .app-card .text-slate-700,
.bg-white, .bg-white h2, .bg-white h3, .bg-white h4 { }

/* ===== DAMカラーへのアクセント置換（indigo→オレンジ赤） ===== */
.bg-indigo-600 { background-image: var(--dam-grad) !important; background-color: transparent !important; }
.bg-indigo-700 { background-image: var(--dam-grad-hover) !important; background-color: transparent !important; }
.hover\:bg-indigo-700:hover { background-image: var(--dam-grad-hover) !important; }
.text-indigo-600, .text-indigo-700 { color: #e25600 !important; }
.text-indigo-100 { color: #ffd9b8 !important; }
.bg-indigo-50, .hover\:bg-indigo-50:hover { background-color: #fff2e9 !important; }
.bg-indigo-100, .hover\:bg-indigo-100:hover { background-color: #ffe0cc !important; }
.border-indigo-300 { border-color: #ffae7a !important; }
.border-indigo-400 { border-color: #ff8a4a !important; }
.focus\:ring-indigo-500:focus { --tw-ring-color: #ff7a00 !important; }
.ring-indigo-500 { --tw-ring-color: #ff7a00 !important; }
.from-indigo-600, .from-indigo-700 { --tw-gradient-from: #ff7a00 !important; }
.to-purple-600, .to-purple-700 { --tw-gradient-to: #e60012 !important; }
.bg-indigo-500\/40 { background-color: rgba(255,122,0,.4) !important; }

/* ===== バッジ ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-green   { background: #dcfce7; color: #166534; }
.badge-yellow  { background: #fef3c7; color: #92400e; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-indigo  { background: #ffe6d5; color: #c2410c; }

/* ===== AIチェック結果ブロック ===== */
.check-block {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 13px;
}
.check-ok   { background:#f0fdf4; border-color:#bbf7d0; }
.check-warn { background:#fffbeb; border-color:#fde68a; }
.check-ng   { background:#fef2f2; border-color:#fecaca; }

/* ===== スピナー ===== */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--dam-orange);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== トースト ===== */
#toast { background: var(--dam-bg2); }
#toast.show { display: block; animation: slideIn .3s; }
@keyframes slideIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }

/* ===== アプリランチャー（フルスクリーンiframe） ===== */
/* 既定は非表示。.open の時だけ表示（IDセレクタが .hidden を上書きしないよう display:none を明示） */
#appLauncher {
  position: fixed; inset: 0; z-index: 60;
  flex-direction: column;
  background: #0c0c14;
  display: none;
}
#appLauncher.open { display: flex; }
.app-launcher-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--dam-grad);
  color: #fff;
  flex-shrink: 0;
}
.app-launcher-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

/* ===== モーダル（中身は白のまま読みやすく） ===== */
#modal.show, #apiModal.show, #dbSettingsModal.show,
#notifSettingsModal.show, #supportConfigModal.show, #videoEditorModal.show { display: flex; }

/* ===== タッチ最適化：入力・ボタンを大きく ===== */
@media (pointer: coarse) {
  input, select, textarea {
    font-size: 16px; /* iOSの自動ズーム防止 */
    min-height: 44px;
  }
  button { min-height: 40px; }
}

/* ===== レスポンシブ：タブレット横／スマホ縦 ===== */
@media (min-width: 768px) {
  .dam-bottom-nav .bn-icon { font-size: 26px; }
  .dam-bottom-nav .bn-label { font-size: 12px; }
  .dam-bottom-nav .nav-btn { min-height: 70px; }
}
@media (max-width: 420px) {
  .dam-brand h1 { font-size: 16px; }
  .dam-sub { display: none; }
  .dam-bottom-nav .bn-label { font-size: 10px; }
  .dam-user-chip { display: none; }
}

/* 通知センターを下部ナビと被らないように */
#notifCenter { bottom: 100px; top: auto; max-height: 70vh; }
@media (max-width: 480px) {
  #notifCenter { left: 8px; right: 8px; width: auto; }
}
