/* The HighWay Brand Green: #2f5d2f */

#seed-finder-root { 
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    color: #1f2937;
}

/* Filters Wrapper */
.sf-filters-wrapper {
    margin-bottom: 24px;
}

/* Filter Toggle Button */
.sf-filter-toggle {
    width: 100%;
    padding: 12px 16px;
    background: #2f5d2f;
    color: white;
    border: 2px solid #2f5d2f;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    margin-top: 12px;
}

.sf-filter-toggle:hover {
    background: #245024;
}

.sf-arrow {
    font-size: 12px;
    transition: transform 0.3s;
}

/* Filters Container */
.sf-filters-container {
    background: white;
    padding: 0;
    border-radius: 0 0 12px 12px;
    border: 2px solid #2f5d2f;
    border-top: none;
    box-shadow: 0 4px 16px rgba(47, 93, 47, 0.1);
    overflow: hidden;
}

.sf-filter-group {
    margin-bottom: 12px;
}

.sf-filter-group:last-of-type {
    margin-bottom: 0;
}

.sf-filter-label {
    display: block;
    font-weight: 700;
    font-size: 17px;
    color: #2f5d2f !important;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Search Input */
.sf-search-wrapper {
    position: relative;
    padding: 16px;
    background: white;
}

.sf-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #2f5d2f;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    background: white;
    box-sizing: border-box;
}

.sf-search-input:focus {
    outline: none;
    border-color: #2f5d2f;
    box-shadow: 0 0 0 3px rgba(47, 93, 47, 0.1);
}

/* Search Dropdown */
.sf-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #2f5d2f;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sf-search-result {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

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

.sf-search-result:hover {
    background: #f0f4f0;
}

.sf-search-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

.sf-search-breeder {
    font-size: 12px;
    color: #2f5d2f;
    margin-top: 2px;
}

/* Sort Container - Positioned above grid */
.sf-sort-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    margin-top: 24px;
}

.sf-sort-label {
    font-weight: 600;
    font-size: 15px;
    color: #2f5d2f;
    white-space: nowrap;
}

.sf-sort-select-compact {
    padding: 8px 12px;
    border: 2px solid #2f5d2f;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    min-width: 160px;
}

.sf-sort-select-compact:focus {
    outline: none;
    border-color: #2f5d2f;
    box-shadow: 0 0 0 3px rgba(47, 93, 47, 0.1);
}

.sf-sort-select-compact:hover {
    background: #f9fafb;
}

/* Accordion Styles */
.sf-accordion-item {
    margin: 0;
    border: none;
    border-top: 2px solid #2f5d2f;
    border-radius: 0;
    overflow: hidden;
    background: white;
    transition: all 0.2s;
}

.sf-accordion-item:first-child {
    border-top: none;
}

.sf-accordion-item:hover {
    background: #fafafa;
}

.sf-accordion-header {
    padding: 16px 20px;
    background: white;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    color: #2f5d2f;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.sf-accordion-header:hover {
    background: #f9fafb;
}

.sf-accordion-arrow {
    font-size: 14px;
    font-weight: 700;
    transition: transform 0.2s;
    color: #2f5d2f;
}

.sf-accordion-content {
    padding: 16px 20px 20px 20px;
    background: white;
    display: none;
    border-top: 1px solid #e5e7eb;
}

.sf-accordion-content .sf-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Button Group Filters */
.sf-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sf-filter-btn {
    padding: 10px 18px;
    border: 2px solid #2f5d2f;
    background: white;
    color: #2f5d2f !important;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.sf-filter-btn:hover {
    background: #f0f4f0;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(47, 93, 47, 0.2);
}

.sf-filter-btn.active {
    background: #2f5d2f !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(47, 93, 47, 0.3);
}

/* Filter Actions */
.sf-filter-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px;
    background: white;
    border-top: 2px solid #2f5d2f;
}

.sf-btn-filter-action {
    width: 100%;
    padding: 12px 20px;
}

.sf-btn-secondary {
    background: #6b7280;
    color: white;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.sf-btn-secondary:hover {
    background: #4b5563;
}

/* Grid */
.sf-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 24px;
    margin-top: 24px;
    min-height: 200px;
}

.sf-grid > div:only-child {
    grid-column: 1 / -1;
}

/* Card */
.sf-card { 
    border: 2px solid #e5e7eb; 
    padding: 20px; 
    border-radius: 16px; 
    background: white; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: grid;
    grid-template-rows: auto auto auto 1fr auto auto auto;
    overflow: visible;
    position: relative;
    /* IMPORTANT: Establish stacking context only within card */
    isolation: isolate;
}

.sf-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: #2f5d2f;
}

.sf-card > img,
.sf-card > div:first-child {
    grid-row: 1;
}

.sf-card-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #1f2937;
    line-height: 1.3;
    grid-row: 2;
}

.sf-card-breeder {
    font-size: 16px;
    color: #2f5d2f;
    font-weight: 600;
    margin-bottom: 14px;
    grid-row: 3;
}

.sf-card-details {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.8;
    margin-bottom: 16px;
    grid-row: 4;
    align-self: start;
}

.sf-card-details strong {
    color: #1f2937;
    font-weight: 600;
}

.sf-card-details div {
    margin-bottom: 4px;
}

.sf-card-buy-container {
    text-align: center;
    margin: 0;
    padding: 0 10px;
    grid-row: 5;
}

.sf-card-buy-container .sf-btn-primary {
    display: inline-block;
    width: auto;
    min-width: 150px;
    max-width: 100%;
    padding: 12px 28px;
}

.sf-card-comments {
    text-align: center;
    font-size: 13px;
    color: #4b5563;
    margin: 12px 0 16px 0;
    line-height: 1.5;
    padding: 0 10px;
    grid-row: 6;
    min-height: 20px;
}

.sf-card-footer {
    border-top: 2px solid #f3f4f6;
    padding-top: 14px;
    margin-top: 0;
    grid-row: 7;
}

.sf-card-avg-difficulty {
    color: #2f5d2f;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: center;
    min-height: 20px;
    display: block;
}

/* Additional card info styling */
.sf-card-additional-info {
    text-align: center;
    margin-top: 0;
    padding-top: 0;
    display: block;
    min-height: 0;
}

.sf-card-additional-info div {
    line-height: 1.5;
    margin-top: 4px;
    font-size: 13px;
}

/* Info spacer for alignment */
.sf-card-info-spacer {
    display: block;
    min-height: 44px;
}

/* Desktop: Add spacer only when there are multiple cards per row */
@media (min-width: 769px) {
    .sf-grid:not(:has(.sf-card:nth-child(2))) .sf-card-info-spacer {
        display: none;
    }
}

.sf-btn-primary { 
    display: inline-block; 
    padding: 12px 28px; 
    background: #2f5d2f; 
    color: white !important; 
    text-decoration: none !important; 
    border-radius: 8px; 
    font-weight: 600; 
    transition: all 0.2s;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(47, 93, 47, 0.2);
}

.sf-btn-primary:hover { 
    background: #245024;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(47, 93, 47, 0.3);
}

.sf-link-btn {
    background: none;
    border: none;
    color: #2f5d2f !important;
    cursor: pointer;
    text-decoration: underline !important;
    font-size: 13px;
    font-weight: 600;
    padding: 0;
    transition: color 0.2s;
}

.sf-link-btn:hover {
    color: #245024 !important;
}

/* Modal */
.sf-modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    background: rgba(0, 0, 0, 0.75); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.sf-modal-inner { 
    background: white; 
    border-radius: 16px; 
    max-width: 600px; 
    width: 100%; 
    max-height: 85vh; 
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

/* Feedback modal needs form to take full height */
#sf-feedback-modal .sf-modal-inner form {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    flex: 1;
    overflow: hidden;
}

/* Scrollable content area */
.sf-modal-scrollable-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 32px;
    padding-bottom: 20px;
    min-height: 0;
}

/* Sticky buttons at bottom of modal */
.sf-modal-sticky-buttons {
    display: flex;
    gap: 12px;
    padding: 16px 32px;
    background: white;
    border-top: 2px solid #e5e7eb;
    flex-shrink: 0;
}

/* Modal that doesn't have sticky buttons (comments modal) - needs special structure */
#sf-modal .sf-modal-inner {
    display: flex;
    flex-direction: column;
}

#sf-modal .sf-modal-inner h3 {
    padding: 32px 32px 0 32px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

#sf-modal .sf-modal-summary {
    padding: 0 32px 16px 32px;
    background: #f9fafb;
    border-radius: 8px;
    margin: 0 32px 16px 32px;
    flex-shrink: 0;
}

#sf-modal .sf-modal-body-wrapper {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 32px;
    padding-bottom: 20px;
    min-height: 0;
}

#sf-modal .sf-modal-buttons {
    padding: 16px 32px;
    border-top: 2px solid #e5e7eb;
    flex-shrink: 0;
}

/* Photo carousel modal */
#sf-photo-carousel-modal .sf-modal-inner {
    display: block;
    padding: 32px;
    overflow-y: auto;
}

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

.sf-modal-inner h3 {
    margin-top: 0;
    color: #2f5d2f;
    font-size: 24px;
    margin-bottom: 20px;
    padding: 32px 32px 0 32px;
}

#sf-feedback-modal .sf-modal-inner h3 {
    padding: 24px 32px 0 32px;
    margin-bottom: 0;
    flex-shrink: 0;
}

#sf-feedback-modal .sf-modal-scrollable-content {
    padding-top: 24px;
}

.sf-modal-inner form p {
    margin: 0 0 16px 0;
}

.sf-modal-inner form p:last-of-type {
    margin-bottom: 0;
}

.sf-modal-inner input[type="text"],
.sf-modal-inner input[type="number"],
.sf-modal-inner textarea {
    box-sizing: border-box;
}

.sf-modal-close {
    margin-top: 16px;
    width: 100%;
    padding: 12px 20px;
}

/* Comments */
.sf-comments-list {
    /* Remove max-height to prevent double scrollbar */
}

.sf-comment {
    border-bottom: 2px solid #f3f4f6;
    padding: 16px 0;
}

.sf-comment:last-child {
    border-bottom: none;
}

.sf-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sf-comment-score {
    color: #2f5d2f;
    font-weight: 700;
    font-size: 15px;
}

.sf-comment-date {
    color: #9ca3af;
    font-size: 13px;
}

.sf-comment-text {
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
}

.sf-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

/* Star Rating System */
.sf-star-rating {
    display: flex;
    gap: 6px;
    font-size: 38px;
    cursor: pointer;
    line-height: 1;
}

.sf-star {
    color: #d1d5db;
    transition: color 0.2s;
    user-select: none;
    line-height: 1;
}

.sf-star:hover,
.sf-star.active {
    color: #fbbf24;
}

/* Mobile adjustments for star ratings */
@media (max-width: 768px) {
    .sf-star-rating {
        font-size: 36px;
        gap: 5px;
        width: 100%;
        justify-content: center;
    }
    
    .sf-rating-descriptor {
        font-size: 12px !important;
    }
    
    /* Hide desktop layout on mobile */
    .sf-rating-wrapper > div:first-child,
    .sf-rating-wrapper > div:last-child {
        display: none !important;
    }
    
    /* Show mobile top labels */
    .sf-rating-top-labels {
        display: flex !important;
    }
    
    /* Make wrapper full width */
    .sf-rating-wrapper {
        width: 100%;
        justify-content: center !important;
    }
    
    /* Stack individual ratings in comments modal */
    .sf-ratings-row {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

/* Style dropdowns */
select {
    color: #1f2937 !important;
}

.sf-star-display {
    display: inline-flex;
    gap: 2px;
    font-size: 16px;
    line-height: 1;
}

.sf-star-display .sf-star {
    cursor: default;
    color: #2f5d2f;
    line-height: 1;
}

.sf-star-display .sf-star.empty {
    color: #d1d5db;
}

/* Partial star styles */
.sf-star-partial {
    position: relative;
    display: inline-block;
    line-height: 1;
}

.sf-star-partial .sf-star {
    line-height: 1;
    display: inline-block;
}

.sf-star-partial .sf-star.empty {
    color: #d1d5db;
    position: relative;
    z-index: 1;
}

.sf-star-partial .sf-star:not(.empty) {
    color: #2f5d2f;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
}

/* Review Badge Overlay - FIXED: Limited z-index to only overlay within card */
.sf-review-badge {
    position: absolute;
    top: 8px;
    right: -12px;
    background: #2f5d2f;
    color: white !important;
    padding: 10px 14px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none !important;
    /* IMPORTANT: Low z-index that only works within card's stacking context */
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 100px;
    line-height: 1.2;
}

.sf-review-badge:hover {
    background: #245024;
    transform: scale(1.08);
    box-shadow: 0 0 15px 3px rgba(34, 197, 94, 0.9), 0 0 25px 5px rgba(34, 197, 94, 0.5), 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* Underline "View Grow Report" text in the badge */
.sf-review-badge > div:last-child {
    text-decoration: underline;
}

/* Force full width for seed finder on breeder pages */
.post-type-archive-breeder #seed-finder-root,
.single-breeder #seed-finder-root {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Photo preview in submission form */
#sf-photo-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #d1d5db;
}

/* Photo display in comments */
.sf-comment-photos {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}

.sf-comment-photo-thumb {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.sf-comment-photo-thumb:hover {
    transform: scale(1.05);
}

.sf-comment-photo-thumb img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #2f5d2f;
}

.sf-photo-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: #f3f4f6;
    border-radius: 8px;
    border: 2px solid #d1d5db;
    font-weight: 600;
    color: #2f5d2f;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.sf-photo-more:hover {
    background: #e5e7eb;
    border-color: #2f5d2f;
}

/* Carousel styles */
.sf-carousel-btn:hover {
    background: rgba(47,93,47,1) !important;
}

#sf-carousel-images img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
}

/* Desktop optimization - keep consistent with mobile */
@media (min-width: 769px) {
    .sf-filters-container {
        padding: 0;
    }
    
    .sf-filter-group {
        margin-bottom: 0;
    }
    
    .sf-accordion-item {
        margin: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sf-grid {
        grid-template-columns: 1fr;
    }
    
    .sf-modal-inner {
        max-height: 90vh;
    }
    
    #sf-feedback-modal .sf-modal-inner form {
        max-height: 90vh;
    }
    
    .sf-modal-scrollable-content {
        padding: 20px;
    }
    
    #sf-feedback-modal .sf-modal-scrollable-content {
        padding-top: 16px;
    }
    
    .sf-modal-sticky-buttons {
        padding: 12px 20px;
    }
    
    #sf-feedback-modal .sf-modal-inner h3 {
        padding: 16px 20px 0 20px;
    }
    
    #sf-modal .sf-modal-inner h3 {
        padding: 20px 20px 0 20px;
    }
    
    #sf-modal .sf-modal-summary {
        padding: 0 20px 12px 20px;
        margin: 0 20px 12px 20px;
    }
    
    #sf-modal .sf-modal-body-wrapper {
        padding: 0 20px;
        padding-bottom: 16px;
    }
    
    #sf-modal .sf-modal-buttons {
        padding: 12px 20px;
    }
    
    .sf-filters-container {
        padding: 0;
    }
    
    .sf-card-buy-container {
        padding: 0 5px;
    }
    
    .sf-accordion-header {
        font-size: 14px;
        padding: 14px 16px;
    }
    
    .sf-accordion-content {
        padding: 14px 16px 16px 16px;
    }
    
    .sf-filter-btn {
        font-size: 12px;
        padding: 8px 14px;
    }
    
    .sf-search-wrapper {
        padding: 14px 16px;
    }
    
    .sf-filter-actions {
        padding: 14px 16px;
    }
    
    .sf-sort-container {
        margin-top: 16px;
    }
    
    .sf-sort-select-compact {
        min-width: 140px;
        font-size: 13px;
    }
    
    .sf-sort-label {
        font-size: 14px;
    }
    
    /* Adjust badge on mobile to not hang off as much */
    .sf-review-badge {
        right: -8px;
        min-width: 90px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    #seed-finder-root {
        padding: 12px;
    }
    
    .sf-card {
        padding: 16px;
    }
    
    .sf-card-buy-container {
        padding: 0;
    }
    
    .sf-modal-scrollable-content {
        padding: 16px;
    }
    
    #sf-feedback-modal .sf-modal-scrollable-content {
        padding-top: 12px;
    }
    
    .sf-modal-sticky-buttons {
        padding: 12px 16px;
    }
    
    #sf-feedback-modal .sf-modal-inner h3 {
        padding: 12px 16px 0 16px;
    }
    
    #sf-modal .sf-modal-inner h3 {
        padding: 16px 16px 0 16px;
    }
    
    #sf-modal .sf-modal-summary {
        padding: 0 16px 12px 16px;
        margin: 0 16px 12px 16px;
    }
    
    #sf-modal .sf-modal-body-wrapper {
        padding: 0 16px;
        padding-bottom: 12px;
    }
    
    #sf-modal .sf-modal-buttons {
        padding: 12px 16px;
    }
    
    .sf-accordion-item {
        margin: 0;
    }
    
    .sf-accordion-header {
        padding: 12px 14px;
    }
    
    .sf-accordion-content {
        padding: 12px 14px;
    }
    
    .sf-review-badge {
        right: -6px;
        min-width: 85px;
        padding: 7px 10px;
    }
}