/* ==========================================================================
   1. VARIABLES & RESET
   ========================================================================== */
:root {
  --primary: #0066cc;
  --primary-hover: #0052a3;
  --bg: #f4f7f9;
  --card-bg: #ffffff;
  --text: #333;
  --border: #dcdfe3;
}

body {
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  background-color: var(--bg);
  /* Decorative gradient background */
  background: linear-gradient(135deg, #e3f2fd, #fce4ec);
  max-width: 600px;
  margin: 40px auto;
  padding: 0 20px;
  color: var(--text);
  line-height: 1.5;
}

/* ==========================================================================
   2. LAYOUT CONTAINERS (Glassmorphism Effect)
   ========================================================================== */
#main-menu,
#cropper-ui {
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  /* Semi-transparent blur effect */
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Animation for the main menu entrance */
#main-menu {
  animation: fadeSlide 0.6s ease;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h2 {
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
  margin-top: 0;
  text-align: center;
  color: #1a1a1a;
}

/* ==========================================================================
   3. FORM ELEMENTS
   ========================================================================== */
.form-group {
  margin-bottom: 18px;
}

label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #555;
}

/* Standard Input Styling */
input[type="file"],
input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Custom Color Picker Styling */
input[type="color"] {
  height: 45px;
  cursor: pointer;
  padding: 4px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
}

input[type="color"]:hover {
  border-color: var(--primary);
  background: #f0f7ff;
}

/* Inner color swatch for Webkit browsers */
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

/* Side-by-side Layout (e.g., Width/Height) */
.dimension-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Custom Checkbox Group */
.checkbox-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #eee;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.checkbox-container:hover {
  background: #f0f2f5;
}

.checkbox-container label {
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
  display: block;
  width: 100%;
}

.checkbox-container input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   4. BUTTONS
   ========================================================================== */
button {
  width: 100%;
  padding: 14px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  transition:
    transform 0.1s,
    background 0.2s,
    box-shadow 0.2s;
  margin-top: 15px;
  margin-bottom: 10px;
}

button:active {
  transform: scale(0.98);
}

button:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 15px rgba(0, 102, 204, 0.4);
}

/* Button Variants */
.btn-secondary {
  background: #6c757d;
}
.btn-secondary:hover {
  background: #5a6268;
}

.btn-skip {
  background: #dc3545;
}
.btn-skip:hover {
  background: #c82333;
}

/* ==========================================================================
   5. IMAGE CROPPER & STATUS UI
   ========================================================================== */
#cropper-ui {
  display: none; /* Controlled via JS */
}

.crop-container {
  width: 100%;
  max-height: 60vh;
  margin-bottom: 20px;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

/* Inline row for Padding + Color Picker */
.color-pad-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

#paddingInput {
  flex: 1;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
}

#paddingInput:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(0, 102, 204, 0.3);
}

#status {
  margin-top: 15px;
  font-weight: bold;
  color: var(--primary);
  text-align: center;
}

/* Smooth transitions for conditional inputs */
#paddingInput,
#polaroidText,
#caption,
#color-disclaimer {
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* Enhancing the Polaroid caption input */
#polaroidText {
  margin-top: 10px;
  border-style: dashed; /* Visual cue that it's for the "handwritten" part */
}

/* Styling for the Instructions block */
.instructions {
  margin-top: 25px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  border-left: 4px solid var(--primary);
}

.instructions h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  text-align: left;
  border: none;
  color: var(--primary);
}

.instructions ul {
  margin: 0;
  padding-left: 20px;
  font-size: 0.85rem;
  color: #666;
}

.instructions li {
  margin-bottom: 8px;
}

.instructions li strong {
  color: #333;
}

.preview-box {
  width: 100%;
  height: 400px;
  background: #f0f0f0; /* better contrast */
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px dashed #444;
  padding: 5px; 
}

#previewCanvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
}
