/* Google Fonts: Outfit and Plus Jakarta Sans */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables for Premium Dark/Glassmorphism Palette */
:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  --bg-gradient: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0f0715 50%, #050209 100%);
  --accent-primary: #8b5cf6; /* Violet */
  --accent-primary-rgb: 139, 92, 246;
  --accent-secondary: #ec4899; /* Pink */
  --accent-secondary-rgb: 236, 72, 153;
  --accent-glow: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  
  --glass-bg: rgba(17, 12, 28, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(139, 92, 246, 0.4);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;
  
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glow-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
  --border-radius: 20px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Core Setup */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Base Wrapper & Container */
.app-container {
  width: 100%;
  max-width: 1100px;
  padding: 2.5rem 1.5rem;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
}

/* Header Section */
header {
  text-align: center;
  margin-bottom: 0.5rem;
}

header h1 {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--accent-glow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 2px 8px rgba(139, 92, 246, 0.3));
}

header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* Glassmorphic Tabs Navigation */
.tabs-nav {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 100px;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--accent-glow);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* Glass Cards & Layout */
.panels-container {
  width: 100%;
  position: relative;
  min-height: 580px;
}

.panel {
  display: none;
  animation: fadeIn 0.5s ease-out forwards;
}

.panel.active {
  display: grid;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--card-shadow);
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  position: relative;
}

/* Border decorative glow */
.card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.05), rgba(139, 92, 246, 0.05), rgba(236, 72, 153, 0.2));
  z-index: -1;
  pointer-events: none;
}

/* Dashboard Split Grid for Settings panel */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.dashboard-grid .card {
  margin: 0;
  max-width: none;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* Rating Widget (Stars & Emojis) */
.rating-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.rating-stars {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  gap: 0.75rem;
}

.rating-stars input {
  display: none;
}

.rating-stars label {
  font-size: 2.25rem;
  color: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.rating-stars label:hover,
.rating-stars label:hover ~ label,
.rating-stars input:checked ~ label {
  color: #fbbf24; /* Warm Gold */
  transform: scale(1.15);
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.rating-stars label:active {
  transform: scale(0.9);
}

.rating-label-display {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fbbf24;
  height: 1.5rem;
  transition: var(--transition-smooth);
}

/* Type Grid Selector */
.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.type-option {
  position: relative;
}

.type-option input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.type-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 0.5rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.type-option label i {
  font-size: 1.25rem;
  transition: var(--transition-smooth);
}

.type-option input:checked + label {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-main);
  box-shadow: var(--glow-shadow);
}

.type-option input:checked + label i {
  transform: translateY(-2px);
  color: var(--accent-primary);
}

.type-option label:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.95rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--accent-glow);
  color: #fff;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Alert Notification Guide */
.alert-box {
  background: rgba(139, 92, 246, 0.1);
  border-left: 4px solid var(--accent-primary);
  padding: 1rem;
  border-radius: 0 12px 12px 0;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.alert-box h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--accent-primary);
}

.alert-box p {
  color: var(--text-muted);
}

.alert-box code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  color: var(--accent-secondary);
}

/* Settings Controls */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Live QR Preview Card */
.qr-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--glass-border);
  border-radius: var(--border-radius);
  padding: 2rem;
}

.qr-box {
  background: #fff;
  padding: 1.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: inline-block;
  margin-bottom: 1.5rem;
  transition: var(--transition-smooth);
}

.qr-box:hover {
  transform: scale(1.03);
}

.qr-box canvas {
  display: block;
  max-width: 100%;
}

.qr-meta {
  margin-bottom: 1.5rem;
}

.qr-meta h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.qr-meta p {
  color: var(--text-muted);
  font-size: 0.85rem;
  word-break: break-all;
}

/* Footer Section */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  width: 100%;
  margin-top: 3rem;
}

footer a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: var(--transition-smooth);
}

footer a:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

/* Success Overlay Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 2, 9, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease-out;
}

.modal-card {
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 3rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: scaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUp {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.success-icon-wrapper {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, rgba(139, 92, 246, 0.02) 70%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem auto;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.success-icon-wrapper i {
  font-size: 2.5rem;
  color: var(--accent-primary);
}

.modal-card h2 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.modal-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* PRINT PREVIEW MODE (Screen Visual) */
.flyer-preview-container {
  display: none;
  background: #fff;
  color: #000;
  width: 100%;
  max-width: 600px;
  margin: 2rem auto;
  padding: 3rem;
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.5);
  border: 1px solid #ddd;
  text-align: center;
  animation: fadeIn 0.4s ease-out;
}

.flyer-preview-container.active {
  display: block;
}

.flyer-header {
  margin-bottom: 2.5rem;
}

.flyer-header h2 {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  color: #1e1b4b;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.flyer-header p {
  color: #4b5563;
  font-size: 1.1rem;
  font-weight: 500;
}

.flyer-qr-wrapper {
  margin: 2.5rem 0;
  display: inline-block;
  padding: 1.5rem;
  background: #f9fafb;
  border: 2px dashed #d1d5db;
  border-radius: 16px;
}

.flyer-qr-wrapper img, .flyer-qr-wrapper canvas {
  width: 240px;
  height: 240px;
  display: block;
}

.flyer-instructions {
  margin-top: 2rem;
}

.flyer-instructions h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: #1e1b4b;
  margin-bottom: 0.25rem;
}

.flyer-instructions p {
  color: #6b7280;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.flyer-url {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: #f5f3ff;
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  display: inline-block;
  word-break: break-all;
}

.flyer-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  width: 100%;
}

.flyer-actions button {
  width: auto;
  min-width: 140px;
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  header h1 {
    font-size: 2.2rem;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .type-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   PRINT STYLES: This converts the page to a single flyer when printing
   ========================================================================== */
@media print {
  /* Hide all browser interface elements, headers, buttons, setting panels, etc. */
  body {
    background: #ffffff !important;
    color: #000000 !important;
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .app-container,
  header,
  .tabs-nav,
  .panels-container,
  .modal-overlay,
  footer {
    display: none !important;
  }

  /* Show ONLY the print flyer container */
  .flyer-preview-container {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    max-width: 100% !important;
    border: none !important;
    box-shadow: none !important;
    padding: 3.5cm 2cm !important;
    margin: 0 !important;
    background: #fff !important;
    color: #000 !important;
    page-break-inside: avoid;
  }

  .flyer-actions {
    display: none !important; /* Hide print/close buttons inside the flyer */
  }

  .flyer-header h2 {
    color: #000000 !important;
    font-size: 2.75rem !important;
    margin-bottom: 0.75rem !important;
  }

  .flyer-header p {
    color: #333333 !important;
    font-size: 1.3rem !important;
  }

  .flyer-qr-wrapper {
    background: #ffffff !important;
    border: 3px dashed #000000 !important;
    padding: 2rem !important;
    margin: 3.5rem 0 !important;
  }

  .flyer-qr-wrapper img, 
  .flyer-qr-wrapper canvas {
    width: 320px !important;
    height: 320px !important;
    margin: 0 auto !important;
  }

  .flyer-instructions h3 {
    font-size: 1.6rem !important;
    color: #000000 !important;
  }

  .flyer-instructions p {
    font-size: 1.1rem !important;
    color: #444444 !important;
  }

  .flyer-url {
    color: #000000 !important;
    background: #f3f4f6 !important;
    border: 1px solid #cccccc !important;
    font-size: 1.25rem !important;
    padding: 0.8rem 1.5rem !important;
  }
}
