/**
 * Hawaii Seafood Retailers - Frontend Styles
 */

/* CSS Variables for easy theming */
:root {
    --hsr-primary: #0073aa;
    --hsr-primary-hover: #005177;
    --hsr-text: #333;
    --hsr-text-light: #666;
    --hsr-border: #ddd;
    --hsr-bg: #f9f9f9;
    --hsr-white: #fff;
    --hsr-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --hsr-radius: 8px;
    --hsr-tag-bg: #e8f4f8;
    --hsr-tag-text: #0073aa;
}

/* Container */
.hsr-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Filters Bar */
.hsr-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--hsr-white);
    border-radius: var(--hsr-radius);
    box-shadow: var(--hsr-shadow);
    align-items: center;
}

/* Search */
.hsr-search-wrap {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    position: relative;
}

.hsr-search-input {
    width: 100%;
    padding: 10px 90px 10px 15px;
    border: 2px solid var(--hsr-border);
    border-radius: 25px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    outline: none;
}

.hsr-search-input:focus {
    border-color: var(--hsr-primary);
}

.hsr-search-btn {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    border: none;
    background: var(--hsr-primary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.hsr-search-btn:hover {
    background: var(--hsr-primary-hover);
}

.hsr-search-btn.hsr-loading-active .hsr-icon-search {
    display: none;
}

.hsr-search-btn.hsr-loading-active::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hsr-spin 0.6s linear infinite;
}

.hsr-location-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    border: 2px solid var(--hsr-border);
    background: var(--hsr-white);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.hsr-location-btn:hover {
    border-color: var(--hsr-primary);
    background: var(--hsr-primary);
}

.hsr-location-btn:hover .hsr-icon-location {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E");
}

/* Filter Controls */
.hsr-filter-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
}

.hsr-island-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hsr-island-pill {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--hsr-border);
    background: var(--hsr-white);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.hsr-island-pill:hover {
    border-color: var(--hsr-primary);
}

.hsr-island-pill.active {
    background: var(--hsr-primary);
    color: var(--hsr-white);
    border-color: var(--hsr-primary);
}

.hsr-filter-controls select {
    padding: 10px 35px 10px 15px;
    border: 2px solid var(--hsr-border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--hsr-white);
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.hsr-filter-controls select:focus {
    border-color: var(--hsr-primary);
}

/* Location Status */
.hsr-location-status {
    margin-bottom: 15px;
}

.hsr-location-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--hsr-tag-bg);
    border: 1px solid var(--hsr-primary);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--hsr-primary);
}

.hsr-location-chip .hsr-icon-location {
    width: 16px;
    height: 16px;
}

.hsr-location-clear {
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: var(--hsr-primary);
    cursor: pointer;
    padding: 0 0 0 4px;
    margin-left: 4px;
    transition: color 0.3s ease;
}

.hsr-location-clear:hover {
    color: var(--hsr-primary-hover);
}

/* Search Error */
.hsr-search-error {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    padding: 8px 12px;
    background: #f44336;
    color: white;
    border-radius: 6px;
    font-size: 13px;
    z-index: 999;
}

/* Autocomplete */
.hsr-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: var(--hsr-white);
    border: 2px solid var(--hsr-border);
    border-radius: 8px;
    box-shadow: var(--hsr-shadow);
    max-height: 300px;
    overflow-y: auto;
    z-index: 999;
}

.hsr-autocomplete-item {
    display: block;
    padding: 12px 15px;
    border-bottom: 1px solid var(--hsr-bg);
    text-decoration: none;
    color: var(--hsr-text);
    cursor: pointer;
    transition: background 0.2s ease;
}

.hsr-autocomplete-item:hover,
.hsr-autocomplete-item.hsr-autocomplete-selected {
    background: var(--hsr-bg);
}

.hsr-autocomplete-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.hsr-autocomplete-location {
    font-size: 12px;
    color: var(--hsr-text-light);
}

.hsr-autocomplete-all {
    display: block;
    padding: 12px 15px;
    text-align: center;
    color: var(--hsr-primary);
    font-weight: 600;
    text-decoration: none;
    border-top: 2px solid var(--hsr-border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.hsr-autocomplete-all:hover {
    background: var(--hsr-bg);
}

/* Results Info */
.hsr-results-info {
    margin-bottom: 15px;
    color: var(--hsr-text-light);
    font-size: 14px;
}

/* Retailers Grid */
.hsr-retailers-grid {
    display: grid;
    gap: 20px;
}

.hsr-view-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}


/* Retailer Card */
.hsr-retailer-card {
    background: var(--hsr-white);
    border-radius: var(--hsr-radius);
    box-shadow: var(--hsr-shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hsr-retailer-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

/* Card Header */
.hsr-card-header {
    padding: 20px;
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: var(--hsr-white);
    text-align: center;
}

.hsr-retailer-name {
    margin: 0 0 15px;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.hsr-retailer-name a {
    color: var(--hsr-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.hsr-retailer-name a:hover {
    color: var(--hsr-primary-hover);
    text-decoration: underline;
}

.hsr-retailer-logo {
    width: 100%;
    max-width: 500px;
    max-height: 200px;
    margin: 0 auto 15px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--hsr-white);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.hsr-retailer-logo img {
    width: 100%;
    height: auto;
    max-height: 200px;
    display: block;
    object-fit: contain;
}

/* Card Body */
.hsr-card-body {
    padding: 20px;
}

.hsr-card-body > div {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--hsr-text);
}

.hsr-card-body > div:last-child {
    margin-bottom: 0;
}

.hsr-card-body a {
    color: var(--hsr-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.hsr-card-body a:hover {
    color: var(--hsr-primary-hover);
    text-decoration: underline;
}

.hsr-retailer-description {
    display: block;
    color: var(--hsr-text-light);
    line-height: 1.5;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--hsr-border);
}

/* Icons */
.hsr-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.hsr-icon-location {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230073aa'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E");
}

.hsr-icon-phone {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230073aa'%3E%3Cpath d='M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z'/%3E%3C/svg%3E");
}

.hsr-icon-email {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230073aa'%3E%3Cpath d='M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E");
}

.hsr-icon-website {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230073aa'%3E%3Cpath d='M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z'/%3E%3C/svg%3E");
}

.hsr-icon-search {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
}


/* Card Footer */
.hsr-card-footer {
    padding: 15px 20px;
    background: var(--hsr-bg);
    border-top: 1px solid var(--hsr-border);
}

/* Business Type Tags */
.hsr-business-type-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hsr-business-type-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hsr-business-type-retailer {
    background: #e8f4f8;
    color: #0073aa;
}

.hsr-business-type-restaurant {
    background: #fef3e2;
    color: #b35900;
}

.hsr-business-type-wholesaler {
    background: #e8f5e9;
    color: #2e7d32;
}


/* Pagination */
.hsr-pagination-wrap {
    margin-top: 30px;
}

.hsr-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--hsr-white);
    border-radius: var(--hsr-radius);
    box-shadow: var(--hsr-shadow);
}

.hsr-pagination-info {
    color: var(--hsr-text-light);
    font-size: 14px;
}

.hsr-pagination-links {
    display: flex;
    gap: 5px;
}

.hsr-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--hsr-border);
    background: var(--hsr-white);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hsr-page-btn:hover {
    border-color: var(--hsr-primary);
    color: var(--hsr-primary);
}

.hsr-page-btn.active {
    background: var(--hsr-primary);
    border-color: var(--hsr-primary);
    color: var(--hsr-white);
}

/* No Results */
.hsr-no-results {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: var(--hsr-text-light);
    font-size: 16px;
}

/* Loading */
.hsr-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--hsr-text-light);
}

.hsr-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--hsr-border);
    border-top-color: var(--hsr-primary);
    border-radius: 50%;
    animation: hsr-spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .hsr-filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .hsr-search-wrap {
        max-width: none;
    }

    .hsr-filter-controls {
        flex-direction: column;
    }

    .hsr-filter-controls select {
        width: 100%;
    }

    .hsr-view-grid {
        grid-template-columns: 1fr;
    }

    .hsr-island-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .hsr-retailer-logo {
        max-width: 100%;
    }

    .hsr-pagination {
        flex-direction: column;
        text-align: center;
    }

    .hsr-pagination-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hsr-container {
        padding: 10px 0;
    }

    .hsr-filters-bar,
    .hsr-retailer-card,
    .hsr-pagination {
        border-radius: 0;
    }

    .hsr-card-header,
    .hsr-card-body,
    .hsr-card-footer {
        padding: 15px;
    }

    .hsr-retailer-name {
        font-size: 1.1rem;
    }

    .hsr-business-type-tag {
        font-size: 11px;
        padding: 3px 8px;
    }

    .hsr-retailer-logo {
        max-width: 100%;
    }
}

/* Animation for cards appearing */
.hsr-retailer-card {
    animation: hsr-fadeIn 0.4s ease-out;
}

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


/* Header Meta (island + distance) */
.hsr-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

/* Distance Badge */
.hsr-retailer-distance {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

/* ==========================================
   Single Retailer Page Styles
   ========================================== */

.hsr-single-container {
    margin: 0 auto;
    padding: 30px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.hsr-single-back {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--hsr-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.hsr-single-back:hover {
    color: var(--hsr-primary-hover);
}

/* Unified card */
.hsr-single-card {
    background: var(--hsr-white);
    border-radius: var(--hsr-radius);
    box-shadow: var(--hsr-shadow);
    overflow: hidden;
}

.hsr-single-header {
    padding: 25px 30px;
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: var(--hsr-white);
    text-align: center;
}

.hsr-single-logo {
    max-width: 300px;
    max-height: 150px;
    margin: 0 auto 15px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--hsr-white);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.hsr-single-logo img {
    width: 100%;
    height: auto;
    max-height: 150px;
    display: block;
    object-fit: contain;
}

.hsr-single-name {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--hsr-white);
}

.hsr-single-business-type {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hsr-single-type-retailer {
    background: rgba(255, 255, 255, 0.25);
    color: var(--hsr-white);
}

.hsr-single-type-restaurant {
    background: rgba(255, 255, 255, 0.25);
    color: var(--hsr-white);
}

.hsr-single-type-wholesaler {
    background: rgba(255, 255, 255, 0.25);
    color: var(--hsr-white);
}

/* Body layout — details left, video right */
.hsr-single-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 0;
    align-items: start;
}

/* Full-width when no videos */
.hsr-single-layout.hsr-no-videos {
    grid-template-columns: 1fr;
}

/* Details column */
.hsr-single-details {
    min-width: 0;
}

.hsr-single-body {
    padding: 30px;
}

.hsr-single-info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 15px;
    color: var(--hsr-text);
}

.hsr-single-info-row:last-child {
    margin-bottom: 0;
}

.hsr-single-info-row a {
    color: var(--hsr-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.hsr-single-info-row a:hover {
    color: var(--hsr-primary-hover);
    text-decoration: underline;
}

.hsr-single-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--hsr-border);
    color: var(--hsr-text);
    line-height: 1.7;
    font-size: 15px;
}

/* Video column */
.hsr-single-videos {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 24px 24px 24px 0;
}

.hsr-video-embed {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    aspect-ratio: 9 / 16;
    width: 100%;
    max-width: 280px;
}

.hsr-video-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Map embed (inside details, above contact info) */
.hsr-single-map {
    width: 100%;
    height: 250px;
}

.hsr-single-map .leaflet-container {
    width: 100%;
    height: 100%;
}

/* Single page responsive */
@media (max-width: 768px) {
    .hsr-single-layout {
        grid-template-columns: 1fr;
    }

    .hsr-single-videos {
        padding: 20px;
        order: -1;
    }

    .hsr-video-embed {
        max-width: 260px;
    }

    .hsr-single-header {
        padding: 20px;
    }

    .hsr-single-name {
        font-size: 1.4rem;
    }

    .hsr-single-body {
        padding: 20px;
    }

    .hsr-single-map {
        height: 200px;
    }
}

/* Print styles */
@media print {
    .hsr-filters-bar,
    .hsr-pagination,
    .hsr-location-status,
    .hsr-single-back,
    .hsr-single-videos,
    #hsr-retailer-map {
        display: none;
    }

    .hsr-retailer-card,
    .hsr-single-details {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .hsr-single-layout {
        grid-template-columns: 1fr;
    }
}
