/* 智慧門禁系統 V1.0 - 住戶端 PWA 奢華深色 Glassmorphism CSS (style.css) */

:root {
  --bg-gradient: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  --card-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --primary: #3B82F6;
  --primary-glow: rgba(59, 130, 246, 0.5);
  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.5);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --font-family: 'Outfit', 'Noto Sans TC', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  width: 100vw;
  height: 100vh;
  background: var(--bg-gradient);
  color: var(--text-primary);
  font-family: var(--font-family);
  overflow-x: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 1.25rem;
  position: relative;
}

/* Header 列 */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.user-unit-tag {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

/* 主開門區塊 */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-unlock-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 2rem 0;
  width: 100%;
}

.hero-open-btn {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  outline: none;
  z-index: 10;
}

.btn-glow {
  position: absolute;
  top: -10px; left: -10px; right: -10px; bottom: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  animation: pulseGlow 3s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.9; }
}

.btn-inner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, #1E293B, #0F172A);
  border: 2px solid var(--primary);
  box-shadow: 0 10px 30px var(--primary-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #FFF;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-open-btn:active .btn-inner {
  transform: scale(0.92);
  border-color: var(--success);
  box-shadow: 0 0 40px var(--success-glow);
}

.btn-label {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.door-status-text {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* 快捷卡片 */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
  margin-top: auto;
  margin-bottom: 1rem;
}

.action-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.action-card:active {
  transform: scale(0.97);
  border-color: var(--primary);
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--primary); }
.card-icon.purple { background: rgba(168, 85, 247, 0.15); color: #A855F7; }

.card-text h3 { font-size: 1rem; font-weight: 600; }
.card-text p { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.2rem; }

/* Modal 彈窗與玻璃感 */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #1E293B;
  border: 1px solid var(--glass-border);
  border-radius: 28px 28px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 1.75rem;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.show .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.75rem;
  cursor: pointer;
}

.setting-item {
  margin-bottom: 1.25rem;
}

.setting-item label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.4rem;
}

.glass-input, .glass-select {
  width: 100%;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: #FFF;
  font-size: 1rem;
  outline: none;
}

.btn-primary-block {
  width: 100%;
  padding: 1rem;
  background: var(--primary);
  color: #FFF;
  border: none;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.qr-result-box {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qrcode-canvas {
  padding: 1rem;
  background: #FFF;
  border-radius: 16px;
  margin-bottom: 0.75rem;
}

.qr-expiry-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.share-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn-share {
  flex: 1;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: #FFF;
  border-radius: 12px;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-share.line {
  background: #06C755;
  border: none;
  font-weight: 600;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.log-item-row {
  display: flex;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  font-size: 0.9rem;
}

.admin-link-btn {
  display: block;
  text-align: center;
  padding: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
