/* ================================================================
   PHOTOBOTHNE – IMPROVEMENTS STYLESHEET
   CSS cho tất cả tính năng mới
   ================================================================ */

/* ================================================================
   DARK MODE
   ================================================================ */
[data-theme="dark"],
body.dark-mode {
  --bg:       #1a0510;
  --surface:  #2a0a1a;
  --surface2: #3d1028;
  --ink:      #fce4ec;
  --text:     #fce4ec;
  --muted:    #f06292;
  --border:   rgba(233, 30, 140, 0.25);
  --glass:    rgba(60, 10, 40, 0.6);
  --grad-glass: linear-gradient(135deg, rgba(40,8,28,0.8) 0%, rgba(60,10,40,0.6) 100%);
}

[data-theme="dark"] .glass,
body.dark-mode .glass {
  background: rgba(30, 5, 20, 0.7);
  border-color: rgba(233, 30, 140, 0.2);
}

/* Dark mode toggle button */
#dark-mode-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
  backdrop-filter: blur(12px);
}
#dark-mode-toggle:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.1);
}

/* ================================================================
   PROGRESS OVERLAY
   ================================================================ */
#pb-processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#pb-processing-overlay.active {
  display: flex;
  opacity: 1;
}
.pb-proc-box {
  background: var(--surface, #fff);
  border-radius: 24px;
  padding: 40px 48px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  border: 1px solid var(--border, rgba(233,30,140,.2));
  min-width: 260px;
  animation: scaleIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.pb-proc-spinner {
  margin: 0 auto 16px;
  width: 48px;
  height: 48px;
}
.pb-proc-circle {
  transform-origin: 25px 25px;
  animation: pb-spin 1s linear infinite, pb-dash 1.5s ease-in-out infinite;
}
@keyframes pb-spin {
  100% { transform: rotate(360deg); }
}
@keyframes pb-dash {
  0%   { stroke-dashoffset: 94; }
  50%  { stroke-dashoffset: 24; }
  100% { stroke-dashoffset: 94; }
}
.pb-proc-label {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--text, #3d0020);
  margin-bottom: 8px;
  font-weight: 700;
}
.pb-proc-bar-wrap {
  width: 100%;
  height: 4px;
  background: var(--surface2, #fce4ec);
  border-radius: 2px;
  overflow: hidden;
  margin: 12px 0 8px;
}
.pb-proc-bar {
  height: 100%;
  background: var(--grad-main, linear-gradient(135deg,#880e4f,#e91e8c));
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}
.pb-proc-sub {
  font-size: 0.78rem;
  color: var(--muted, #c2185b);
}

/* ================================================================
   VOICE CONTROL BUTTON
   ================================================================ */
#btn-voice-shoot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}
#btn-voice-shoot:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(233, 30, 140, 0.08);
}
#btn-voice-shoot.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  animation: voice-pulse 1.2s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233,30,140,0.5); }
  50%       { box-shadow: 0 0 0 10px rgba(233,30,140,0); }
}

/* ================================================================
   GIF/BOOMERANG EXPORT BUTTONS
   ================================================================ */
.pb-export-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.pb-export-btn {
  flex: 1;
  min-width: 100px;
  padding: 9px 14px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.25s;
}
.pb-export-btn:hover {
  border-color: var(--accent);
  background: rgba(233, 30, 140, 0.08);
  color: var(--accent);
  transform: translateY(-2px);
}
.pb-export-btn.primary {
  background: var(--grad-main);
  color: #fff;
  border-color: transparent;
}
.pb-export-btn.primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

/* ================================================================
   MODAL OVERLAY (dùng chung)
   ================================================================ */
.pb-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99980;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pb-modal-overlay.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}
.pb-modal-box {
  background: var(--surface, #fdf0f5);
  border: 1px solid var(--border, rgba(233,30,140,.2));
  border-radius: 24px;
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(136, 14, 79, 0.25);
  animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ================================================================
   BEFORE/AFTER FILTER COMPARE
   ================================================================ */
.pb-compare-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  user-select: none;
  line-height: 0;
}
#pb-compare-before,
#pb-compare-after {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
}
#pb-compare-after {
  position: absolute;
  top: 0;
  left: 0;
  clip-path: inset(0 50% 0 0);
}
.pb-compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  cursor: ew-resize;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}
.pb-compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  font-weight: 700;
}

/* ================================================================
   REAL REVIEW SYSTEM
   ================================================================ */
.pb-review-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 32px;
}
.pb-review-form h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--text);
}
.pb-form-group {
  margin-bottom: 16px;
}
.pb-form-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  font-weight: 700;
}
.pb-form-input,
.pb-form-textarea,
.pb-form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface2, rgba(255,255,255,0.05));
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.pb-form-input:focus,
.pb-form-textarea:focus {
  border-color: var(--accent);
}
.pb-form-textarea {
  resize: vertical;
  min-height: 90px;
}
.pb-star-input-row {
  display: flex;
  gap: 6px;
  margin: 4px 0;
}
.pb-star-btn {
  font-size: 1.6rem;
  cursor: pointer;
  background: none;
  border: none;
  color: rgba(200,200,200,0.4);
  transition: color 0.15s, transform 0.15s;
  line-height: 1;
}
.pb-star-btn:hover {
  transform: scale(1.2);
}
.pb-submit-review-btn {
  width: 100%;
  padding: 13px;
  border-radius: 50px;
  border: none;
  background: var(--grad-main, linear-gradient(135deg,#880e4f,#e91e8c));
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 0.02em;
}
.pb-submit-review-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(233, 30, 140, 0.35);
}

/* Review cards */
#pb-real-reviews-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.pb-review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  transition: all 0.25s;
  animation: fadeUp 0.4s ease both;
}
.pb-review-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(233, 30, 140, 0.3);
}
.pb-review-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.pb-review-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--grad-main, linear-gradient(135deg,#880e4f,#e91e8c));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}
.pb-review-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}
.pb-review-date {
  font-size: 0.72rem;
  color: var(--muted);
}
.pb-review-stars {
  margin-left: auto;
  line-height: 1;
}
.pb-review-text {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  font-style: italic;
}
.pb-review-tag {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 10px;
  background: rgba(233, 30, 140, 0.1);
  border: 1px solid rgba(233, 30, 140, 0.2);
  border-radius: 50px;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

/* ================================================================
   USER-GENERATED FRAMES
   ================================================================ */
.pb-ugf-section {
  margin-top: 24px;
}
.pb-ugf-upload-zone {
  border: 2px dashed rgba(233, 30, 140, 0.3);
  border-radius: 16px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: rgba(233, 30, 140, 0.03);
  position: relative;
}
.pb-ugf-upload-zone:hover,
.pb-ugf-upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(233, 30, 140, 0.08);
}
.pb-ugf-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.pb-ugf-upload-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  opacity: 0.6;
}
.pb-ugf-upload-label {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}
.pb-ugf-upload-sub {
  font-size: 0.72rem;
  color: var(--muted);
}
#pb-ugf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.pb-ugf-item {
  position: relative;
  cursor: pointer;
  border-radius: 12px;
  border: 2px solid var(--border);
  padding: 8px;
  background: var(--surface);
  transition: all 0.2s;
}
.pb-ugf-item:hover {
  border-color: var(--accent);
  transform: scale(1.04);
}
.pb-ugf-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.pb-ugf-item:hover .pb-ugf-delete {
  display: flex;
}

/* ================================================================
   CAMERA ERROR BOX
   ================================================================ */
#pb-cam-error-box {
  display: none;
  position: absolute;
  inset: 0;
  background: var(--surface, #fdf0f5);
  border-radius: 16px;
  z-index: 10;
  align-items: center;
  justify-content: center;
}

/* ================================================================
   QR MODAL
   ================================================================ */
#pb-qr-modal .pb-modal-box {
  text-align: center;
}
#pb-qr-code canvas,
#pb-qr-code img {
  border-radius: 12px;
  border: 8px solid #fff;
  box-shadow: var(--shadow-md);
}

/* ================================================================
   SHARE BUTTON
   ================================================================ */
.pb-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.25s;
}
.pb-share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ================================================================
   TIMER OPTIONS CUSTOM
   ================================================================ */
.pb-timer-opts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pb-timer-opt {
  padding: 6px 14px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Fira Code', monospace;
  transition: all 0.2s;
}
.pb-timer-opt:hover,
.pb-timer-opt.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(233, 30, 140, 0.1);
}

/* ================================================================
   RESPONSIVE FIXES
   ================================================================ */
@media (max-width: 640px) {
  .pb-modal-box {
    padding: 20px 16px;
    border-radius: 20px;
  }
  #pb-real-reviews-list {
    grid-template-columns: 1fr;
  }
  .pb-review-form {
    padding: 20px 16px;
  }
  #dark-mode-toggle {
    top: auto;
    bottom: 80px;
    right: 12px;
  }
}

/* ================================================================
   FIX CSS DUPLICATE – override lại các rule bị trùng
   ================================================================ */
/* Reset thống nhất (override các lần khai báo trùng) */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Scrollbar đồng nhất */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--rose-400, #f06292), var(--rose-600, #c2185b));
  border-radius: 10px;
}