:root {
  /* =========================================
     LIGHT THEME & GLASSMORPHISM PALETTE
     ========================================= */

  /* Backgrounds */
  --bg-dark: #e7e7e7; /* White */
  --bg-gradient: linear-gradient(
    135deg,
    #ffffff 0%,
    #f3f4f6 100%
  ); /* White to Gray 100 */

  /* Glass Surface Colors (Dark/Black based opacity for light mode) */
  --glass-surface: rgba(255, 255, 255, 0.7);
  --glass-surface-hover: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(0, 0, 0, 0.05);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);

  /* Text Colors */
  --text-main: #1f2937; /* Gray 800 */
  --text-muted: #6b7280; /* Gray 500 */
  --text-accent: #0ea5e9; /* Sky 500 */

  /* Brand Colors */
  --primary: #3b82f6; /* Blue 500 */
  --primary-hover: #2563eb; /* Blue 600 */
  --primary-glow: rgba(59, 130, 246, 0.2);
  --secondary: #94a3b8; /* Slate 400 */

  /* Functional Colors */
  --danger: #ef4444; /* Red 500 */
  --success: #10b981; /* Emerald 500 */
  --warning: #f59e0b; /* Amber 500 */

  /* Dimensions */
  --radius: 16px;
  --header-height: 80px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif; /* Poppins Font applied */
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* =========================================
   GLASSMORPHISM UTILITIES
   ========================================= */

.glass-panel {
  background: var(--glass-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
}

.glass-header {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    top: 0;
    z-index: 100;
    padding: 0 20px;
}

.glass-input {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-main);
  backdrop-filter: blur(4px);
}

.glass-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
  outline: none;
}

.glass-btn {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.glass-btn:hover:not(:disabled) {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* =========================================
   LAYOUT & GRID
   ========================================= */

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.app-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr; /* Controls smaller, Preview larger */
  gap: 30px;
}

@media (max-width: 900px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   TYPOGRAPHY
   ========================================= */

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--text-main);
  font-weight: 600;
  letter-spacing: -0.5px;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
}
h2 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}
h3 {
  font-size: 1.25rem;
}
p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* =========================================
   BUTTONS
   ========================================= */

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  gap: 8px;
  text-decoration: none;
}

/* Primary Action */
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.23);
}

/* Ghost / Secondary */
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

/* Success */
.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #059669;
}

/* Delete/Danger */
.btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.1rem;
  font-weight: 600;
}

.width-100 {
  width: 100%;
}

button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* =========================================
   HEADER COMPONENTS
   ========================================= */

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.logo-large img {
  border-radius: 16px; /* Smooth corners */
  display: block;
}

/* Photo Counter Badge */
.photo-counter {
  margin-top: 5px;
  font-size: 0.8rem;
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* =========================================
   LOGIN SCREEN
   ========================================= */

.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Decorative background glow for login */
.login-screen::before {
  content: "";
  position: absolute;
  top: -10%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.15) 0%,
    rgba(0, 0, 0, 0) 70%
  );
  z-index: 0;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  text-align: center;
  z-index: 1;
}

.login-input {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  font-size: 1.1rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.whatsapp-button {
  background: #25d366;
  color: white;
  width: 100%;
  margin-top: 10px;
}
.whatsapp-button:hover {
  background: #128c7e;
}

/* =========================================
   INSTRUCTION BANNER
   ========================================= */

.instruction-banner {
  padding: 20px;
  margin-bottom: 30px;
  margin-top: 20px;
  border-left: 4px solid var(--primary);
}

.instruction-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.instruction-icon {
  font-size: 2.5rem;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  padding: 10px;
  border-radius: 50%;
  display: flex;
}

.instruction-banner h3 {
  margin-bottom: 5px;
  color: var(--text-main);
}

.instruction-banner p {
  margin: 0;
  align-items: center;
  font-size: 0.9rem;
}

/* =========================================
   STEPS & PANELS
   ========================================= */

.step-container {
  padding: 24px;
  margin-bottom: 24px;
  transition: opacity 0.3s ease;
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.step-number {
  background: var(--primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
}

.step-description {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* =========================================
   STYLE GRID
   ========================================= */

.style-grid-enhanced {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.style-btn {
  flex-direction: column;
  padding: 20px 10px;
  gap: 12px;
  min-height: 100px;
}

.style-icon {
  font-size: 2.5rem;
  color: var(--text-accent);
}

.style-name {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Selected State for Style Btn (Optional logic in JS can add class) */
.style-btn.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

/* =========================================
   PREVIEW & IMAGES
   ========================================= */

.preview-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.img-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.glass-content {
  /* Inherits glass properties via utility class usually,
     but here we define specific inner content style */
}

.img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* changed from contain to cover for better modern look, or use contain if strict aspect ratio needed */
}

.img-label {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  color: var(--text-main);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.label-primary {
  background: var(--primary); /* Highlight for result label */
  color: white;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8); /* Opaque light overlay */
  color: var(--text-muted);
  z-index: 5;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.5;
}

.placeholder-text {
  font-size: 1rem;
  font-weight: 500;
}

/* =========================================
   ACTIONS & TIPS
   ========================================= */

.actions-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
}

.action-buttons-container {
  display: flex; /* controlled by JS display:none/flex */
  gap: 12px;
  margin-top: 10px;
}

.flex-1 {
  flex: 1;
}
.btn-icon-only {
  padding: 12px;
}

.status-msg {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

.status-msg.error {
  color: var(--danger);
}
.status-msg.success {
  color: var(--success);
}
.status-msg.info {
  color: var(--text-accent);
}

.tip-box {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 16px;
  margin-top: 30px;
  background: rgba(245, 158, 11, 0.05); /* Amber tint */
  border-color: rgba(245, 158, 11, 0.2);
}

.tip-icon {
  color: var(--warning);
  font-size: 1.5rem;
}

/* =========================================
   GALLERY
   ========================================= */

.gallery-section {
  margin-top: 40px;
  padding: 30px;
}

.section-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 15px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border-color: var(--primary);
  z-index: 10;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.empty-gallery {
  text-align: center;
  padding: 60px 0;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.2;
}

/* =========================================
   MODALS
   ========================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85); /* Darker overlay */
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.glass-modal {
  background: #ffffff; /* Solid white for modal bg */
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 0; /* Override step-header margin */
  background: rgba(248, 250, 252, 0.8);
}

.modal-icon {
  font-size: 1.8rem;
  color: var(--primary);
}

.camera-view {
  width: 100%;
  aspect-ratio: 4/5; /* Better for portrait selfies */
  object-fit: cover;
  background: #1f2937;
  display: block;
}

/* Video loading state */
.camera-view:not([srcObject]) {
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-controls {
  padding: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  align-items: center;
  background: #f8fafc;
  border-top: 1px solid var(--glass-border);
}

/* Photo Viewer Modal Specifics */
.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--glass-border);
}

.viewer-body {
  flex: 1;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow: hidden;
  min-height: 300px;
}

.viewer-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.viewer-footer {
  padding: 15px;
  text-align: center;
  border-top: 1px solid var(--glass-border);
}

/* =========================================
   FOOTERS
   ========================================= */

.footer-login,
.footer-app {
  padding: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--secondary);
}

.footer-login a {
  color: var(--primary);
  text-decoration: none;
}
