/**
 * ONWEB PWA 앱 - 스타일시트
 * @version 1.0.0
 */

/* ============================================================
   CSS 변수
   ============================================================ */
:root {
  --owp-primary:      #6366f1;
  --owp-primary-dark: #4f46e5;
  --owp-text:         #1e1b4b;
  --owp-text-sub:     #6b7280;
  --owp-bg:           #ffffff;
  --owp-shadow:       0 8px 32px rgba(99,102,241,.18), 0 2px 8px rgba(0,0,0,.08);
  --owp-z:            9999;
  --owp-font:         -apple-system, BlinkMacSystemFont, 'Pretendard', 'Noto Sans KR', sans-serif;
}

/* ============================================================
   공통
   ============================================================ */
.owp-hidden { display: none !important; }

/* ============================================================
   미니 배너 (우측 하단 팝업)
   ============================================================ */
.owp-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--owp-bg);
  border-radius: 16px;
  box-shadow: var(--owp-shadow);
  border: 1px solid rgba(99,102,241,.15);
  z-index: var(--owp-z);
  font-family: var(--owp-font);
  overflow: hidden;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .35s ease;
}
.owp-banner::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--owp-primary), #a78bfa);
}
.owp-banner.owp-show {
  animation: owp-slide-up .4s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes owp-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* 모바일 중앙 배치 시 translateX(-50%) 를 유지한 애니메이션 */
@keyframes owp-slide-up-center {
  from { opacity: 0; transform: translateX(-50%) translateY(20px) scale(.95); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.owp-banner__inner { padding: 16px 16px 14px; position: relative; }
.owp-banner__close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; font-size: 18px;
  color: var(--owp-text-sub); cursor: pointer; line-height: 1;
  padding: 2px 4px; border-radius: 4px; transition: background .15s;
}
.owp-banner__close:hover { background: #f3f4f6; color: var(--owp-text); }
.owp-banner__app {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; padding-right: 24px;
}
.owp-banner__icon {
  width: 52px; height: 52px; border-radius: 12px;
  object-fit: cover; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.owp-banner__title {
  display: block; font-size: 14px; font-weight: 700;
  color: var(--owp-text); margin-bottom: 3px;
}
.owp-banner__desc {
  font-size: 12px; color: var(--owp-text-sub); line-height: 1.4;
}
.owp-banner__actions { display: flex; align-items: center; gap: 10px; }
.owp-banner__btn {
  border: none; cursor: pointer;
  font-family: var(--owp-font); font-size: 14px; font-weight: 600;
  border-radius: 10px; transition: all .18s ease;
}
.owp-banner__btn--install {
  flex: 1; padding: 11px 0;
  background: linear-gradient(135deg, var(--owp-primary), #818cf8);
  color: #fff; box-shadow: 0 3px 12px rgba(99,102,241,.35);
}
.owp-banner__btn--install:hover {
  background: linear-gradient(135deg, var(--owp-primary-dark), var(--owp-primary));
  box-shadow: 0 5px 16px rgba(99,102,241,.45); transform: translateY(-1px);
}
.owp-banner__btn--install:active { transform: translateY(0); }
.owp-banner__btn--later {
  background: none; color: var(--owp-text-sub);
  padding: 11px 8px; font-size: 13px; font-weight: 500;
}
.owp-banner__btn--later:hover { color: var(--owp-text); }

/* ============================================================
   설치 안내 페이지
   ============================================================ */

/* 배경 */
.owp-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,.35) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(168,85,247,.2) 0%, transparent 60%),
    #0a0a0f;
}
.owp-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* 래퍼 — 항상 좌우 20px 여백, 카드는 꽉 채움 */
.owp-wrap {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px 80px;
  font-family: var(--owp-font);
  color: #e8e8f0;
  box-sizing: border-box;
}

/* 타이틀 */
.owp-title {
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.25;
  background: linear-gradient(135deg, #fff 30%, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 32px;
  width: 100%;
  max-width: 460px;
}

/* 카드 — max-width 460px, 이하에서는 100% */
.owp-card {
  width: 100%;
  max-width: 460px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 20px;
  padding: 28px 24px;
  backdrop-filter: blur(12px);
  margin-bottom: 16px;
  box-sizing: border-box;
}
.owp-card-title {
  font-size: 13px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: rgba(255,255,255,.35); margin-bottom: 16px;
}

/* 설치 버튼 */
#install-button {
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff; font-size: 16px; font-weight: 700;
  font-family: var(--owp-font);
  border: none; border-radius: 14px; padding: 17px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(99,102,241,.4);
  transition: transform .15s, box-shadow .15s;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  box-sizing: border-box;
}
#install-button:hover  { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(99,102,241,.55); }
#install-button:active { transform: translateY(0); }
#install-button:disabled { opacity: .6; cursor: not-allowed; transform: none; }

#install-status {
  font-size: 13px; color: rgba(255,255,255,.4);
  text-align: center; margin-top: 12px; min-height: 18px;
}

/* 이미 설치됨 */
.owp-installed-icon {
  width: 56px; height: 56px;
  background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 24px;
}
.owp-installed-title { font-size: 17px; font-weight: 700; color: #86efac; margin-bottom: 6px; }
.owp-installed-sub   { font-size: 13px; color: rgba(134,239,172,.5); margin-bottom: 24px; }
.owp-installed-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 32px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff; border-radius: 12px; text-decoration: none;
  font-weight: 700; font-size: 15px;
  box-shadow: 0 4px 20px rgba(34,197,94,.3);
}

/* 장점 리스트 */
.owp-benefits {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 0;
  margin: 0;
}
.owp-benefit { display: flex; align-items: flex-start; gap: 14px; text-align: left; width: 100%; }
.owp-benefit-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.25);
  border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.owp-benefit-text strong { display: block; font-size: 14px; font-weight: 600; color: #e0e0f0; }
.owp-benefit-text span   { font-size: 12px; color: rgba(255,255,255,.4); }

/* OS 탭 */
.owp-os-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.owp-os-tab {
  flex: 1; padding: 8px 4px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px; font-size: 12px; font-weight: 600;
  font-family: var(--owp-font);
  color: rgba(255,255,255,.4); cursor: pointer; transition: all .2s;
}
.owp-os-tab.active {
  background: rgba(99,102,241,.2); border-color: rgba(99,102,241,.5); color: #a5b4fc;
}

/* 단계 안내 */
.owp-steps { display: flex; flex-direction: column; gap: 10px; }
.owp-step {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(255,255,255,.03); border-radius: 10px; padding: 12px 14px;
}
.owp-step-num {
  width: 24px; height: 24px; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.owp-step-text          { font-size: 13px; line-height: 1.55; color: rgba(255,255,255,.7); }
.owp-step-text strong   { color: #c7d2fe; }

.owp-icon-row {
  display: inline-flex; gap: 10px; margin-top: 8px; flex-wrap: wrap;
}
.owp-icon-badge {
  display: inline-flex; align-items: center;
  background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.3);
  border-radius: 8px; padding: 5px 10px;
  font-size: 12px; color: #a5b4fc; font-weight: 600;
}

/* 모달 */
.owp-modal {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.85); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 20px;
  box-sizing: border-box;
}
.owp-modal.open { display: flex; }
.owp-modal-box {
  background: #14141f; border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px; padding: 24px;
  max-width: 340px; width: 100%;
  animation: owp-modal-in .25s ease;
  box-sizing: border-box;
}
@keyframes owp-modal-in {
  from { transform: scale(.93); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.owp-modal-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.owp-modal-header span { font-size: 15px; font-weight: 700; color: #e0e0f0; font-family: var(--owp-font); }
.owp-modal-header button {
  background: rgba(255,255,255,.08); border: none; border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer; color: rgba(255,255,255,.5);
  font-size: 16px; display: flex; align-items: center; justify-content: center; transition: background .2s;
}
.owp-modal-header button:hover { background: rgba(255,255,255,.15); color: #fff; }
.owp-modal-note {
  margin-top: 16px; padding: 12px;
  background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.2);
  border-radius: 10px; font-size: 12px; color: rgba(255,255,255,.5); line-height: 1.6;
  font-family: var(--owp-font);
}
.owp-modal-note strong { color: #a5b4fc; }

/* ============================================================
   반응형
   ============================================================ */

/* 500px 이하 — 좌우 20px 여백만 남기고 꽉 채움 */
/* 배너 — 모바일(768px 이하) 하단 중앙 고정 */
@media (max-width: 768px) {
  .owp-banner {
    right: auto;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    width: 340px;
    max-width: calc(100vw - 32px);
  }
  .owp-banner.owp-show {
    animation: owp-slide-up-center .4s cubic-bezier(.34,1.56,.64,1) forwards;
  }
}

@media (max-width: 500px) {
  .owp-wrap {
    padding: 40px 20px 60px;
    align-items: stretch;
  }
  .owp-title,
  .owp-card {
    max-width: 100%;
    width: 100%;
  }
  .owp-card  { padding: 22px 18px; border-radius: 16px; }
  .owp-title { margin-bottom: 24px; text-align: center; }
  /* 배너는 별도 768px 미디어쿼리에서 중앙 처리 */
  .owp-os-tab { font-size: 11px; padding: 7px 2px; }
}

/* ============================================================
   탭바
   ============================================================ */

body.owp-has-tabbar { padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; }

/* 기본: 숨김 — 글래스모피즘 베이스(다크) */
.owp-tabbar {
  display: none;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 450px;
  height: 70px;
  border-radius: 35px;
  z-index: 9000;
  padding: 0 10px;
  opacity: 1;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-sizing: border-box;
}

/* 스크롤 다운 시 숨김 */
.owp-tabbar.owp-tb-hidden {
  transform: translateX(-50%) translateY(calc(100% + 30px));
  opacity: 0;
  pointer-events: none;
}

@supports (bottom: env(safe-area-inset-bottom)) {
  .owp-tabbar { bottom: max(20px, env(safe-area-inset-bottom)); }
}

/* 라이트 테마 — 흰색 반투명 + blur */
.owp-tabbar.owp-tb-light {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* 다크 테마 — 검정 반투명 + blur */
.owp-tabbar.owp-tb-dark {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 내부 컨테이너 */
.owp-tb-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: 100%;
  padding: 0 2px;
}

/* 히스토리 버튼 그룹 */
.owp-tb-history {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-right: 3px;
}

.owp-tb-hist-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 35px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.owp-tb-hist-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.owp-tb-hist-btn:not(:disabled):active::before { opacity: 1; }
.owp-tb-hist-btn:not(:disabled):active { transform: scale(0.9); }
.owp-tb-hist-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.owp-tb-hist-btn .material-icons { font-size: 24px; transition: color 0.3s ease; }

/* 탭 메뉴 */
.owp-tb-menu {
  display: flex;
  align-items: center;
  flex: 1;
  height: 100%;
}

/* 탭 아이템 */
.owp-tb-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  padding: 8px 0;
  border-radius: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.owp-tb-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.owp-tb-item:active::before { opacity: 1; }
.owp-tb-item:active { transform: scale(0.95); }

/* Material Icons 아이콘 */
.owp-tb-icon { display: flex; align-items: center; justify-content: center; }
.owp-tb-icon .material-icons { font-size: 25px; transition: color 0.3s ease; }

/* 라벨 */
.owp-tb-label {
  font-size: 12px;
  font-family: var(--owp-font);
  font-weight: 500;
  transition: color 0.3s ease;
  white-space: nowrap;
}

/* ── 다크 테마 색상 ── */
.owp-tb-dark .owp-tb-icon .material-icons   { color: rgba(255,255,255,0.9); }
.owp-tb-dark .owp-tb-label                  { color: rgba(255,255,255,0.8); }
.owp-tb-dark .owp-tb-item::before           { background: rgba(255,255,255,0.2); }
.owp-tb-dark .owp-tb-hist-btn::before       { background: rgba(255,255,255,0.2); }
.owp-tb-dark .owp-tb-hist-btn .material-icons { color: rgba(255,255,255,0.9); }
/* 다크 활성 탭 */
.owp-tb-dark .owp-tb-active .owp-tb-icon .material-icons { color: #ffffff; }
.owp-tb-dark .owp-tb-active .owp-tb-label                { color: #ffffff; font-weight: 700; }

/* ── 라이트 테마 색상 ── */
.owp-tb-light .owp-tb-icon .material-icons  { color: rgba(0,0,0,0.8); }
.owp-tb-light .owp-tb-label                 { color: rgba(0,0,0,0.8); }
.owp-tb-light .owp-tb-item::before          { background: rgba(0,0,0,0.1); }
.owp-tb-light .owp-tb-hist-btn::before      { background: rgba(0,0,0,0.1); }
.owp-tb-light .owp-tb-hist-btn .material-icons { color: rgba(0,0,0,0.8); }
/* 라이트 활성 탭 */
.owp-tb-light .owp-tb-active .owp-tb-icon .material-icons { color: var(--owp-primary); }
.owp-tb-light .owp-tb-active .owp-tb-label                { color: var(--owp-primary); font-weight: 700; }

/* 새로고침 버튼 */
.owp-tb-refresh {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  margin-left: 10px;
  position: relative; overflow: hidden;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.owp-tb-refresh::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.owp-tb-refresh:active::before { opacity: 1; }
.owp-tb-refresh:active { transform: scale(0.95); }
.owp-tb-refresh .material-icons { font-size: 20px; transition: color 0.3s ease; }

/* 다크 새로고침 */
.owp-tb-dark .owp-tb-refresh {
  background: rgba(255,255,255,0.3);
  border: 1px solid rgba(255,255,255,0.4);
}
.owp-tb-dark .owp-tb-refresh::before         { background: rgba(255,255,255,0.2); }
.owp-tb-dark .owp-tb-refresh .material-icons { color: #ffffff; }

/* 라이트 새로고침 */
.owp-tb-light .owp-tb-refresh {
  background: rgba(0,0,0,0.1);
  border: 1px solid rgba(0,0,0,0.2);
}
.owp-tb-light .owp-tb-refresh::before         { background: rgba(0,0,0,0.1); }
.owp-tb-light .owp-tb-refresh .material-icons { color: rgba(0,0,0,0.8); }

/* 새로고침 스피닝 */
.owp-tb-spinning {
  animation: owp-spin .6s linear;
}
@keyframes owp-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* 매우 작은 화면 */
@media (max-width: 400px) {
  .owp-tabbar { padding: 0 8px; }
  .owp-tb-item { padding: 6px 0; }
  .owp-tb-refresh { width: 40px; height: 40px; margin-left: 6px; }
  .owp-tb-history { gap: 4px; margin-right: 4px; }
  .owp-tb-hist-btn { width: 24px; height: 24px; }
  .owp-tb-hist-btn .material-icons { font-size: 18px; }
}

