/* ==========================================================================
   Smart Image Print & Download — Frontend Styles
   ========================================================================== */

/* --- CSS Custom Properties (overridden by inline dynamic CSS) --- */
:root {
  --sipd-color-download-image: #2563eb;
  --sipd-color-download-pdf:   #16a34a;
  --sipd-color-print:          #9333ea;
  --sipd-color-text:           #ffffff;
  --sipd-border-radius:        8px;
  --sipd-container-padding:    16px;
  --sipd-transition:           180ms ease;
  --sipd-shadow:               0 2px 8px rgba(0, 0, 0, .18);
  --sipd-shadow-hover:         0 4px 16px rgba(0, 0, 0, .26);
  --sipd-gap:                  10px;
}

/* --- Image wrapper ------------------------------------------------- */
.sipd-image-wrapper {
  display: block;
  width: 100%;
  padding-top: var(--sipd-container-padding);
  padding-bottom: var(--sipd-container-padding);
}

.sipd-image-wrapper > img,
.sipd-shortcode-wrapper > img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --- Divider ------------------------------------------------------- */
.sipd-divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, .1);
  margin: var(--sipd-container-padding) 0 calc(var(--sipd-container-padding) * 0.75);
}

/* --- Button group -------------------------------------------------- */
.sipd-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sipd-gap);
  margin-top: 12px;
}

/* Alignment variants */
.sipd-align-left   { justify-content: flex-start; }
.sipd-align-center { justify-content: center; }
.sipd-align-right  { justify-content: flex-end; }

/* --- Base button --------------------------------------------------- */
.sipd-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  border-radius: var(--sipd-border-radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.2;
  color: var(--sipd-color-text);
  box-shadow: var(--sipd-shadow);
  transition:
    transform var(--sipd-transition),
    box-shadow var(--sipd-transition),
    opacity var(--sipd-transition),
    filter var(--sipd-transition);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.sipd-btn:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

/* Ripple layer */
.sipd-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--sipd-transition);
  border-radius: inherit;
}

.sipd-btn:hover::after  { background: rgba(255, 255, 255, .12); }
.sipd-btn:active::after { background: rgba(255, 255, 255, .22); }

.sipd-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--sipd-shadow-hover);
}
.sipd-btn:active {
  transform: translateY(0);
  box-shadow: var(--sipd-shadow);
}

/* Disabled / loading state */
.sipd-btn[disabled],
.sipd-btn.sipd-loading {
  opacity: .65;
  cursor: not-allowed;
  pointer-events: none;
}

/* Spinner for loading state */
.sipd-btn.sipd-loading .sipd-btn-icon {
  animation: sipd-spin .7s linear infinite;
}

@keyframes sipd-spin {
  to { transform: rotate(360deg); }
}

/* --- Icon inside buttons ------------------------------------------ */
.sipd-btn svg {
  flex-shrink: 0;
  display: block;
}

/* --- Colour per button type --------------------------------------- */
.sipd-btn-download-image { background-color: var(--sipd-color-download-image); }
.sipd-btn-download-pdf   { background-color: var(--sipd-color-download-pdf); }
.sipd-btn-print          { background-color: var(--sipd-color-print); }

/* --- Size variants ------------------------------------------------- */

/* Small */
.sipd-btn.sipd-btn-small {
  padding: 7px 14px;
  font-size: .8125rem;
}
.sipd-btn.sipd-btn-small svg { width: 14px; height: 14px; }

/* Medium (default) */
.sipd-btn.sipd-btn-medium {
  padding: 9px 18px;
  font-size: .9375rem;
}
.sipd-btn.sipd-btn-medium svg { width: 16px; height: 16px; }

/* Large */
.sipd-btn.sipd-btn-large {
  padding: 12px 24px;
  font-size: 1rem;
}
.sipd-btn.sipd-btn-large svg { width: 18px; height: 18px; }

/* --- Toast notification ------------------------------------------- */
.sipd-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1e293b;
  color: #f8fafc;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms ease;
  z-index: 9999;
  max-width: 90vw;
  text-align: center;
}
.sipd-toast.sipd-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.sipd-toast.sipd-toast-error {
  background: #dc2626;
}

/* --- Responsive ----------------------------------------------------- */
@media (max-width: 480px) {
  .sipd-button-group {
    flex-direction: column;
    align-items: stretch;
  }
  .sipd-align-left,
  .sipd-align-center,
  .sipd-align-right {
    justify-content: stretch;
  }
  .sipd-btn {
    justify-content: center;
    width: 100%;
  }
}

/* --- High-contrast / forced-colors support ------------------------ */
@media (forced-colors: active) {
  .sipd-btn {
    border: 2px solid ButtonText;
  }
}

/* --- Print styles -------------------------------------------------- */
@media print {
  .sipd-button-group,
  .sipd-divider {
    display: none !important;
  }
}
