/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #0284c7; /* Sky 600 */
  --primary-hover: #0369a1; /* Sky 700 */
  --primary-light: #e0f2fe; /* Sky 100 */
  --secondary: #3b82f6; /* Blue 500 */
  --accent: #f59e0b;
  --bg: #f0f9ff; /* Sky 50 */
  --bg-gradient: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
  --bg2: #ffffff;
  --bg3: rgba(255, 255, 255, 0.85);
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #bae6fd; /* Sky 200 */
  --text: #0f172a; /* Slate 900 */
  --text2: #334155; /* Slate 700 */
  --text3: #64748b; /* Slate 500 */
  --danger: #ef4444;
  --success: #10b981;
  --wa: #25D366;
  --trans: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.1), 0 8px 16px -6px rgba(2, 132, 199, 0.05);
  --shadow-lg: 0 20px 40px -15px rgba(2, 132, 199, 0.2);
  --radius: 16px;
}

body {
  font-family: 'Outfit', -apple-system, sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
}
.hidden { display: none !important; }

/* ============ SPLASH SCREEN ============ */
.splash-screen {
  position: fixed; inset: 0; background: var(--bg-gradient); display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 1000;
  transition: opacity 0.5s ease;
}
.splash-screen.exiting { opacity: 0; pointer-events: none; }
.splash-bg {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6;
}
.blob-1 { width: 300px; height: 300px; background: #38bdf8; top: 10%; left: 10%; }
.blob-2 { width: 400px; height: 400px; background: #7dd3fc; bottom: 10%; right: 10%; }
.blob-3 { width: 250px; height: 250px; background: #93c5fd; top: 50%; left: 60%; }

.splash-content { text-align: center; max-width: 600px; padding: 40px; z-index: 10; }
.logo-icon { width: 120px; height: 120px; margin: 0 auto 20px; filter: drop-shadow(0 8px 16px rgba(2, 132, 199, 0.2)); }
.logo-icon.sm { width: 36px; height: 36px; margin: 0; }
.logo-text h1 { font-size: 48px; font-family: 'Outfit'; color: var(--primary); line-height: 1.1; font-weight: 900; }
.logo-text span { font-size: 20px; color: var(--secondary); letter-spacing: 4px; font-family: 'Outfit'; font-weight: 800; }
.splash-tagline { color: var(--text2); font-size: 16px; margin: 20px 0; font-weight: 500; }
.splash-features { display: flex; gap: 12px; justify-content: center; margin-bottom: 30px; flex-wrap: wrap; }
.feat-chip { background: var(--bg2); padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; color: var(--text2); display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.splash-note { color: var(--text3); font-size: 12px; margin-top: 16px; }

/* Button Styles */
.btn-primary { 
  background: linear-gradient(135deg, var(--primary), var(--secondary)); 
  color: #fff; 
  border: none; 
  padding: 12px 24px; 
  border-radius: 12px; 
  font-size: 16px; 
  font-weight: 600; 
  cursor: pointer; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 8px; 
  transition: var(--trans); 
  font-family: 'Outfit'; 
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35); 
}
.btn-primary:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45); 
}
.btn-xl { padding: 16px 36px; font-size: 18px; border-radius: 16px; }

.btn-secondary { 
  background: var(--bg2); 
  color: var(--text); 
  border: 1px solid var(--border); 
  padding: 12px 24px; 
  border-radius: 12px; 
  font-size: 14px; 
  font-weight: 600; 
  cursor: pointer; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 8px; 
  transition: var(--trans); 
  font-family: 'Outfit'; 
  box-shadow: var(--shadow);
}
.btn-secondary:hover { background: var(--surface2); border-color: var(--primary); color: var(--primary); }

.btn-ghost { 
  background: transparent; 
  color: var(--text2); 
  border: 1px solid transparent; 
  padding: 8px 16px; 
  border-radius: 8px; 
  cursor: pointer; 
  font-size: 14px; 
  font-family: 'Outfit'; 
  font-weight: 600; 
  transition: var(--trans); 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
}
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }

/* ============ APP STRUCTURE ============ */
.app { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }
.app-header { 
  height: 70px; 
  background: var(--bg3); 
  border-bottom: 1px solid var(--border); 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding: 0 24px; 
  backdrop-filter: blur(16px); 
  box-shadow: 0 4px 20px rgba(2, 132, 199, 0.05);
  z-index: 10;
}
.header-logo { display: flex; align-items: center; gap: 12px; }
.header-brand { font-size: 18px; color: var(--text); font-family: 'Outfit'; font-weight: 600; }
.header-brand strong { color: var(--primary); font-weight: 800; }
.header-actions { display: flex; gap: 12px; }
.badge { background: var(--primary); color: #fff; border-radius: 20px; padding: 2px 8px; font-size: 11px; font-weight: 700; margin-left: 6px; }

.app-main { display: grid; grid-template-columns: 85px 1fr 360px; flex: 1; min-height: 0; }

/* ============ SIDE NAVIGATION ============ */
.side-nav { 
  background: var(--bg3); 
  border-right: 1px solid var(--border); 
  padding: 20px 0; 
  display: flex; 
  flex-direction: column; 
  gap: 16px; 
  align-items: center; 
  backdrop-filter: blur(16px);
}
.nav-btn { 
  width: 68px; 
  height: 68px; 
  border: none; 
  background: transparent; 
  color: var(--text2); 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  border-radius: 14px; 
  cursor: pointer; 
  transition: var(--trans); 
  font-size: 11px; 
  font-weight: 700; 
  font-family: 'Outfit'; 
}
.nav-btn:hover { background: var(--primary-light); color: var(--primary); }
.nav-btn.active { 
  background: var(--primary-light); 
  color: var(--primary); 
  box-shadow: inset 4px 0 0 var(--primary); 
}
.nav-icon { font-size: 24px; margin-bottom: 4px; }

/* ============ CAMERA SECTION ============ */
.camera-section { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  padding: 24px; 
  background: radial-gradient(rgba(2, 132, 199, 0.05) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  overflow-y: auto;
}
.camera-wrapper { width: 100%; max-width: 680px; display: flex; flex-direction: column; gap: 20px; }

/* ============ SNAPEDIT-STYLE LAYOUT PICKER ============ */
.snapedit-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.picker-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.picker-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pill-selector {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 3px;
}
.pill-btn {
  border: none;
  background: transparent;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  transition: var(--trans);
  font-family: 'Outfit';
}
.pill-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.layouts-scroll-container {
  position: relative;
  width: 100%;
}
.layouts-scroll-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 10px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-light) transparent;
}
.layouts-scroll-list::-webkit-scrollbar {
  height: 6px;
}
.layouts-scroll-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}
.layout-card {
  flex: 0 0 95px;
  height: 125px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  transition: var(--trans);
  position: relative;
}
.layout-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.layout-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}
.layout-card-preview {
  width: 100%;
  height: 75px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  padding: 4px;
  gap: 3px;
}
.layout-card-preview div {
  background: #e2e8f0;
  border-radius: 2px;
  transition: var(--trans);
}
.layout-card.active .layout-card-preview div {
  background: #bae6fd;
}
.layout-card-label {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.layout-card.active .layout-card-label {
  color: var(--primary);
}

/* ============ CAMERA VIEWPORT ============ */
.camera-viewport { 
  position: relative; 
  width: 100%; 
  aspect-ratio: 4/3; 
  background: #000; 
  border-radius: var(--radius); 
  overflow: hidden; 
  box-shadow: var(--shadow-lg); 
  border: 3px solid #fff; 
}
.camera-viewport video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.camera-viewport video.no-mirror { transform: scaleX(1); }
.filter-overlay, .frame-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; background-size: cover; background-position: center; }
.filter-overlay { mix-blend-mode: multiply; opacity: 0; }
.countdown-display { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: 0.2s; background: rgba(0,0,0,0.3); }
.countdown-display.active { opacity: 1; }
#countdown-number { font-size: 120px; font-weight: 900; color: #fff; text-shadow: 0 4px 20px rgba(0,0,0,0.5); font-family: 'Outfit'; animation: pop 1s infinite; }
@keyframes pop { 0% { transform: scale(1.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.flash-effect { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity 0.05s; }
.flash-effect.active { opacity: 1; }

.camera-status { 
  position: absolute; 
  top: 16px; 
  left: 16px; 
  background: rgba(255,255,255,0.9); 
  backdrop-filter: blur(8px); 
  padding: 6px 14px; 
  border-radius: 20px; 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  font-size: 12px; 
  font-weight: 800; 
  color: var(--primary); 
  border: 1px solid var(--border); 
  box-shadow: var(--shadow);
}
.status-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; animation: blink 1.2s infinite ease-in-out; }
.status-dot.capturing { background: var(--accent); animation: none; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.flip-btn, .mirror-btn { 
  position: absolute; 
  bottom: 16px; 
  width: 44px; 
  height: 44px; 
  background: rgba(255,255,255,0.9); 
  backdrop-filter: blur(8px); 
  border: 1px solid var(--border); 
  border-radius: 50%; 
  color: var(--text2); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  transition: var(--trans); 
  box-shadow: var(--shadow);
}
.flip-btn { right: 70px; }
.mirror-btn { right: 16px; }
.flip-btn:hover, .mirror-btn:hover { background: var(--primary-light); color: var(--primary); transform: scale(1.1); }

/* Capture Controls */
.capture-controls { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 16px; 
  background: var(--bg3); 
  padding: 20px; 
  border-radius: var(--radius); 
  border: 1px solid var(--border); 
  backdrop-filter: blur(16px); 
  box-shadow: var(--shadow);
}
.capture-row { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 460px; }
.timer-selector, .mirror-quality { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  background: var(--surface2); 
  padding: 10px 16px; 
  border-radius: 12px; 
  border: 1px solid var(--border); 
  font-size: 14px; 
}
.timer-selector select, .mirror-quality select { 
  background: transparent; 
  color: var(--text); 
  border: none; 
  outline: none; 
  cursor: pointer; 
  font-family: 'Outfit'; 
  font-weight: 700; 
  font-size: 14px; 
}
.timer-selector select option, .mirror-quality select option { background: var(--bg2); color: var(--text); }

.capture-btn { 
  width: 84px; 
  height: 84px; 
  border-radius: 50%; 
  background: transparent; 
  border: 4px solid var(--border); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  padding: 0; 
  outline: none; 
  transition: var(--trans); 
}
.capture-btn:hover { border-color: var(--primary); }
.capture-btn-inner { 
  width: 66px; 
  height: 66px; 
  border-radius: 50%; 
  background: linear-gradient(135deg, var(--primary), var(--secondary)); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  color: #fff; 
  transition: 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4); 
}
.capture-btn:hover .capture-btn-inner { transform: scale(0.92); box-shadow: 0 2px 8px rgba(2, 132, 199, 0.5); }
.capture-btn:active .capture-btn-inner { transform: scale(0.85); }
.capture-info { display: flex; gap: 24px; color: var(--text2); font-size: 13px; font-weight: 600; font-family: 'Outfit'; }

/* ============ TOOLS PANEL ============ */
.tools-panel { background: var(--bg3); border-left: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; backdrop-filter: blur(16px); }
.tool-content { display: none; flex-direction: column; height: 100%; }
.tool-content.active { display: flex; }
.panel-header { padding: 20px 24px; border-bottom: 1px solid var(--border); background: rgba(2, 132, 199, 0.03); }
.panel-header h2 { font-size: 16px; font-weight: 800; color: var(--primary); margin: 0; font-family: 'Outfit'; }
.panel-body { padding: 20px 24px; flex: 1; overflow-y: auto; }

/* Filter Tabs */
.filter-tab-row { display: flex; background: var(--surface2); border-radius: 10px; padding: 4px; margin-bottom: 20px; border: 1px solid var(--border); }
.ftab { flex: 1; border: none; background: transparent; padding: 10px; color: var(--text2); border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 700; font-family: 'Outfit'; transition: var(--trans); }
.ftab:hover { color: var(--primary); }
.ftab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* Grids */
.filter-grid, .frame-grid, .bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sticker-grid, .strip-color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.filter-item, .frame-item, .bg-item, .sticker-item { 
  aspect-ratio: 1; 
  border-radius: 12px; 
  overflow: hidden; 
  position: relative; 
  cursor: pointer; 
  border: 2px solid var(--border); 
  background: var(--surface); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 24px; 
  transition: var(--trans); 
  box-shadow: var(--shadow);
}
.filter-item:hover, .frame-item:hover, .bg-item:hover, .sticker-item:hover { transform: translateY(-2px); border-color: var(--primary); }
.filter-item.active, .frame-item.active, .bg-item.active { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15); }
.filter-label { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,0.9); backdrop-filter: blur(4px); font-size: 10px; font-weight: 700; text-align: center; padding: 6px 4px; color: var(--text); font-family: 'Outfit'; border-top: 1px solid var(--border); }
.scolor-item { height: 44px; border-radius: 10px; border: 2px solid var(--border); cursor: pointer; transition: var(--trans); box-shadow: var(--shadow); }
.scolor-item:hover { transform: translateY(-2px); border-color: var(--primary); }
.scolor-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15); }

/* Adjustments */
.adj-sliders { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.adj-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text); }
.adj-row label { width: 100px; display: flex; align-items: center; gap: 6px; }
.adj-row input { flex: 1; margin: 0 12px; accent-color: var(--primary); height: 6px; background: var(--border); border-radius: 3px; outline: none; -webkit-appearance: none; }
.adj-row input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); cursor: pointer; border: 2px solid #fff; box-shadow: var(--shadow); }
.adj-val { width: 30px; text-align: right; color: var(--primary); font-family: monospace; font-weight: bold; }
.btn-reset-adj { width: 100%; background: var(--surface); color: var(--text2); border: 1px solid var(--border); padding: 10px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 700; font-family: 'Outfit'; transition: var(--trans); box-shadow: var(--shadow); }
.btn-reset-adj:hover { background: var(--primary-light); color: var(--danger); border-color: var(--danger); }

/* Text Area */
.text-input-area input[type="text"] { width: 100%; background: var(--surface); border: 1px solid var(--border); padding: 12px; border-radius: 8px; color: var(--text); outline: none; font-family: 'Outfit'; transition: var(--trans); box-shadow: var(--shadow); }
.text-input-area input[type="text"]:focus { border-color: var(--primary); }
.text-color-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
.text-color-row select { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 6px 10px; border-radius: 6px; outline: none; cursor: pointer; }
.text-color-row input[type="color"] { width: 36px; height: 36px; padding: 0; border: none; border-radius: 6px; cursor: pointer; background: transparent; }
.text-color-row input[type="range"] { flex: 1; accent-color: var(--primary); }

/* ============ RESULT MODAL ============ */
.result-modal { position: fixed; inset: 0; z-index: 600; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(16px); opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.result-modal.active { opacity: 1; pointer-events: auto; }
.result-modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; width: 90%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); transform: translateY(20px); transition: transform 0.3s ease; }
.result-modal.active .result-modal-card { transform: translateY(0); }
.result-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--surface2); }
.result-header h2 { font-size: 18px; font-weight: 800; color: var(--primary); margin: 0; font-family: 'Outfit'; }
.result-preview { padding: 24px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 16px; background: radial-gradient(rgba(2, 132, 199, 0.05) 1.5px, transparent 1.5px); background-size: 20px 20px; }
.result-preview canvas, .result-preview img { max-width: 100%; max-height: 50vh; border-radius: 8px; box-shadow: var(--shadow-lg); border: 4px solid #fff; }
.result-actions { padding: 20px 24px; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: var(--surface2); }
.result-actions button { width: 100%; justify-content: center; }
.btn-wa { background: var(--wa); color: #fff; border: none; padding: 12px 24px; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: var(--trans); font-family: 'Outfit'; box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3); }
.btn-wa:hover { background: #1ebd50; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4); }
.btn-drive { background: #fff; color: var(--text); border: 1px solid var(--border); padding: 12px 24px; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: var(--trans); font-family: 'Outfit'; box-shadow: var(--shadow); }
.btn-drive:hover { background: var(--surface2); border-color: var(--primary); transform: translateY(-2px); }
.btn-accent { background: var(--accent); color: #fff; border: none; padding: 12px 24px; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: var(--trans); font-family: 'Outfit'; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.btn-accent:hover { background: #d97706; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4); }

/* ============ GALLERY ============ */
.gallery-drawer { position: fixed; top: 0; bottom: 0; right: -400px; width: 400px; max-width: 100%; background: var(--bg2); border-left: 1px solid var(--border); backdrop-filter: blur(20px); z-index: 500; display: flex; flex-direction: column; transition: right 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); box-shadow: -10px 0 30px rgba(2, 132, 199, 0.1); }
.gallery-drawer.open { right: 0; }
.gallery-drawer-header { padding: 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--surface2); }
.gallery-drawer-header h2 { font-size: 18px; font-weight: 800; color: var(--primary); margin: 0; font-family: 'Outfit'; }
.gallery-grid { padding: 24px; overflow-y: auto; flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-content: start; }
.gallery-item { position: relative; border-radius: 12px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow); border: 2px solid var(--border); transition: var(--trans); }
.gallery-item:hover { transform: scale(1.05); z-index: 2; border-color: var(--primary); box-shadow: var(--shadow-lg); }
.gallery-item img { width: 100%; display: block; }
.gallery-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.3); z-index: 490; opacity: 0; pointer-events: none; transition: 0.3s; }
.gallery-overlay.active { opacity: 1; pointer-events: auto; }
.gallery-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text3); text-align: center; }
.gallery-empty .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

/* ============ QR MODAL ============ */
.qr-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -40%); background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 32px; z-index: 700; opacity: 0; pointer-events: none; transition: 0.3s; text-align: center; box-shadow: var(--shadow-lg); width: 90%; max-width: 400px; }
.qr-modal.active { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.qr-code-wrapper { background: #fff; padding: 16px; border-radius: 16px; display: inline-block; margin-bottom: 24px; border: 1px solid var(--border); }
.qr-info { color: var(--text); font-size: 14px; }
.qr-countdown-bar { background: var(--surface2); padding: 8px 16px; border-radius: 20px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; border: 1px solid var(--border); }
.qr-countdown-bar #qr-timer { color: var(--primary); font-size: 16px; }
.qr-actions { display: flex; flex-direction: column; gap: 12px; }
.qr-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 690; opacity: 0; pointer-events: none; transition: 0.3s; }
.qr-overlay.active { opacity: 1; pointer-events: auto; }

/* ============ REVIEW & LIGHTBOX ============ */
.lightbox { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(10px); z-index: 800; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: 0.3s; }
.lightbox.active { opacity: 1; pointer-events: auto; }
.lightbox-content { text-align: center; max-width: 90%; max-height: 90%; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.lightbox-content img { max-height: 70vh; border-radius: 12px; border: 4px solid #fff; box-shadow: var(--shadow-lg); }
.lightbox-actions { display: flex; gap: 12px; }

.review-modal { position: fixed; inset: 0; z-index: 750; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(16px); opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.review-modal.active { opacity: 1; pointer-events: auto; }
.review-card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; width: 90%; max-width: 440px; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.review-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--surface2); }
.review-header h2 { font-size: 16px; font-weight: 800; color: var(--primary); margin: 0; }
.review-preview { padding: 20px; display: flex; justify-content: center; background: var(--surface2); }
.review-preview canvas, .review-preview img { max-height: 35vh; border-radius: 8px; border: 3px solid #fff; box-shadow: var(--shadow); }
.review-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.star-section { text-align: center; }
.star-label { font-size: 13px; font-weight: 700; color: var(--text2); margin-bottom: 8px; }
.star-row { display: flex; justify-content: center; gap: 6px; font-size: 28px; cursor: pointer; }
.star { color: var(--border); transition: var(--trans); }
.star.active { color: var(--accent); }
.star-text { font-size: 11px; color: var(--text3); font-weight: 700; display: block; margin-top: 6px; }
.review-note-wrap textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-family: inherit; font-size: 13px; outline: none; resize: none; box-shadow: var(--shadow); }
.review-note-wrap textarea:focus { border-color: var(--primary); }
.review-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.review-actions button { justify-content: center; font-size: 12px; padding: 10px; }
.review-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 740; opacity: 0; pointer-events: none; transition: 0.3s; }
.review-overlay.active { opacity: 1; pointer-events: auto; }

/* ============ DRIVE PROGRESS ============ */
.drive-progress { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.3); backdrop-filter: blur(10px); z-index: 900; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: 0.3s; }
.drive-progress.active { opacity: 1; pointer-events: auto; }
.drive-progress-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 24px; width: 320px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 16px; }
.drive-spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s infinite linear; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.drive-prog-title { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.drive-prog-bar-wrap { width: 180px; height: 6px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.drive-prog-bar { height: 100%; width: 0%; background: var(--primary); transition: width 0.1s linear; }
.drive-prog-pct { font-size: 11px; font-weight: 800; color: var(--primary); margin-top: 4px; text-align: right; }

/* ============ PHOTO EDITOR MODAL ============ */
.photo-editor-modal { position: fixed; inset: 0; z-index: 800; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.photo-editor-modal.active { opacity: 1; pointer-events: auto; }
.photo-editor-card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; width: 95%; max-width: 700px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.editor-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--surface2); }
.editor-header h2 { font-size: 16px; font-weight: 800; color: var(--primary); margin: 0; }
.editor-body { display: flex; gap: 20px; padding: 20px; overflow-y: auto; flex: 1; }
.editor-canvas-wrapper { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(45deg, var(--surface2) 25%, transparent 25%, transparent 75%, var(--surface2) 75%, var(--surface2)), linear-gradient(45deg, var(--surface2) 25%, transparent 25%, transparent 75%, var(--surface2) 75%, var(--surface2)); background-size: 20px 20px; background-position: 0 0, 10px 10px; background-color: var(--bg); border-radius: 12px; border: 2px solid var(--border); overflow: hidden; }
.editor-canvas { display: block; max-width: 100%; max-height: 100%; }
.editor-frame-guide { position: absolute; inset: 0; border: 3px dashed rgba(34, 197, 94, 0.5); border-radius: 8px; pointer-events: none; }
.editor-controls { width: 220px; display: flex; flex-direction: column; gap: 20px; }
.control-section { padding: 12px; background: var(--surface2); border-radius: 12px; border: 1px solid var(--border); }
.control-section h3 { font-size: 12px; font-weight: 800; color: var(--primary); margin: 0 0 12px 0; text-transform: uppercase; }
.control-group { margin-bottom: 12px; }
.control-group:last-child { margin-bottom: 0; }
.control-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.slider-with-value { display: flex; align-items: center; gap: 10px; }
.slider-with-value input { flex: 1; }
.slider-with-value span { font-size: 12px; font-weight: 700; color: var(--primary); min-width: 40px; text-align: right; }
.rotate-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; align-items: center; }
.rotate-buttons span { text-align: center; font-size: 12px; font-weight: 700; color: var(--text2); }
.position-buttons { display: flex; justify-content: center; margin-bottom: 6px; }
.btn-sm { padding: 6px 10px; font-size: 11px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; transition: var(--trans); }
.btn-sm:hover { background: var(--primary-light); border-color: var(--primary); }
.editor-actions { display: flex; gap: 12px; padding: 16px; border-top: 1px solid var(--border); background: var(--surface2); justify-content: flex-end; }
.photo-editor-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 790; opacity: 0; pointer-events: none; transition: 0.3s; }
.photo-editor-overlay.active { opacity: 1; pointer-events: auto; }

/* Responsive adjustments */
@media (max-width: 962px) {
  .app-main { grid-template-columns: 1fr; }
  .side-nav { display: none; }
  .tools-panel { display: none; }
}
