/* MyshopUI 팝업 (관리 페이지 등 myshop.css 미로드 환경) */
:root {
    --myshop-z-popup: 3500;
    --myshop-z-popup-detail: 3510;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--myshop-z-popup, 3500);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
}

.popup-container {
    background-color: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    color-scheme: light;
}

.popup-overlay.active .popup-container {
    transform: translateY(0);
}

.popup-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
}

.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
}

.popup-close:hover {
    color: #1f2937;
}

.popup-content {
    padding: 16px;
    color: #4b5563;
}

.popup-container.myshop-stats-popup-container {
    max-width: 720px;
    width: calc(100% - 32px);
}

@media (min-width: 768px) {
    .popup-container.myshop-stats-popup-container {
        max-width: 920px;
        width: min(92vw, 920px);
    }

    .popup-container.myshop-stats-popup-container .popup-content {
        padding: 20px 24px;
    }

    .popup-container.myshop-stats-popup-container .myshop-stats-popup-header {
        padding: 16px 24px;
        min-height: 56px;
    }

    .popup-container.myshop-stats-popup-container .myshop-stats-popup-header .popup-title {
        font-size: 20px;
    }

    .myshop-stats-popup {
        gap: 18px;
    }

    .myshop-stats-summary {
        gap: 12px;
    }

    .myshop-stats-summary__item {
        padding: 12px 16px;
        min-height: 48px;
    }

    .myshop-stats-summary__label {
        font-size: 12px;
    }

    .myshop-stats-summary__metric,
    .myshop-stats-summary__sep {
        font-size: 13px;
    }

    .myshop-stats-summary__metric strong {
        font-size: 15px;
    }

    .myshop-stats-chart-wrap {
        height: 300px;
        padding: 12px 8px 0;
    }

    .myshop-stats-chart-legend {
        top: 32px;
        left: 56px;
        gap: 16px;
    }

    .myshop-stats-chart-legend__item {
        font-size: 12px;
    }

    .myshop-stats-table {
        font-size: 14px;
    }

    .myshop-stats-table th,
    .myshop-stats-table td {
        padding: 12px 16px;
    }

    .myshop-stats-paging__btn,
    .myshop-stats-paging__info {
        font-size: 14px;
    }
}

@media (min-width: 1024px) {
    .popup-container.myshop-stats-popup-container {
        max-width: 1040px;
        width: min(94vw, 1040px);
    }

    .myshop-stats-chart-wrap {
        height: 340px;
    }
}

.popup-container.myshop-stats-popup-container .myshop-stats-popup-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: 'title close';
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    min-height: 52px;
}

.popup-container.myshop-stats-popup-container .myshop-stats-popup-header.has-back {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: 'back title close';
}

.popup-container.myshop-stats-popup-container .myshop-stats-popup-header .myshop-stats-header-back {
    grid-area: back;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0369a1;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.popup-container.myshop-stats-popup-container .myshop-stats-popup-header .myshop-stats-header-back.hidden {
    display: none;
}

.popup-container.myshop-stats-popup-container .myshop-stats-popup-header .myshop-stats-header-back:hover {
    color: #0284c7;
}

.popup-container.myshop-stats-popup-container .myshop-stats-popup-header .myshop-stats-header-back__icon {
    width: 16px;
    height: 16px;
}

.popup-container.myshop-stats-popup-container .myshop-stats-popup-header .popup-title {
    grid-area: title;
    min-width: 0;
    max-width: 100%;
    padding: 0 4px;
    line-height: 1.3;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popup-container.myshop-stats-popup-container .myshop-stats-popup-header .popup-close {
    grid-area: close;
    position: static;
    top: auto;
    right: auto;
    justify-self: end;
}

.myshop-stats-popup {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.myshop-stats-shop-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0369a1;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.myshop-stats-shop-link:hover {
    color: #0284c7;
}

.myshop-stats-shop-link:hover .myshop-stats-shop-link__text {
    text-decoration: underline;
}

.myshop-stats-shop-link__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.myshop-stats-shop-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.myshop-stats-shop-thumb__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.myshop-stats-shop-thumb__fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #64748b;
}

.myshop-stats-shop-thumb__icon {
    width: 14px;
    height: 14px;
}

.myshop-stats-table .myshop-stats-shop-row__title {
    text-align: left;
}

.myshop-stats-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.myshop-stats-summary__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    min-height: 40px;
    min-width: 0;
}

.myshop-stats-summary__label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    line-height: 1.2;
}

.myshop-stats-summary__metrics {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
}

.myshop-stats-summary__metric {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

.myshop-stats-summary__sep {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1;
}

.myshop-stats-summary__metric strong {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.myshop-stats-chart-wrap {
    position: relative;
    height: 220px;
    padding: 8px 4px 0;
    background: #fff;
}

.myshop-stats-chart-legend {
    position: absolute;
    top: 28px;
    left: 48px;
    z-index: 2;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    pointer-events: none;
}

.myshop-stats-chart-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: #475569;
    white-space: nowrap;
}

.myshop-stats-chart-legend__dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.myshop-stats-chart-legend__dot.is-visit {
    background: #0ea5e9;
}

.myshop-stats-chart-legend__dot.is-click {
    background: #f97316;
}

.myshop-stats-table-wrap {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.myshop-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.myshop-stats-table thead {
    background: #f8fafc;
}

.myshop-stats-table th,
.myshop-stats-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid #eef2f7;
}

.myshop-stats-table th:first-child,
.myshop-stats-table td:first-child {
    text-align: left;
}

.myshop-stats-table tbody tr:last-child td {
    border-bottom: none;
}

.myshop-stats-table__empty {
    color: #94a3b8;
    padding: 24px 12px !important;
    text-align: center !important;
}

.myshop-stats-paging {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.myshop-stats-paging__btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font-size: 13px;
    cursor: pointer;
}

.myshop-stats-paging__btn:hover:not(:disabled) {
    background: #f8fafc;
}

.myshop-stats-paging__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.myshop-stats-paging__info {
    font-size: 13px;
    color: #64748b;
}

.header-toolbar-action--stats {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.header-toolbar-action--stats:hover {
    background: #e0f2fe;
}

@media (max-width: 640px) {
    .myshop-stats-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .myshop-stats-summary__item {
        padding: 6px 8px;
        gap: 3px;
        min-height: 34px;
    }

    .myshop-stats-summary__label {
        font-size: 10px;
    }

    .myshop-stats-summary__metrics {
        gap: 4px;
    }

    .myshop-stats-summary__metric,
    .myshop-stats-summary__sep {
        font-size: 10px;
    }

    .myshop-stats-summary__metric strong {
        font-size: 11px;
    }

    .myshop-stats-paging {
        flex-wrap: wrap;
        justify-content: center;
    }

    .myshop-stats-paging__info {
        width: 100%;
        text-align: center;
        order: -1;
    }
}
