/* =========================================================================
   SMILE / INTERACTIVE CREATE — CLEAN CHATGPT / GOOGLE MINIMALIST STUDIO
   ========================================================================= */

.cam-ai-create-view {
  position: absolute;
  top: 0;
  bottom: 64px;
  left: 0;
  right: 0;
  width: 100%;
  height: calc(100% - 64px);
  background: #ffffff;
  color: #1a1a1a;
  z-index: 99999 !important;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 18px 18px 0 0;
}

.cam-ai-create-view.active {
  display: flex !important;
}

/* Ensure bottom track stays above create view */
.cam-bottom-nav {
  z-index: 100000 !important;
}

/* ------------------------------------------------------------- Floating Minimal Top Bar */
.cam-ai-topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 15;
  pointer-events: none;
}

.cam-ai-close-floating-btn {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  color: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
  touch-action: manipulation;
}

.cam-ai-close-floating-btn:active {
  transform: scale(0.92);
  background: #f3f4f6;
}

/* ------------------------------------------------------------- Center Stage (Full Clean Canvas) */
.cam-ai-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.cam-ai-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 12px;
}

.cam-ai-sparkle-icon {
  font-size: 46px;
  animation: floatSparkle 2.6s ease-in-out infinite;
}

@keyframes floatSparkle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.cam-ai-heading {
  font-size: 21px;
  font-weight: 800;
  color: #111827;
  margin: 0;
  letter-spacing: -0.2px;
}

.cam-ai-subheading {
  font-size: 13px;
  color: #6b7280;
  max-width: 280px;
  margin: 0;
  line-height: 1.45;
}

.cam-ai-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  max-width: 320px;
}

.cam-ai-chip {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.cam-ai-chip:active {
  background: #f9fafb;
  border-color: #fe2c55;
  color: #fe2c55;
  transform: scale(0.96);
}

.cam-ai-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  z-index: 20;
  text-align: center;
  padding: 24px;
}

.cam-ai-loading-spinner {
  width: 38px;
  height: 38px;
  border: 3.5px solid #f3f4f6;
  border-top-color: #fe2c55;
  border-radius: 50%;
  animation: aiSpin 0.75s linear infinite;
}

@keyframes aiSpin {
  to { transform: rotate(360deg); }
}

.cam-ai-loading-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.cam-ai-loading-sub {
  font-size: 12.5px;
  color: #6b7280;
  margin: 0;
}

.cam-ai-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: none;
  background: #000000;
}

/* ------------------------------------------------------------- Bottom Action & Prompt Section */
.cam-ai-bottom-section {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-top: none;
  padding: 6px 14px 14px 14px;
  gap: 12px;
  flex-shrink: 0;
  box-sizing: border-box;
  z-index: 10;
}

/* Controls row just up from typing box (Undo/Redo on left, Tick Next on right) */
.cam-ai-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  height: 40px;
}

.cam-ai-history-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cam-ai-size-pill {
  font-size: 11px;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 4px 9px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.cam-ai-size-pill.warning {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

/* Platform 100KB Budget Banner */
.cam-ai-budget-banner {
  position: absolute;
  top: 60px;
  left: 14px;
  right: 14px;
  background: #18181b;
  color: #ffffff;
  border: 1px solid #ef4444;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  z-index: 100;
  animation: slideDownBudget 0.25s ease-out;
}

@keyframes slideDownBudget {
  from { transform: translateY(-16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.cam-ai-budget-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cam-ai-budget-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #f87171;
}

.cam-ai-budget-desc {
  font-size: 12px;
  color: #d1d5db;
  line-height: 1.4;
}

.cam-ai-budget-dismiss {
  align-self: flex-end;
  background: #ef4444;
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 4px;
}

/* Toast message */
.cam-ai-toast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 50;
  white-space: nowrap;
}

.cam-ai-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.cam-ai-icon-btn {
  background: transparent;
  border: none;
  color: #4b5563;
  width: 36px;
  height: 36px;
  box-sizing: border-box;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
}

.cam-ai-icon-btn svg {
  width: 20px;
  height: 20px;
}

.cam-ai-icon-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.cam-ai-icon-btn:active {
  transform: scale(0.92);
}

.cam-ai-icon-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

/* Same Tick Next Button matching POST style but sized down to 36px to match Undo/Redo icons */
.cam-ai-tick-next-btn {
  width: 36px;
  height: 36px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  color: #ffffff;
  background: #FE2C55;
  border: none;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(254, 44, 85, 0.35);
  transition: transform 0.2s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.2s ease;
}

.cam-ai-tick-next-btn:active {
  transform: scale(0.92);
  box-shadow: 0 2px 6px rgba(254, 44, 85, 0.25);
}

.cam-ai-tick-next-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Prompt Box (ChatGPT / Google style) */
.cam-ai-prompt-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 26px;
  padding: 5px 6px 5px 12px;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.cam-ai-prompt-box:focus-within {
  background: #ffffff;
  border-color: #111827;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.08);
}

.cam-ai-upload-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease;
  touch-action: manipulation;
}

.cam-ai-upload-btn:hover {
  color: #111827;
}

.cam-ai-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13.5px;
  color: #111827;
  outline: none;
  font-family: inherit;
}

.cam-ai-input::placeholder {
  color: #9ca3af;
}

.cam-ai-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #111827;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}

.cam-ai-send-btn:active {
  transform: scale(0.92);
}

.cam-ai-send-btn.loading {
  background: #fe2c55;
  animation: camAiPulse 1s infinite alternate;
}

@keyframes camAiPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* Maintain strict desktop/tablet mobile container sizing in camera & create mode */
@media (min-width: 768px) {
  body.camera-open.keyboard-open #av-wrapper,
  body.camera-open #av-wrapper,
  body.keyboard-open #av-wrapper:has(#smile-camera-overlay.camera-open) {
    width: var(--app-width, 420px) !important;
    max-width: 420px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    height: 100% !important;
  }
}
