/* Page styles: store details and store-facing sections. */

/* استایل‌های مربوط به فروشگاه */
.store-name {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.store-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.store-link:hover {
    text-decoration: underline;
}

.store-details-header {
    margin-bottom: 18px;
    padding: 10px 0 20px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

#storeDetailsModal .fullscreen-modal-content {
    padding: 0 20px 20px;
    height: calc(100% - 94px);
    margin-top: 0;
}

.store-products-load-sentinel {
    grid-column: 1 / -1;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    color: var(--text-secondary, #666);
    text-align: center;
}

.store-products-inline-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.store-products-retry-btn {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid currentColor;
    border-radius: 12px;
    color: var(--primary-color, #6c4cff);
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.store-products-retry-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, currentColor 35%, transparent);
    outline-offset: 3px;
}

#storeDetailsModal > .platform-shared-header {
    margin: 15px 15px 15px;
    width: auto;
}

#storeDetailsModal .store-details-close-btn {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 4;
    box-shadow: none;
    transition: background 0.2s ease, color 0.2s ease;
}

#storeDetailsModal .store-details-close-btn:hover,
#storeDetailsModal .store-details-close-btn:focus-visible {
    background: transparent;
    color: var(--primary-color, #ef4444);
}

#storeDetailsModal .store-details-close-btn svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.theme-dark #storeDetailsModal .store-details-close-btn {
    background: transparent;
    border-color: transparent;
    color: #f8fafc;
}

body.theme-dark #storeDetailsModal .store-details-close-btn:hover,
body.theme-dark #storeDetailsModal .store-details-close-btn:focus-visible {
    background: transparent;
    color: #ff3b3b;
}

.store-details-header h2 {
    margin-bottom: 5px;
    color: #333;
}

.store-details-top-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "identity cta"
        "description description";
    align-items: flex-start;
    gap: 10px;
}

.store-details-identity {
    grid-area: identity;
    flex: 1;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.store-province-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.store-province-badge {
    position: relative;
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #ef4444;
    background: #fff1f2;
    border: 1px solid #ffe4e6;
    border-radius: 999px;
    padding: 4px 38px 4px 11px;
    margin-bottom: 6px;
    margin-left: 0;
    left: 0;
    align-self: flex-start;
    isolation: isolate;
    line-height: 1.3;
    white-space: nowrap;
}

.share-link-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    transition: none;
    flex-shrink: 0;
}

.share-link-btn:hover {
    background: transparent;
    color: #1e40af;
}

.share-link-btn.copied {
    background: transparent;
    color: #16a34a;
    box-shadow: none;
}

.share-link-btn-icon {
    width: 21px;
    height: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.share-link-btn-icon svg {
    width: 100%;
    height: 100%;
}

.store-province-badge::before {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ef4444' d='M12 2a7 7 0 0 0-7 7c0 5.25 7 13 7 13s7-7.75 7-13a7 7 0 0 0-7-7Zm0 9.25A2.25 2.25 0 1 1 12 6.75a2.25 2.25 0 0 1 0 4.5Z'/%3E%3C/svg%3E");
    opacity: 0.58;
    pointer-events: none;
    z-index: 0;
}

.store-province-text {
    position: relative;
    z-index: 1;
}

.store-details-avatar {
    margin-top: 4px;
    margin-left: 0;
    transform: translateY(6px);
    width: 98px;
    height: 98px;
    border-radius: 50%;
    position: relative;
    background: radial-gradient(circle at center, rgba(239, 68, 68, 0.24) 0%, rgba(239, 68, 68, 0.1) 65%, rgba(239, 68, 68, 0) 100%);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.store-details-avatar.has-active-story {
    background: conic-gradient(
        from 160deg,
        #22c55e 0deg,
        #16a34a 110deg,
        #4ade80 210deg,
        #15803d 300deg,
        #22c55e 360deg
    );
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9) inset, 0 8px 24px rgba(34, 197, 94, 0.32);
}

.store-details-avatar.has-active-story.all-stories-seen {
    background: conic-gradient(
        from 150deg,
        #d1d5db 0deg,
        #c4c9d2 120deg,
        #e5e7eb 230deg,
        #bfc5cf 320deg,
        #d1d5db 360deg
    );
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9) inset, 0 8px 22px rgba(148, 163, 184, 0.25);
}

.store-details-avatar.is-story-uploading::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    pointer-events: none;
    background:
        conic-gradient(
            from 0deg,
            rgba(34, 197, 94, 0) 0deg 42deg,
            rgba(34, 197, 94, 0.95) 42deg 74deg,
            rgba(34, 197, 94, 0) 74deg 128deg,
            rgba(74, 222, 128, 0.85) 128deg 154deg,
            rgba(34, 197, 94, 0) 154deg 228deg,
            rgba(22, 163, 74, 0.92) 228deg 258deg,
            rgba(34, 197, 94, 0) 258deg 360deg
        );
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
    animation: store-story-upload-ring-rotate 1.15s linear infinite;
    filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.5));
}

.store-details-avatar.is-story-loading::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    pointer-events: none;
    border: 2px dashed rgba(22, 163, 74, 0.95);
    animation: story-entry-loading-spin 1s linear infinite;
    filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.45));
}

@keyframes store-story-upload-ring-rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes story-entry-loading-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.store-story-plus-btn {
    position: absolute;
    left: 2px;
    bottom: 4px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.34);
    cursor: pointer;
    z-index: 4;
}

.store-story-plus-btn i {
    line-height: 1;
}

.store-logo-img,
.store-logo-fallback {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ef4444;
    background: #fff;
}

.store-logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    font-size: 24px;
}

.store-details-name {
    margin-top: 12px;
    margin-bottom: 2px;
    font-size: 19px;
    font-weight: 800;
    text-align: left !important;
    align-self: flex-start;
}

.store-channel-subtle {
    margin-top: 0;
    margin-bottom: 4px;
    color: #9ca3af;
    font-size: 11px;
    text-align: left !important;
    justify-content: flex-start;
    align-self: flex-start;
}

.store-channel-subtle.copyable-channel-id {
    direction: ltr;
    margin-top: 2px;
    justify-content: flex-start;
}

.store-description-block {
    grid-area: description;
    width: 100%;
    max-width: none;
    text-align: right !important;
    align-self: flex-start;
    direction: rtl !important;
}

.store-description-text {
    display: block;
    margin: 0;
    color: #4b5563;
    font-size: 12px;
    line-height: 1.7;
    width: 100%;
    max-width: 100%;
    white-space: pre-line;
    word-break: normal;
    overflow-wrap: break-word;
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
}


.owner-store-description-input {
    direction: rtl !important;
    text-align: right !important;
}

.store-description-toggle {
    margin-top: 6px;
    border: none;
    background: transparent;
    color: #ef4444;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.store-description-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 700;
}

.store-inline-edit-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
}

.store-inline-edit-btn svg {
    width: 12px;
    height: 12px;
    display: block;
}

.store-avatar-edit-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 2;
}

.owner-store-description-editor {
    margin-top: 8px;
    width: 100%;
}

.owner-store-description-editor .owner-store-description-input {
    margin-bottom: 8px;
    width: 100% !important;
    min-height: 110px;
    max-width: none;
    display: block;
    box-sizing: border-box;
    resize: vertical;
}

.owner-store-description-save-btn {
    width: fit-content;
    padding: 2px 5px;
    border-radius: 6px;
    font-size: 8px;
    background: transparent !important;
    color: #1e40af !important;
    border: 1px solid #3b82f6 !important;
    align-self: flex-start;
    display: inline-flex;
    gap: 3px;
    line-height: 1.2;
}

.owner-store-description-save-btn::before {
    content: "";
    width: 12px;
    height: 12px;
    display: inline-block;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%233b82f6' d='M5 3h11l3 3v15H5V3Zm2 2v14h10V7.5L15.5 5H15v4H9V5H7Zm4 0v2h2V5h-2Z'/%3E%3C/svg%3E");
    opacity: 0.95;
}


.store-details-cta {
    grid-area: cta;
    display: flex;
    gap: 8px;
    align-self: flex-start;
    margin-top: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
    direction: rtl;
}

.store-chat-wrapper {
    position: relative;
    display: inline-flex;
    align-items: stretch;
}

.owner-store-admin-chat-edit-btn {
    position: absolute;
    top: -6px;
    right: -4px;
    z-index: 2;
    border-color: #22c55e;
    background: #ffffff;
    color: #16a34a;
}

.owner-store-admin-chat-edit-btn:hover,
.owner-store-admin-chat-edit-btn:focus-visible {
    border-color: #16a34a;
    background: #dcfce7;
    color: #166534;
}

.store-header-btn {
    border: 1px solid #d1d5db;
    border-radius: 9px;
    padding: 7px 12px;
    min-width: 74px;
    min-height: 34px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: #1f2937;
    white-space: nowrap;
}

.store-header-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.store-header-btn.btn-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    gap: 6px;
    overflow: hidden;
    padding: 7px 12px;
    line-height: 1;
    background: #ffffff;
    color: #111827;
    border-color: #e5e7eb;
}

.store-header-btn.btn-share-store {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    padding: 7px;
    background: #fef2f2;
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.18);
}

.store-header-btn.btn-share-store .share-link-btn-icon,
.store-header-btn.btn-share-store .share-link-btn-icon svg {
    width: 16px;
    height: 16px;
    display: inline-flex;
}

.store-header-btn.btn-share-store.copied {
    background: #dcfce7;
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.25);
}

.store-header-btn.btn-chat .store-chat-avatar-bg {
    position: static;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    flex-shrink: 0;
}

.store-header-btn.btn-chat .chat-btn-icon,
.store-header-btn.btn-chat .store-chat-label {
    position: static;
}

.store-header-btn.btn-chat .store-chat-label {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    color: #111827;
}

.store-header-btn.btn-channel {
    background: transparent;
    color: #1f2937;
}

.store-search-wrap {
    position: relative;
    margin-bottom: 8px;
}

.store-search-wrap .search-input {
    direction: rtl;
    text-align: right;
    text-align-last: right;
    padding-right: 38px;
    padding-left: 14px;
    line-height: 1.5;
}

.store-search-wrap .search-input::placeholder {
    direction: rtl;
    text-align: right;
}

.store-search-wrap .search-icon {
    right: 12px;
    left: auto;
    color: #9ca3af;
    font-size: 13px;
}

.store-search-wrap label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
}

.store-details-header .store-category-badge {
    align-self: flex-start;
    text-align: left;
}

@media (max-width: 640px) {
    .store-details-header {
        padding: 6px 0 12px;
        margin-bottom: 10px;
    }

    .store-details-top-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px;
    }

    .store-province-badge {
        font-size: 10px;
        padding: 3px 30px 3px 10px;
        margin-bottom: 4px;
        margin-left: 0;
        left: 0;
        line-height: 1.3;
    }

    .store-province-badge::before {
        right: 9px;
        width: 14px;
        height: 14px;
        opacity: 0.6;
    }

    .store-details-avatar {
        width: 88px;
        height: 88px;
        margin-top: 2px;
    }

    .store-logo-img,
    .store-logo-fallback {
        width: 74px;
        height: 74px;
    }

    .store-details-name {
        font-size: 17px;
        margin-top: 8px;
    }

    .store-channel-subtle {
        font-size: 10px;
        margin-bottom: 3px;
    }

    .store-description-text {
        font-size: 11px;
        line-height: 1.6;
    }

    .store-details-cta {
        top: 4px;
        gap: 5px;
        margin-top: 34px;
    }

    .store-header-btn {
        padding: 5px 7px;
        font-size: 10px;
        border-radius: 8px;
    }

    .store-products-section h3 {
        margin-bottom: 8px;
    }

    .store-search-wrap {
        margin-bottom: 6px;
    }
}

.channel-id {
    color: #666;
    font-size: 14px;
    direction: ltr;
    text-align: center;
}

.open-channel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    background-color: #2196F3;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    text-align: center;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
}

.open-channel-btn:hover {
    background-color: #0b7dda;
}

.open-channel-btn i {
    margin-left: 8px;
}

.open-store-chat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    flex-direction: row;
    gap: 8px;
    margin: 0;
    background-color: #2196F3;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    text-align: center;
    border: none;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.open-store-chat-btn .chat-btn-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    order: 2;
}

.open-store-chat-btn .chat-btn-label {
    order: 1;
}

.open-store-chat-btn i {
    margin: 0;
}

.open-store-chat-btn:hover {
    background-color: #0b7dda;
}

.store-contact-actions {
    width: 90%;
    margin: 0 auto 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.store-products-section {
    margin-top: 20px;
}

.store-products-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
    text-align: center;
}

.store-products-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

@media (min-width: 1024px) {
    .store-products-list {
        /* Keep card proportions close to mobile and add more columns on large screens */
        grid-template-columns: repeat(auto-fill, minmax(210px, 240px));
        justify-content: center;
        gap: 14px;
        max-height: 520px;
    }
}

.store-product-item {
    display: flex;
    background-color: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.store-product-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.product-image-container-small {
    width: 50px;
    height: 50px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

.product-image-container-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    color: #9e9e9e;
}

.no-image-small i {
    font-size: 20px;
}

.product-summary {
    padding: 8px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 11px;
    color: #4CAF50;
}
