/* ========================================
   TOP 10 WIZARD - Clean Professional Design
   ======================================== */

/* Base page layout */
.top10-page {
  background-color: var(--color-beige);
  min-height: 100vh;
  padding: 140px 24px 60px;
}

.top10-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

/* Wizard Steps */
.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   STEP 1 - INTRO CARD
   ======================================== */
.intro-card {
  background: white;
  border-radius: 24px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(64, 55, 49, 0.08);
}

.intro-title {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--color-brown);
  margin: 0 0 12px;
  line-height: 1.2;
}

.intro-text {
  font-family: var(--font-body);
  font-size: 16px;
  color: rgba(64, 55, 49, 0.6);
  margin: 0 0 32px;
  line-height: 1.6;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: rgba(64, 55, 49, 0.5);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(64, 55, 49, 0.12);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-brown);
  background: #FAFAFA;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-brown);
  background: white;
  box-shadow: 0 0 0 3px rgba(64, 55, 49, 0.08);
}

.error-message {
  display: none;
  color: #D32F2F;
  font-size: 13px;
  margin-top: 6px;
}

/* ========================================
   STEP 2 - SELECTION PAGE
   ======================================== */
.selection-header {
  text-align: center;
  margin-bottom: 32px;
}

.selection-header .intro-title {
  font-size: 32px;
  margin-bottom: 8px;
}

.selection-header .intro-text {
  margin-bottom: 0;
}

/* Selected Cigars List */
.selected-cigars-card {
  background: white;
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(64, 55, 49, 0.06);
  overflow: hidden;
}

.selected-cigars-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #FAFAFA;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.selected-cigars-title {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-brown);
  margin: 0;
}

.selected-cigars-count {
  font-family: var(--font-body);
  font-size: 13px;
  color: rgba(64, 55, 49, 0.5);
}

.selected-cigars-list {
  padding: 8px;
}

.selected-cigar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 12px;
  transition: background 0.15s;
}

.selected-cigar-item:hover {
  background: #FAFAFA;
}

.selected-cigar-rank {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--color-brown);
  color: white;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Fixed dimensions wrapper to prevent layout shift */
.selected-cigar-thumb-wrapper {
  width: 72px;
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 4px;
}

.selected-cigar-image {
  width: 72px;
  height: 54px;
  object-fit: contain;
  flex-shrink: 0;
  mix-blend-mode: multiply;
}

.selected-cigar-info {
  flex: 1;
  min-width: 0;
}

.selected-cigar-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-brown);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-cigar-brand {
  font-family: var(--font-body);
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.selected-cigar-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.selected-cigar-reorder {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--color-brown);
  background: white;
  color: var(--color-brown);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 16px;
  font-weight: bold;
}

.selected-cigar-reorder:hover {
  background: var(--color-brown);
  color: white;
  border-color: var(--color-brown);
  transform: translateY(-1px);
}

.selected-cigar-reorder:active {
  transform: translateY(0);
}

.btn-placeholder {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.selected-cigar-remove {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #CCC;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 20px;
}

.selected-cigar-remove:hover {
  background: #FEE;
  color: #E53935;
}

/* Search Section */
.search-section {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(64, 55, 49, 0.06);
}

.search-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.search-label-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--color-brown);
  color: white;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-label-text {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-brown);
}

.search-input-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border: 1px solid rgba(64, 55, 49, 0.12);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-brown);
  background: #FAFAFA;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--color-brown);
  background: white;
  box-shadow: 0 0 0 3px rgba(64, 55, 49, 0.08);
}

.search-input::placeholder {
  color: rgba(64, 55, 49, 0.35);
}

.search-input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(64, 55, 49, 0.3);
  pointer-events: none;
}

.search-hint {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(64, 55, 49, 0.4);
  margin-top: 10px;
  text-align: center;
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  max-height: 360px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  border: 1px solid rgba(0,0,0,0.06);
}

.search-results.active {
  display: block;
  animation: dropdownFade 0.2s ease;
}

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

.search-results-loading,
.search-results-empty {
  padding: 24px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(64, 55, 49, 0.5);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--color-beige);
}

/* Fixed dimensions wrapper to prevent layout shift */
.search-result-thumb-wrapper {
  width: 64px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 4px;
}

.search-result-image {
  width: 64px;
  height: 48px;
  object-fit: contain;
  border-radius: 4px;
  background: transparent;
  flex-shrink: 0;
  mix-blend-mode: multiply;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-brown);
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-brand {
  font-family: var(--font-body);
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.search-result-add {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(64, 55, 49, 0.08);
  color: var(--color-brown);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.search-result-item:hover .search-result-add {
  background: var(--color-brown);
  color: white;
}

/* Completion Message */
.selection-complete {
  background: #F0EBE5;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--color-brown);
}

.selection-complete svg {
  flex-shrink: 0;
}

.selection-complete span {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ========================================
   BUTTONS (Override global)
   ======================================== */
#step-2 .btn {
  height: 52px !important;
  font-size: 14px !important;
  border-radius: 12px !important;
}

#step-2 .btn--primary {
  background: var(--color-brown) !important;
}

#step-2 .btn--primary:disabled,
#step-2 .btn--primary[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

#step-2 .btn--outline-white {
  background: white !important;
  border: 1px solid rgba(64, 55, 49, 0.15) !important;
  color: var(--color-brown) !important;
}

/* ========================================
   STEP 3 - RESULTS VIEW (Certificate Style)
   ======================================== */
body:has(.results-view.active) .header {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
  transition: all 0.4s ease;
}

.results-view {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #FAF8F6 0%, #F0EBE5 100%);
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 20px;
  gap: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.results-view:not(.active) {
  display: none !important;
}

.results-card {
  background: white;
  border-radius: 4px;
  padding: 48px 40px; /* Reduced padding */
  width: 100%;
  max-width: 800px;
  box-shadow: 0 20px 60px rgba(64, 55, 49, 0.15), 0 0 0 1px rgba(64, 55, 49, 0.02);
  position: relative;
  display: flex;
  flex-direction: column;
  /* Certificate border effect */
  outline: 4px double #F0EBE5;
  outline-offset: -16px;
  margin: auto 0; /* Center vertically if space allows */
}

.results-card::before {
  display: none; /* Remove top colored bar */
}

.results-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 32px; /* Reduced margin */
  position: relative;
  z-index: 2;
  width: 100%;
}

.results-logo-link {
  display: inline-block;
  margin-bottom: 20px;
  transition: transform 0.2s;
  line-height: 0;
}

.results-logo-link:hover {
  transform: translateY(-2px);
}

.results-logo {
  height: 42px;
  width: auto;
  opacity: 1;
}

.results-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-brown);
  margin-bottom: 16px;
  background: transparent;
  padding: 0;
}

.results-title {
  font-family: var(--font-display);
  font-size: 48px; /* Slightly smaller for better fit */
  color: var(--color-brown);
  margin: 0 0 12px;
  line-height: 1.1;
  width: 100%;
}

.results-byline {
  font-family: var(--font-body);
  font-size: 18px;
  color: rgba(64, 55, 49, 0.6);
  font-style: italic;
  margin: 0;
}

.results-author {
  color: var(--color-brown);
  font-weight: 600;
  font-style: normal;
  border-bottom: 1px solid rgba(64, 55, 49, 0.3);
  padding-bottom: 2px;
}

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  position: relative;
  z-index: 2;
}

.results-item {
  display: grid;
  grid-template-columns: 40px 120px 1fr;
  align-items: center;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid rgba(64, 55, 49, 0.08);
}

.results-item:last-child {
  border-bottom: none;
}

.results-rank {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: rgba(64, 55, 49, 0.2);
  text-align: center;
  line-height: 1;
}

.results-thumb-container {
  width: 120px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(64, 55, 49, 0.03);
  border-radius: 8px;
  overflow: hidden;
}

.results-thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.results-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 10px;
  min-width: 0;
}

.results-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding-left: 10px;
  flex-shrink: 0;
}

.results-rating-value {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-brown);
}

.results-rating-star {
  width: 14px;
  height: 14px;
  color: #c9a227;
}

.results-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--color-brown);
  line-height: 1.2;
}

.results-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-flag {
  width: 20px;
  height: 15px; /* Fixed height to prevent layout shifts, approximate for w40 flags */
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: block; /* Removes bottom spacing */
}

.results-brand {
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(64, 55, 49, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* Floating Share Sidebar */
.floating-share-sidebar {
  position: fixed;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1100;
  background: white;
  padding: 16px 12px;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(64, 55, 49, 0.08);
  transition: opacity 0.3s, transform 0.3s;
}

.floating-share-sidebar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(20px, -50%);
}

.share-btn-floating {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-brown);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
}

.share-btn-floating:hover {
  background: var(--color-beige);
  color: var(--color-brown);
  transform: scale(1.1);
}

.share-btn-floating svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.share-btn-floating--download {
  color: white;
  background: var(--color-brown);
  border: none;
}

.share-btn-floating--download:hover {
  background: var(--color-brown);
  color: white;
  transform: scale(1.1);
  opacity: 0.9;
}

.results-footer-line {
  margin-top: 48px;
  height: 2px;
  width: 100px;
  background: var(--color-brown);
  margin-left: auto;
  margin-right: auto;
  opacity: 0.3;
}

/* Social Share Grid - Mobile only */
.social-share-grid {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(64, 55, 49, 0.12);
  background: white;
  color: var(--color-brown);
  transition: all 0.2s ease;
  text-decoration: none;
}

.social-btn:hover {
  border-color: var(--color-brown);
  color: var(--color-brown);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(64, 55, 49, 0.15);
}

.social-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.results-footer {
  display: none;
}

/* Share Bar - Redesigned */
.share-bar {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.share-link-group {
  display: flex;
  gap: 8px;
  background: white;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border: 1px solid rgba(64, 55, 49, 0.08);
}

.share-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-brown);
  padding: 10px 16px;
  min-width: 0;
}

.share-input:focus {
  outline: none;
}

.share-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.share-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.share-btn--copy {
  background: var(--color-brown);
  color: white;
}

.share-btn--copy:hover {
  background: #2A2420;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(64, 55, 49, 0.2);
}

.share-btn--outline {
  background: white;
  color: var(--color-brown);
  border: 1px solid rgba(64, 55, 49, 0.15);
}

.share-btn--outline:hover {
  background: #FAFAFA;
  border-color: var(--color-brown);
  transform: translateY(-1px);
}

.share-btn--primary {
  background: var(--color-brown);
  color: white;
}

.share-btn--primary:hover {
  background: var(--color-brown);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(64, 55, 49, 0.2);
  opacity: 0.9;
}

/* Hide floating sidebar on smaller screens */
@media (max-width: 1200px) {
  .floating-share-sidebar {
    display: none !important;
  }
}

/* Hide inline social grid on desktop to save space (since we have floating sidebar) */
@media (min-width: 1201px) {
  .social-share-grid {
    display: none !important;
  }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {
  .results-card {
    padding: 40px 30px;
    max-width: 100%;
  }

  .results-title {
    font-size: 42px;
  }
  
  .results-item {
    grid-template-columns: 32px 100px 1fr;
    gap: 16px;
    padding: 20px 0;
  }
  
  .results-thumb-container {
    width: 100px;
    height: 66px;
  }
  
  .results-thumb {
    max-width: 100%;
    max-height: 100%;
  }
  
  .results-name {
    font-size: 20px;
  }
}

@media (max-width: 600px) {
  .top10-page {
    padding: 100px 16px 40px;
  }
  
  .results-view {
    padding: 20px 16px 100px; /* Extra bottom padding for mobile scroll */
  }
  
  .intro-card {
    padding: 32px 24px;
  }
  
  .intro-title {
    font-size: 28px;
  }
  
  .selection-header .intro-title {
    font-size: 26px;
  }
  
  .selected-cigars-card,
  .search-section {
    border-radius: 12px;
  }
  
  .results-card {
    padding: 32px 20px;
    outline-offset: -10px;
  }
  
  .results-logo {
    height: 32px;
  }
  
  .results-title {
    font-size: 32px;
    margin-bottom: 8px;
  }
  
  .results-badge {
    font-size: 14px;
    margin-bottom: 12px;
  }
  
  .results-item {
    grid-template-columns: 24px 80px 1fr;
    gap: 12px;
    padding: 16px 0;
  }

  .results-thumb-container {
    width: 80px;
    height: 54px;
  }

  .results-thumb {
    max-width: 100%;
    max-height: 100%;
  }
  
  .results-rank {
    font-size: 24px;
  }
  
  .results-name {
    font-size: 18px;
  }
  
  .results-brand {
    font-size: 12px;
  }
  
  .results-footer-line {
    margin-top: 32px;
  }
}

/* ========================================
   PRELOADER
   ======================================== */
.preloader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.preloader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--color-beige, #F6F1EA);
  border-top-color: var(--color-brown, #403731);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.preloader-text {
  margin-top: 20px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--color-brown, #403731);
  opacity: 0.7;
}
