/**
 * Society Arts - Finished Art Modal
 * Modal for viewing completed artwork with zoom/pan functionality
 */

/* ========================================
   MODAL OVERLAY
   ======================================== */
.fa-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: faFadeIn 0.25s ease;
}

@keyframes faFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========================================
   MODAL CONTAINER
   ======================================== */
.fa-modal {
  --tan-bg: #FAF8F5;
  --tan-10: #F5F2EE;
  --tan-20: #E8E2D9;
  --tan-30: #D4C8B8;
  --brown: #3E2318;
  --accent: #C73314;
  --border: #E8E2D9;
  --text-muted: #8C7B6B;
  
  background: var(--tan-bg);
  width: 94vw;
  max-width: 1100px;
  height: 88vh;
  max-height: 780px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  animation: faSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes faSlideUp {
  from { 
    opacity: 0; 
    transform: scale(0.96) translateY(10px); 
  }
  to { 
    opacity: 1; 
    transform: scale(1) translateY(0); 
  }
}

/* ========================================
   HEADER
   ======================================== */
.fa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.fa-title {
  font-family: 'Domine', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--brown);
  margin: 0;
}

.fa-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--tan-20);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brown);
  transition: all 0.15s ease;
}

.fa-close:hover {
  background: var(--tan-30);
  transform: scale(1.05);
}

/* ========================================
   BODY - Viewer + Strip
   ======================================== */
.fa-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ========================================
   IMAGE VIEWER - Left/Main
   ======================================== */
.fa-viewer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--tan-10);
  min-width: 0;
  height: 100%;
  padding: 24px;
  overflow: hidden;
}

.fa-image-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fa-image {
  display: block;
  max-width: calc(100% - 80px);
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(62, 35, 24, 0.12);
  opacity: 0;
  transition: opacity 0.4s ease;
  cursor: zoom-in;
}

.fa-image.loaded {
  opacity: 1;
}

/* Creating State - Branded spinner (ring spins, logo pulses) */
.fa-creating {
  width: 400px;
  height: 300px;
  background: linear-gradient(145deg, var(--tan-bg) 0%, var(--tan-10) 100%);
  border: 1px solid var(--tan-30);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}

.fa-spinner-container {
  position: relative;
  width: 80px;
  height: 80px;
}

/* Centered logo - pulses, doesn't spin */
.fa-spinner-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  animation: faLoadingPulse 2s ease-in-out infinite;
}

.fa-spinner-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Spinning ring around logo */
.fa-spinner-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid #E8E2D9;
  border-top-color: #C73314;
  border-right-color: #C73314;
  border-radius: 50%;
  animation: faLoadingSpin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes faLoadingSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes faLoadingPulse {
  0%, 100% { 
    opacity: 0.6; 
    transform: translate(-50%, -50%) scale(0.95); 
  }
  50% { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1.05); 
  }
}

.fa-creating-text {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* Hide heart and kebab when creating */
.fa-viewer.creating .fa-heart-wrap,
.fa-viewer.creating .fa-bottom-actions {
  display: none;
}

/* Navigation arrows */
.fa-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brown);
  transition: all 0.15s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

.fa-nav:hover {
  background: white;
  transform: translateY(-50%) scale(1.06);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.fa-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.fa-nav:disabled:hover {
  transform: translateY(-50%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.fa-nav.prev { left: 16px; }
.fa-nav.next { right: 16px; }

/* ========================================
   IMAGE ACTIONS - Floating over image
   ======================================== */
.fa-heart-wrap {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
}

.fa-bottom-actions {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.fa-action-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brown);
  transition: all 0.15s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.fa-action-btn:hover {
  background: white;
  transform: scale(1.06);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Heart button states */
.fa-heart {
  color: var(--text-muted);
}

.fa-heart.favorited {
  color: var(--accent);
  background: white;
}

/* Kebab menu dropdown */
.fa-kebab-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  padding: 6px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.15s ease;
}

.fa-kebab-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fa-kebab-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  font-family: 'Familjen Grotesk', sans-serif;
  font-size: 14px;
  color: var(--brown);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s ease;
  text-align: left;
}

.fa-kebab-item:hover {
  background: var(--tan-10);
}

.fa-kebab-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.fa-kebab-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

.fa-kebab-item.danger {
  color: #B91C1C;
}

.fa-kebab-item.danger:hover {
  background: #FEF2F2;
}

.fa-kebab-item.danger svg {
  color: #B91C1C;
}

/* Info tooltip - opens upward from footer */
.fa-info-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  width: 280px;
  padding: 20px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s ease;
}

.fa-info-tooltip.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fa-info-tooltip h4 {
  font-family: 'Domine', Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--brown);
  margin: 0 0 10px 0;
}

.fa-info-tooltip p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.fa-info-tooltip p:last-of-type {
  margin-bottom: 16px;
}

.fa-info-close {
  width: 100%;
  padding: 10px 16px;
  background: var(--tan-20);
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--brown);
  cursor: pointer;
  transition: background 0.15s ease;
}

.fa-info-close:hover {
  background: var(--tan-30);
}

/* ========================================
   FULLSCREEN VIEW
   ======================================== */
.fa-fullscreen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  cursor: zoom-in;
  overflow: hidden;
}

.fa-fullscreen.open {
  opacity: 1;
  visibility: visible;
}

.fa-fullscreen.zoomed {
  cursor: grab;
}

.fa-fullscreen.zoomed.dragging {
  cursor: grabbing;
}

.fa-fullscreen-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.fa-fullscreen img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 4px;
  transition: transform 0.3s ease;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

.fa-fullscreen.zoomed img {
  transition: none;
}

.fa-fullscreen-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.15s ease;
  z-index: 10;
}

.fa-fullscreen-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Zoom hint */
.fa-fullscreen-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.8);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.fa-fullscreen.zoomed .fa-fullscreen-hint {
  opacity: 0;
}

/* ========================================
   THUMBNAIL STRIP - Right side
   ======================================== */
.fa-strip {
  width: 110px;
  flex-shrink: 0;
  background: var(--tan-bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 10px;
  overflow-y: auto;
}

.fa-thumb {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--tan-20);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.fa-thumb:hover {
  border-color: var(--tan-30);
}

.fa-thumb.active {
  border-color: var(--brown);
}

.fa-thumb.favorited {
  border-color: var(--accent);
}

.fa-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Thumbnail creating state - Pulsating circle */
.fa-thumb-creating {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--tan-bg) 0%, var(--tan-10) 100%);
}

.fa-thumb-circle {
  width: 24px;
  height: 24px;
  border: 1.5px solid rgba(62, 35, 24, 0.25);
  border-radius: 50%;
  animation: faBreathe 4s ease-in-out infinite;
}

@keyframes faBreathe {
  0%, 100% { 
    opacity: 0.3; 
    transform: scale(1); 
  }
  50% { 
    opacity: 0.6; 
    transform: scale(1.08); 
  }
}

/* Thumbnail heart badge */
.fa-thumb-heart {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.fa-thumb-heart svg {
  width: 9px;
  height: 9px;
}

/* ========================================
   FOOTER - Counter + keyboard hint + info
   ======================================== */
.fa-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 24px;
  position: relative;
  z-index: 100;
}

.fa-counter {
  font-size: 13px;
  color: var(--text-muted);
}

.fa-counter strong {
  color: var(--brown);
  font-weight: 600;
}

.fa-hint {
  font-size: 12px;
  color: var(--tan-30);
}

.fa-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--tan-20);
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 2px;
}

/* Info button in footer - right side */
.fa-footer-info {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
}

.fa-info-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--tan-30);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.fa-info-btn:hover {
  color: var(--brown);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .fa-modal {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .fa-strip {
    display: none;
  }

  .fa-nav {
    width: 38px;
    height: 38px;
  }

  .fa-nav.prev { left: 10px; }
  .fa-nav.next { right: 10px; }

  .fa-hint {
    display: none;
  }
}
