/* =====================================================
   FRILLO — Modal & Side Drawer
   ===================================================== */

/* ── Overlay ── */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: overlayIn 200ms ease forwards;
}

.overlay.closing {
  animation: overlayOut 200ms ease forwards;
}

/* ── Side Drawer ── */
.side-drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 480px;
  max-width: 100%;
  z-index: var(--z-drawer);
  background: var(--bg-header);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: slideInLeft 300ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.side-drawer.closing {
  animation: slideOutLeft 250ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Drawer Header */
.drawer-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-shrink: 0;
}

.drawer-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.drawer-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.drawer-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-chip);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  cursor: pointer;
}

.drawer-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.drawer-close-btn svg {
  width: 16px;
  height: 16px;
}

/* Drawer Body */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Drawer Footer */
.drawer-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex-shrink: 0;
}

.drawer-footer-buttons {
  display: flex;
  gap: var(--space-3);
  width: 100%;
}

.drawer-footer .btn,
.drawer-footer-buttons .btn {
  flex: 1;
  padding: var(--space-3);
}

/* ── Centered Modal ── */
.modal-wrapper {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-6);
  animation: bounceIn 350ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  z-index: var(--z-modal);
}

.modal-box.closing {
  animation: fadeInScale 200ms ease reverse forwards;
}

/* ── Divider ── */
.form-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Counter Row ── */
.counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.counter-row-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ── Hidden State ── */
.hidden { display: none !important; }

/* ── Responsive Drawer ── */
@media (max-width: 540px) {
  .side-drawer {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: slideInFromBottom 300ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
    top: auto;
    max-height: 90vh;
  }

  @keyframes slideInFromBottom {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ── Canva Floating Preview ── */
@keyframes canvaSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.canva-floating-preview {
  position: absolute;
  left: 504px;
  top: 24px;
  bottom: 24px;
  width: 580px;
  background: var(--bg-header);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: canvaSlideIn 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (max-width: 1120px) {
  .canva-floating-preview {
    display: none !important;
  }
}
