/* ============================================
   AR Photo Frame - ar-frame.css
   /wp-content/themes/cocoon-child/ar-frame/
   ============================================ */

/* ---------- CSS変数（ブランドカラーに合わせて変更） ---------- */
:root {
  --ar-accent:     #c8a96e;   /* ゴールド系アクセント（ブランドカラーに変更）*/
  --ar-accent2:    #2b2b2b;   /* ダーク */
  --ar-bg:         #1a1a1a;   /* 背景 */
  --ar-surface:    #252525;   /* カード面 */
  --ar-text:       #f5f0e8;   /* テキスト */
  --ar-text-muted: #888;
  --ar-radius:     16px;
  --ar-shadow:     0 8px 40px rgba(0,0,0,.55);
}

/* ---------- ラッパー ---------- */
.ar-frame-wrapper {
  font-family: 'Noto Sans JP', 'Hiragino Sans', sans-serif;
  background: var(--ar-bg);
  color: var(--ar-text);
  border-radius: var(--ar-radius);
  padding: 32px 24px 28px;
  max-width: 600px;
  margin: 32px auto;
  box-shadow: var(--ar-shadow);
  position: relative;
  overflow: hidden;
}

/* 装飾ライン（上部） */
.ar-frame-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--ar-accent), transparent);
}

/* ---------- タイトル ---------- */
.ar-frame-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--ar-accent);
  text-transform: uppercase;
  margin: 0 0 6px;
}

.ar-frame-subtitle {
  text-align: center;
  font-size: .8rem;
  color: var(--ar-text-muted);
  letter-spacing: .06em;
  margin: 0 0 20px;
}

/* ---------- Canvasエリア ---------- */
.ar-canvas-area {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.6);
}

/* Canvas・Videoは重ねて表示 */
#ar-video,
#ar-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#ar-canvas {
  z-index: 2;
}

/* 撮影時フラッシュ */
.ar-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  border-radius: 12px;
  transition: opacity .05s;
}
.ar-flash.active {
  opacity: 1;
}

/* ---------- フレーム選択 ---------- */
.ar-frame-selector {
  display: flex;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ar-accent) transparent;
  padding-bottom: 4px;
}

.ar-frame-selector li {
  flex: 0 0 auto;
}

.ar-frame-thumb {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--ar-surface);
  transition: border-color .2s, transform .15s;
  position: relative;
}

.ar-frame-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* フレームなし */
.ar-frame-thumb.no-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  color: var(--ar-text-muted);
  text-align: center;
  line-height: 1.3;
}

.ar-frame-thumb.selected {
  border-color: var(--ar-accent);
  transform: scale(1.06);
}

.ar-frame-thumb:hover {
  border-color: var(--ar-accent);
}

/* ---------- コントロールボタン ---------- */
.ar-controls {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.ar-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  border-radius: 50px;
  border: none;
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  outline: none;
  font-family: inherit;
}

.ar-btn:active {
  transform: scale(.96);
}

/* 撮影ボタン */
.ar-btn-shoot {
  background: var(--ar-accent);
  color: #1a1a1a;
  box-shadow: 0 4px 20px rgba(200,169,110,.35);
  font-size: .95rem;
  padding: 13px 32px;
}
.ar-btn-shoot:hover {
  background: #dbb97a;
  box-shadow: 0 6px 28px rgba(200,169,110,.5);
}
.ar-btn-shoot:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* カメラ切替ボタン */
.ar-btn-flip {
  background: var(--ar-surface);
  color: var(--ar-text);
  border: 1px solid #3a3a3a;
}
.ar-btn-flip:hover {
  background: #2f2f2f;
}

/* ---------- プレビューモーダル ---------- */
.ar-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.ar-modal-overlay.open {
  display: flex;
}

.ar-modal-box {
  background: var(--ar-surface);
  border-radius: var(--ar-radius);
  padding: 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  animation: arModalIn .25s ease;
  position: relative;
}

@keyframes arModalIn {
  from { opacity: 0; transform: scale(.94) translateY(16px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.ar-modal-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--ar-accent);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 0 0 14px;
  text-align: center;
}

.ar-modal-img {
  width: 100%;
  border-radius: 10px;
  display: block;
}

.ar-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 保存ボタン */
.ar-btn-save {
  background: var(--ar-accent);
  color: #1a1a1a;
}
.ar-btn-save:hover {
  background: #dbb97a;
}

/* 閉じるボタン */
.ar-btn-close {
  background: #3a3a3a;
  color: var(--ar-text);
}
.ar-btn-close:hover {
  background: #484848;
}

/* SNSシェアボタン */
.ar-btn-share {
  background: #1d9bf0;
  color: #fff;
}
.ar-btn-share:hover {
  background: #1a8cd8;
}

/* ---------- ステータスメッセージ ---------- */
.ar-status {
  text-align: center;
  font-size: .8rem;
  color: var(--ar-text-muted);
  margin-top: 14px;
  min-height: 1.4em;
  letter-spacing: .04em;
}

.ar-status.error {
  color: #e07070;
}

/* ---------- カメラ起動前オーバーレイ ---------- */
.ar-start-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20,20,20,.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 5;
  border-radius: 12px;
  transition: opacity .3s;
}

.ar-start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.ar-start-icon {
  font-size: 3rem;
  line-height: 1;
}

.ar-start-text {
  font-size: .9rem;
  color: var(--ar-text-muted);
  text-align: center;
  line-height: 1.6;
  padding: 0 20px;
}

.ar-btn-start {
  background: var(--ar-accent);
  color: #1a1a1a;
  padding: 12px 28px;
  border-radius: 50px;
  border: none;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .06em;
  transition: background .2s;
}
.ar-btn-start:hover {
  background: #dbb97a;
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 480px) {
  .ar-frame-wrapper {
    padding: 20px 14px 20px;
    border-radius: 10px;
  }

  .ar-btn {
    padding: 10px 16px;
    font-size: .82rem;
  }

  .ar-btn-shoot {
    padding: 12px 28px;
  }

  .ar-frame-thumb {
    width: 52px;
    height: 52px;
  }
}