/* A & A Afrogems - Mobile-First Optimized Styles */
/* Addresses customer specs: compact tiles, proper mobile UX */

:root {
  /* Compact sizing variables */
  --touch-target-min: 44px;
  --compact-touch: 36px;
  --micro-touch: 32px;
  
  /* Brand colors optimized */
  --forest-primary: #0F4C3A;
  --gold-accent: #D4AF37;
  --stone-100: #F5F5F4;
  --stone-200: #E7E5E4;
  --stone-600: #57534E;
  --stone-800: #292524;
  
  /* Status colors */
  --status-available: #059669;
  --status-reserved: #D97706;
  --status-sold: #DC2626;
}

/* Global optimizations */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.4;
  color: var(--stone-800);
  background: var(--stone-100);
  margin: 0;
  padding: 0;
}

/* Container optimizations */
.container {
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
  padding: 0 0.75rem;
}

/* ==================== */
/* COMPACT FILTER PILLS */
/* ==================== */
.filter-pill-compact {
  flex-shrink: 0;
  padding: 4px 12px;
  background: white;
  border: 1px solid var(--stone-200);
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--stone-600);
  transition: all 0.2s;
  min-height: var(--micro-touch);
  white-space: nowrap;
  text-align: center;
}

.filter-pill-compact.active {
  background: var(--forest-primary);
  color: white;
  border-color: var(--forest-primary);
}

.filter-pill-compact:hover:not(.active) {
  border-color: var(--forest-primary);
  color: var(--forest-primary);
}

/* ==================== */
/* COMPACT VIEW TOGGLE  */
/* ==================== */
.view-toggle {
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--stone-600);
  transition: all 0.2s;
  min-width: var(--micro-touch);
  min-height: var(--micro-touch);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle.active {
  background: white;
  color: var(--forest-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ==================== */
/* COMPACT STONE GRID   */
/* ==================== */
.stone-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  width: 100%;
  padding-top: 0.5rem;
  align-items: start; /* Prevent grid stretching */
  grid-auto-rows: max-content; /* Allow cards to size naturally */
}

@media (min-width: 480px) {
  .stone-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 768px) {
  .stone-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
  }
}

/* ==================== */
/* UNIFORM STONE CARDS - BORDERLESS IMAGE DESIGN */
/* ==================== */
.stone-card-uniform, .stone-card-compact {
  background: #F8F8F8 !important; /* NEUTRAL: Uniform showcase background */
  border: 1px solid #E8E8E8 !important; /* SUBTLE: Light neutral outline */
  border-radius: 8px !important; /* ROUNDED: Clean card edges */
  overflow: hidden !important; /* HIDDEN: Clean card boundaries */
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important; /* MINIMAL: Barely visible shadow */
  height: 240px; /* INCREASED: 240px to prevent content cropping */
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important; /* ENFORCED: Uniform card width */
  max-width: 100% !important; /* ENFORCED: Prevent expansion */
  min-width: 0 !important; /* ENFORCED: Allow shrinking */
  flex-shrink: 1 !important; /* ENFORCED: Allow shrinking in grid */
}

.stone-card-uniform:hover, .stone-card-compact:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important; /* SUBTLE: Enhanced shadow on hover */
  border-color: #D8D8D8 !important; /* NEUTRAL: Slightly darker border */
}

/* Stone image subtle zoom on hover */
.stone-card-uniform:hover .stone-img,
.stone-card-compact:hover .stone-img {
  transform: scale(1.02); /* SUBTLE: Gentle zoom effect */
}

.stone-card-uniform.sold, .stone-card-compact.sold {
  opacity: 0.6;
  filter: grayscale(0.4);
}

/* ==================== */
/* PURE NEUTRAL IMAGE AREA - JEWELRY SHOWCASE */
/* ==================== */
.stone-image-large {
  position: relative;
  height: 156px; /* INCREASED: ~65% of 240px for image */
  overflow: visible; /* VISIBLE: Let stones display naturally */
  flex-shrink: 0; /* Prevent image area from shrinking */
  background: #F8F8F8 !important; /* NEUTRAL: Slightly off-white showcase background */
  border: none; /* NO BORDER: Pure stone presentation */
  border-radius: 8px 8px 0 0; /* TOP ROUNDED: Clean card outline */
}

/* Legacy support for existing compact images */
.stone-image-compact {
  position: relative;
  height: 156px; /* INCREASED: Matches stone-image-large */
  overflow: visible; /* VISIBLE: Natural stone display */
  flex-shrink: 0; /* Prevent image area from shrinking */
  background: #F8F8F8 !important; /* NEUTRAL: Same showcase background */
  border: none; /* NO BORDER: Clean presentation */
  border-radius: 8px 8px 0 0; /* TOP ROUNDED: Matches stone-image-large */
}

.stone-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  background: transparent !important; /* TRANSPARENT: Only uploaded image visible */
  border: none !important; /* NO BORDER: Pure stone appearance */
  border-radius: 6px; /* SUBTLE RADIUS: Natural stone presentation */
  display: block; /* BLOCK: Prevent inline spacing issues */
}

.stone-card-compact:hover .stone-img {
  transform: scale(1.05);
}

/* Status badges removed - only show if stone is actually unavailable */

/* Proof video button - smaller */
.proof-video-compact {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.7);
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.proof-video-compact:hover {
  background: var(--gold-accent);
  color: var(--stone-800);
  transform: scale(1.1);
}

/* Live Indicator - Universal Symbol */
.live-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #EF4444; /* Live red dot */
  border-radius: 50%;
  animation: livePulse 2s infinite;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
}

@keyframes livePulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* ==================== */
/* UNIFORM CONTENT - FIXED WIDTH RESTORED */
/* ==================== */
.stone-content-uniform, .stone-content-compact {
  padding: 6px 8px 8px 8px; /* RESTORED: Original balanced padding */
  height: 84px; /* INCREASED: 84px to accommodate all content without cropping */
  flex-shrink: 0; /* Prevent content area from shrinking */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden !important; /* ENFORCED: Prevent content overflow */
  width: 100% !important; /* ENFORCED: Uniform width */
  max-width: 100% !important; /* ENFORCED: Prevent expansion */
  box-sizing: border-box !important; /* ENFORCED: Padding in width calc */
  
  /* STYLED CONTENT AREA - Neutral showcase theme */
  background: #F8F8F8 !important; /* NEUTRAL: Matches image area background */
  border: 1px solid #E8E8E8 !important; /* SUBTLE: Light neutral border */
  border-radius: 0 0 8px 8px !important; /* ROUNDED: Bottom only for card outline */
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important; /* MINIMAL: Very subtle shadow */
}

/* Uniform Typography - Hierarchical Structure */
.stone-name-uniform, .stone-name-compact {
  font-size: 12px; /* REDUCED: 13px -> 12px to fit new stone type */
  font-weight: 600;
  color: #1F1F1F; /* Uniform dark text */
  margin: 0 0 1px 0; /* REDUCED: margin for tighter spacing */
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Stone Type - NEW: Between name and source for clear hierarchy */
.stone-type-uniform {
  font-size: 11px; /* Medium size - between name and source */
  font-weight: 500; /* Semi-bold for distinction */
  color: #059669; /* Success green - gemstone category color */
  margin: 0 0 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
  flex-shrink: 0;
  text-transform: capitalize; /* Ensure consistent capitalization */
}

/* Source OR Description - ENFORCED SINGLE LINE ONLY */
.stone-detail-uniform, .stone-source-compact {
  font-size: 9px; /* REDUCED: 10px -> 9px to accommodate stone type */
  color: #6B7280; /* Uniform muted text */
  margin-bottom: 3px;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important; /* ENFORCED: Single line only */
  line-height: 1.2;
  flex-shrink: 0; /* Prevent text area from changing size */
  max-width: 100% !important; /* ENFORCED: Prevent width expansion */
  min-width: 0 !important; /* ENFORCED: Allow shrinking for ellipsis */
  width: 100% !important; /* ENFORCED: Use full container width */
  display: block !important; /* ENFORCED: Block display for text control */
  word-break: break-all; /* BACKUP: Force break if needed */
}

/* Weight & Price row - uniform */
.stone-specs-uniform, .stone-specs-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.stone-weight-uniform, .stone-weight-compact {
  font-size: 12px;
  font-weight: 600;
  color: #1F1F1F; /* Uniform text */
}

.stone-price-uniform, .stone-price-compact {
  font-size: 14px;
  font-weight: 700;
  color: #059669; /* Uniform price color - success green */
}

/* Removed .see-more - no longer needed with uniform descriptions */

/* ==================== */
/* UNIFORM ACTIONS      */
/* ==================== */
.stone-actions-uniform, .stone-actions-compact {
  display: flex;
  gap: 3px;
  margin-top: auto;
  padding-top: 2px;
}

.btn-buy-uniform, .btn-buy-compact {
  flex: 1;
  height: 26px;
  background: #1F2937; /* Uniform dark button */
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-buy-uniform:hover:not(:disabled), .btn-buy-compact:hover:not(:disabled) {
  background: #059669; /* Uniform hover - success green */
  color: white;
}

.btn-buy-uniform:disabled, .btn-buy-compact:disabled {
  background: #9CA3AF; /* Uniform disabled */
  cursor: not-allowed;
}

.btn-live-uniform, .btn-live-compact,
.btn-find-uniform, .btn-find-compact {
  width: 26px;
  height: 26px;
  background: #F3F4F6; /* Uniform light gray */
  border: 1px solid #D1D5DB;
  border-radius: 5px;
  color: #6B7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 9px;
}

.btn-live-uniform:hover, .btn-live-compact:hover,
.btn-find-uniform:hover, .btn-find-compact:hover {
  background: #1F2937; /* Uniform hover - dark */
  color: white;
  border-color: #1F2937;
}

/* ==================== */
/* DOUBLE-SIZE LIVE VIEWING - TRANSPARENCY FOCUSED */
/* ==================== */
.btn-live-uniform-double {
  width: 52px; /* DOUBLE SIZE - signals transparency priority */
  height: 26px;
  background: #059669; /* Success green - trustworthy transparency */
  border: 1px solid #047857;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 10px;
  font-weight: 600;
  gap: 4px; /* Space for potential text + icon */
  position: relative;
}

.btn-live-uniform-double:hover:not(.activated) {
  background: #047857; /* Darker green on hover */
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
  border-color: #065f46;
}

.btn-live-uniform-double:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}

/* ACTIVATED STATE - Shows selection with tick and color change */
.btn-live-uniform-double.activated {
  background: #DC2626; /* Red - "Added to live viewing queue" */
  border-color: #B91C1C;
  color: white;
  transform: scale(1.02); /* Slightly larger when activated */
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.btn-live-uniform-double.activated:hover {
  background: #B91C1C; /* Darker red on hover when activated */
  border-color: #991B1B;
  transform: scale(1.02) translateY(-1px);
}

/* Icon switching - Eye to Check when activated */
.btn-live-uniform-double .fa-eye {
  display: inline-block;
  transition: all 0.3s ease;
}

.btn-live-uniform-double .fa-check {
  display: none;
  transition: all 0.3s ease;
}

.btn-live-uniform-double.activated .fa-eye {
  display: none;
}

.btn-live-uniform-double.activated .fa-check {
  display: inline-block;
  animation: checkPop 0.3s ease-out;
}

@keyframes checkPop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ==================== */
/* LANDING PAGE COMPACT */
/* ==================== */
.stone-gallery {
  background: var(--stone-100);
  padding: 1rem 0 4rem;
  min-height: 60vh;
}

.gallery-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.results-info {
  flex: 1;
}

.stones-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--stone-800);
  display: block;
}

.last-updated {
  font-size: 11px;
  color: var(--stone-600);
  display: block;
}

.view-controls {
  display: flex;
  gap: 2px;
  background: var(--stone-200);
  border-radius: 6px;
  padding: 2px;
}

.view-control {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--stone-600);
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-control.active {
  background: white;
  color: var(--forest-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.load-more-section {
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 1rem;
}

.load-more-btn {
  background: white;
  border: 2px solid var(--forest-primary);
  border-radius: 12px;
  color: var(--forest-primary);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 14px;
  font-weight: 600;
}

.load-more-btn:hover {
  background: var(--forest-primary);
  color: white;
  transform: translateY(-1px);
}

/* ==================== */
/* SCROLLBAR HIDE       */
/* ==================== */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ==================== */
/* LOADING SHIMMER      */
/* ==================== */
.loading-shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ==================== */
/* RESPONSIVE TWEAKS    */
/* ==================== */
@media (max-width: 480px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .stone-grid-compact {
    gap: 0.5rem;
  }
  
  .stone-card-uniform,
  .stone-card-compact {
    height: 220px; /* INCREASED for mobile to prevent cropping */
    border-radius: 6px !important; /* SMALLER radius for mobile */
  }
  
  .stone-image-large,
  .stone-image-compact {
    height: 143px; /* INCREASED: ~65% of 220px for mobile */
    flex-shrink: 0;
    border-radius: 6px 6px 0 0 !important; /* TOP ROUNDED for mobile cards */
  }
  
  .stone-content-uniform,
  .stone-content-compact {
    padding: 6px 8px 8px 8px; /* Balanced mobile padding for styled content area */
    height: 77px; /* INCREASED: enough space for all content on mobile */
    flex-shrink: 0;
    overflow: hidden;
  }
  
  .stone-name-uniform,
  .stone-name-compact {
    font-size: 11px; /* REDUCED for mobile to fit stone type */
    margin-bottom: 1px;
  }
  
  .stone-type-uniform {
    font-size: 10px; /* Mobile stone type sizing */
    margin-bottom: 2px;
  }
  
  .stone-detail-uniform,
  .stone-source-compact {
    font-size: 8px; /* REDUCED for mobile balance */
    margin-bottom: 3px;
  }
  
  .stone-specs-compact {
    margin-bottom: 3px;
  }
  
  .stone-actions-compact {
    gap: 2px;
    padding-top: 2px;
  }
  
  .btn-buy-compact,
  .btn-buy-uniform,
  .btn-live-compact,
  .btn-find-compact {
    height: 22px;
    font-size: 9px;
  }
  
  .btn-live-compact,
  .btn-find-compact {
    width: 22px;
  }
  
  /* Double-size Live Viewing on mobile */
  .btn-live-uniform-double {
    width: 44px; /* DOUBLE SIZE on mobile - transparency priority */
    height: 22px;
    font-size: 9px;
  }
  
  .btn-live-uniform-double.activated {
    transform: scale(1.05); /* Slightly more prominent on mobile */
  }
  }
}

/* ==================== */
/* ACCESSIBILITY        */
/* ==================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for accessibility */
.stone-card-compact:focus,
.btn-buy-compact:focus,
.btn-live-compact:focus,
.filter-pill-compact:focus,
.view-toggle:focus {
  outline: 2px solid var(--gold-accent);
  outline-offset: 2px;
}

/* Touch-friendly hover states */
@media (hover: hover) {
  .stone-card-compact:hover {
    transform: translateY(-2px);
  }
}

/* Ensure minimum touch targets on all interactive elements */
.stone-card-compact,
.filter-pill-compact,
.btn-buy-compact,
.btn-live-compact,
.view-toggle {
  min-height: var(--compact-touch);
}