/* General container styling */
.fooconvert-stats-container {
    font-family: Arial, sans-serif;
    max-width: 1280px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        'header'
        'metrics'
        'activity';
    gap: 20px;
    margin: 20px 0 0;
}

.fooconvert-stats-container h2 {
    font-size: 20px;
    margin: 0;
    color: #333;
}

.fooconvert-stats-container.has-sales-panel {
    grid-template-areas:
        'header'
        'metrics'
        'activity'
        'sales';
}

.fooconvert-stats-header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.fooconvert-stats-header .right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.fooconvert-stats-header .right .button.fooconvert-button-with-icon {
    white-space: nowrap;
}

.fooconvert-stats-header .right .button.fooconvert-button-with-icon .fooconvert-button-with-icon__icon {
    width: 14px;
    height: 14px;
    font-size: 14px;
    line-height: 1;
    vertical-align: text-top;
    padding-left: 5px;
}

/* Metrics layout */
.fooconvert-basic-metrics {
    grid-area: metrics;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    align-content: start;
}

.metric {
    position: relative;
    z-index: 0;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform 0.2s ease;
    min-width: 0;
}

.metric:hover,
.metric:focus-within {
    transform: translateY(-5px);
    z-index: 2;
}

.metric.metric-sales {
    background: linear-gradient(135deg, #f3fff7 0%, #ffffff 100%);
    border-color: rgba(16, 124, 65, 0.25);
}

.metric h2 {
    font-size: 12px;
    color: #555;
    margin: 0;
}

.metric p {
    font-size: 22px;
    font-weight: bold;
    color: #333;
}

.metric.pro-feature {
    position: relative;
    border-color: rgba(0, 123, 255, 0.25);
}

.metric.pro-feature p {
    filter: blur(5px);
    user-select: none;
    color: #666;
}

.metric.pro-feature::before {
    content: 'PRO';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 123, 255, 0.1);
    color: #0d6efd;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.pro-info-panel {
    grid-column: 1 / -1;
    background-color: rgba(0, 123, 255, 0.05);
    border: 1px solid rgba(0, 123, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pro-info-panel i {
    color: #0d6efd;
    font-size: 20px;
}

.pro-info-panel p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.pro-info-panel a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.pro-info-panel a:hover {
    text-decoration: underline;
}

/* Shimmer effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.metric.loading span {
    color: transparent !important;
}

.metric.loading {
    position: relative;
    overflow: hidden;
}

.metric.loading::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, rgba(240, 240, 240, 0.7) 25%, rgba(224, 224, 224, 0.7) 50%, rgba(240, 240, 240, 0.7) 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

.fooconvert-recent-activity-container.loading {
    position: relative;
    min-height: 340px;
    overflow: hidden;
}

.fooconvert-recent-activity-container.loading::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

.fooconvert-recent-activity-container.loading canvas {
    opacity: 0;
}

/* Chart containers */
.fooconvert-recent-activity-container {
    grid-area: activity;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    min-width: 0;
}

.fooconvert-recent-activity-container h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
}

.fooconvert-sales-panel-container {
    grid-area: sales;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    min-width: 0;
    align-self: start;
}

.fooconvert-sales-panel {
    display: grid;
    gap: 20px;
}

.fooconvert-sales-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.fooconvert-sales-panel-header p {
    margin: 4px 0 0;
    color: #666;
}

.fooconvert-sales-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.fooconvert-sales-summary .metric {
    min-height: 120px;
}

.fooconvert-sales-table-content {
    min-width: 0;
    min-height: 180px;
}

.fooconvert-sales-panel-container.loading {
    position: relative;
}

.fooconvert-sales-panel-container.loading .fooconvert-sales-table-content {
    position: relative;
    overflow: hidden;
}

.fooconvert-sales-panel-container.loading .fooconvert-sales-table-content::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

.fooconvert-sales-panel-container.loading .fooconvert-sales-table-content > * {
    opacity: 0;
}

.fooconvert-sales-panel h2 {
    margin-bottom: 0;
}

.fooconvert-sales-empty {
    margin: 0;
    color: #666;
}

.fooconvert-sales-table-wrapper {
    overflow-x: auto;
}

.fooconvert-sales-table th:last-child,
.fooconvert-sales-table td:last-child,
.fooconvert-sales-table th:nth-child(3),
.fooconvert-sales-table td:nth-child(3) {
    white-space: nowrap;
}

@media (min-width: 1100px) {
    .fooconvert-stats-container.has-sales-panel {
        grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
        grid-template-areas:
            'header header'
            'metrics sales'
            'activity sales';
        align-items: start;
    }
}

@media (max-width: 900px) {
    .fooconvert-stats-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .fooconvert-stats-header .right {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .fooconvert-basic-metrics,
    .fooconvert-sales-summary {
        grid-template-columns: 1fr;
    }

    .fooconvert-sales-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
