/* Review and results styles */

/* Main result container */
.main-result {
    display: none;
}

#mainResult.show {
    display: flex !important;
    flex-direction: column;
    margin-bottom: 5rem;
}

/* Align rating section with thumbnail on desktop */
@media (min-width: 768px) {
    #resultContainer {
        padding-top: 7rem;
    }
}

/* Suggested results carousel */
.suggested-results {
    /* margin: 32px 0 0 0; */
}

.suggested-results .carousel-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
}

.popular-carousel-container {
    /* margin: 32px 0 0 0; */
    padding: 0 0 8px 0;
    position: relative;
    bottom: -12vw;
}

.carousel-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    margin-left: 8px;
    color: var(--text-primary);
}

.popular-carousel {
    align-items: flex-end;
    display: flex;
    overflow-x: scroll;
    max-width: 100%;
    gap: 20px;
    padding: 12px 8px;
    scroll-behavior: smooth;
    justify-content: center;
}

.popular-carousel::-webkit-scrollbar {
    height: 8px;
    background: var(--bg-elevated);
}

.popular-carousel::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-sm);
}

.popular-carousel::-webkit-scrollbar-thumb:hover {
    background: var(--berry-primary-500);
}

.carousel-item {
    flex: 0 0 auto;
    width: 161px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition-fast);
    padding: 8px;
    border: 1px solid var(--border-subtle);
}

.carousel-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--berry-primary-500);
}

.carousel-item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    clip-path: inset(5.35% 0 5.35% 0);
}

.carousel-caption {
    font-size: 0.95rem;
    color: var(--text-primary);
    text-align: center;
    margin-top: 2px;
}

/* User Review History grid styles */
.user-review-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
    width: 100%;
}

@media (min-width: 500px) {
    .user-review-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .user-review-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .user-review-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1500px) {
    .user-review-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1800px) {
    .user-review-list {
        grid-template-columns: repeat(5, 1fr);
    }
}

.user-review-card {
    aspect-ratio: 7 / 6;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
    min-width: 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 1 / 1) {
    .user-review-card::before {
        content: "";
        float: left;
        padding-top: 100%; /* 1:1 aspect ratio */
    }
    .user-review-card > * {
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
    }
}

.user-review-card:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    background: var(--bg-elevated);
    border-color: var(--berry-primary-500);
}

.user-review-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    min-height: 0;
    flex-shrink: 0;
}

/* Ensure review cards are 7/6 aspect ratio on phone screens */
@media (max-width: 1200px) {
    .user-review-card {
        aspect-ratio: 7 / 6 !important;
        width: 100%;
        height: auto;
        object-fit: cover;
        display: block;
    }
}

.user-review-card .review-title {
    font-weight: 500;
    font-size: 1.05em;
    margin-bottom: 0.3em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    color: var(--text-primary);
}

.user-review-card .review-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
    color: var(--text-tertiary);
    margin-top: auto;
    min-height: 1.8em;
}

.user-review-card .score-text {
    font-size: 1.1em;
    color: white;
    min-width: 3em;
    text-align: right;
    background: none;
    -webkit-text-fill-color: initial;
    padding: 0;
}

/* Make userReviewPaginationControls sticky below navbar */
#userReviewPaginationControls {
    position: sticky;
    top: 72px; /* Height of navbar */
    background: var(--bg-surface);
    z-index: 50;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .carousel-item {
        width: 161px;
    }
    .carousel-title {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .suggested-results .carousel-title {
        font-size: 1.25rem;
    }
}

/* Review Action Buttons */
.review-action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
}

.copy-ai-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    outline: none;
}
.copy-ai-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(126,7,237,0.25);
    z-index: 2;
    position: relative;
    transition: box-shadow 0.18s;
}

.copy-ai-button:hover {
    background: var(--bg-app);
    border-color: var(--border-brand);
    color: var(--berry-primary-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.copy-ai-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.copy-ai-button svg {
    flex-shrink: 0;
}

/* Success state for copy button */
.copy-ai-button.copied {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--berry-green-500);
    color: var(--berry-green-600);
}

.copy-ai-button.copied svg {
    stroke: var(--berry-green-600);
}

@media (max-width: 768px) {
    .review-action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .copy-ai-button {
        justify-content: center;
        width: 100%;
    }
}

.tooltip-icon {
    background: var(--bv);
    color: white;
    border: 1px solid var(--bv-mint);
    font-family: mono;
    font-size: 0.75rem;
    padding: 2px 7px;
    border-radius: 16px;
    cursor: pointer;
    margin-left: 10px;
}

.tooltip-icon:hover {
    background: var(--gradient-primary);
    color: white;
    transform: scale(1.1);
}
/* Loading overlay for upload interface */
.loading-overlay-container {
  position: relative;
}

.loading-overlay-container .upload-content-body {
  transition: filter 0.2s ease, transform 0.4s ease, opacity 0.4s ease;
}

/* Base overlay state (also uses Tailwind classes in markup) */
.loading-overlay-container .loading-overlay {
  opacity: 0;
  pointer-events: none;
  /* top: 45%;
  left: 45%; */
}

/* Active state: show overlay and blur underlying content */
.loading-overlay-container.loading-overlay-active .loading-overlay {
  opacity: 1;
  pointer-events: none;
}

.loading-overlay-container.loading-overlay-active .upload-content-body {
  filter: blur(4px);
}

/* Going away animation when results are ready */
.loading-overlay-container.going-away .upload-content-body {
  transform: translateY(-20px);
  opacity: 0;
  filter: blur(0px);
}

.loading-overlay-container.going-away .loading-overlay {
  opacity: 0;
  pointer-events: none;
}

/* Quick Suggestions Carousel */
.quick-suggestion-container {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px; /* Reserve space */
    padding: 40px 20px;
}

.quick-suggestion-card {
    background-color: var(--russian-violet);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    font-size: 0.95rem;
    text-align: center;
    /* max-width: 80%; */
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
}

.quick-suggestion-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.quick-suggestion-card:hover {
    /* background-color: var(--federal-blue); */
    border-color: var(--mint);
    /* transform: scale(1.03); */
}

.quick-suggestion-card.copied {
    background-color: rgba(14, 185, 130, 0.2);
    color: var(--mint);
    border-color: var(--mint);
}

.suggestion-nav {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    z-index: 10;
}

.suggestion-nav:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--berry-primary-500);
    transform: scale(1.1);
}

.suggestion-content-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 1rem;
    width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .loading-overlay-container .upload-content-body {
    transition: none;
  }
  .loading-overlay-container.going-away .upload-content-body {
    transform: none;
  }
}

/* Feedback Checkbox Styles */
.feedback-checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    margin-right: 10px;
}

.feedback-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.feedback-checkbox-custom {
    position: absolute;
    top: 0;
    left: 0;
    height: 1.5rem;
    width: 1.5rem;
    background-color: #7e07edff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.feedback-checkbox-custom::after {
    content: "";
    display: none;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* Checked state (default): Custom checkbox has checkmark */
.feedback-checkbox:checked ~ .feedback-checkbox-custom {
    background-color: #7e07edff;
    border-color: transparent;
}
.feedback-checkbox:checked ~ .feedback-checkbox-custom::after {
    display: block;
}

/* Unchecked state: Empty checkbox visible always */
.feedback-checkbox:not(:checked) ~ .feedback-checkbox-custom {
    background-color: transparent;
    border-color: #7e07edff;
}

.feedback-checkbox:not(:checked) ~ .feedback-checkbox-custom::after {
    display: none;
}

/* Hover effect on the item */
.feedback-item:hover .feedback-checkbox-custom {
    transform: scale(1.05);
}

/* Custom Feedback Styles */
.custom-feedback-container {
    margin-top: 10px;
    width: 100%;
}

.custom-feedback-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.9rem;
    min-height: 50px;
}

.custom-feedback-placeholder:hover {
    border-color: var(--berry-primary-500);
    color: var(--berry-primary-400);
    background: rgba(126, 7, 237, 0.05);
}

.custom-feedback-placeholder .plus-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

.custom-feedback-input {
    width: 100%;
    padding: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--berry-primary-500);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 50px;
    outline: none;
    box-shadow: 0 0 0 2px rgba(126, 7, 237, 0.1);
}

.custom-feedback-input:focus {
    box-shadow: 0 0 0 2px rgba(126, 7, 237, 0.25);
}

.custom-feedback-input::placeholder {
    color: var(--text-tertiary);
}
