.ddanalytics-wrap {
    margin: 20px 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ddanalytics-wrap h2 {
    margin-bottom: 20px;
}

.analytics-container {
    max-width: 1200px;
    width: 100%;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.stat-box {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-num {
    font-size: 24px;
    font-weight: 600;
    color: #2271b1;
    margin-bottom: 4px;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: #666;
}

/* Main Content */
.analytics-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr));
    gap: 15px;
    width: 100%;
}

.analytics-col {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0; /* Prevents overflow in flex items */
}

.analytics-box {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    width: 100%;
    min-width: 0; /* Prevents overflow */
}

.analytics-box h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #23282d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Charts */
.chart-container {
    height: 250px;
    position: relative;
    width: 100%;
}

/* Tables */
.table-container {
    height: 250px;
    overflow-y: auto;
    width: 100%;
    position: relative;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.table-container th,
.table-container td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #f0f0f1;
}

.table-container th {
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 2px solid #f0f0f1;
    font-weight: 600;
}

.page-url {
    width: 75%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-views {
    width: 25%;
    text-align: right;
}

.update-time {
    margin-top: 15px;
    text-align: right;
    font-size: 12px;
    color: #666;
}

/* Total Visitors Display */
.total-visitors-display {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
}

.total-count {
    font-size: 60px;
    font-weight: 700;
    color: #2271b1;
    line-height: 1.2;
    margin-bottom: 10px;
}

.total-label {
    font-size: 16px;
    color: #666;
}

/* Tablet and smaller desktops */
@media screen and (max-width: 1024px) {
    .analytics-content {
        grid-template-columns: 1fr;
    }
    
    .chart-container,
    .table-container {
        height: 300px;
    }
}

/* Mobile landscape */
@media screen and (max-width: 782px) {
    .quick-stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .stat-box {
        padding: 12px;
    }
    
    .stat-num {
        font-size: 20px;
    }
    
    .analytics-box {
        padding: 12px;
    }
    
    .chart-container,
    .table-container {
        height: 250px;
    }
}

/* Mobile portrait */
@media screen and (max-width: 480px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-box {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 10px;
    }
    
    .stat-num {
        margin-bottom: 0;
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .analytics-box {
        padding: 10px;
    }
    
    .chart-container,
    .table-container {
        height: 220px;
    }
}
