/* Stilar för WooCommerce-statistik */
.customer-stats-view {
    padding: 1rem;
    max-width: 95vw;
    margin: 0 auto;
}

.customer-stats-view h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.customer-stats-card {
    background: #fff;
    border-radius: 15px;
    border: 1px solid #dfdfdf;
    margin-bottom: 20px;
    overflow: hidden;
}

.customer-stats-card-header {
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #dfdfdf;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customer-stats-card-header h3 {
    margin: 0;
    font-size: 2rem;
    color: #000000;
}

.customer-stats-card-body {
    padding: 15px;
    min-height: 500px; /* Minsta höjd */
    height: auto; /* Låt höjden anpassas dynamiskt */
    overflow-y: auto; /* Lägg till rullning om innehållet blir för stort */
}

#customer-sales-chart-container {
    width: 100%;
    height: 100%; /* Använd hela tillgängliga höjden */
    min-height: 500px; /* Minsta höjd */
}

.total-sales-summary {
    background: #4c8077;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
}

.total-sales-summary h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.total-sales-amount {
    font-size: 24px;
    font-weight: bold;
}

.last-updated {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

.stats-loader {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4c8077;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#refresh-woocommerce-data {
    background-color: transparent;
    border-color: #3a6059;
    color: #3a6059;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

#refresh-woocommerce-data:hover {
    background-color: #3a6059;
    color: #fff;
}

#refresh-woocommerce-data:disabled {
    background-color: #ccc;
    border-color: #bbb;
    color: #666;
    cursor: not-allowed;
}

/* Animation för uppdateringsknappen */
@keyframes spin-button {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#refresh-woocommerce-data.updating {
    position: relative;
    padding-left: 30px;
}

#refresh-woocommerce-data.updating:before {
    content: "";
    position: absolute;
    left: 10px;
    top: 50%;
    margin-top: -8px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin-button 1s linear infinite;
}

/* Responsiv design för mindre skärmar */
@media (max-width: 768px) {
    .customer-stats-card-body {
        height: 400px;
    }
}

/* Stilar för att visa både försäljning och antal ordrar */
.chart-legend {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    margin: 0 10px;
}

.chart-legend-color {
    width: 12px;
    height: 12px;
    margin-right: 5px;
    border-radius: 2px;
}

.chart-legend-label {
    font-size: 12px;
}

/* Anpassa färger för diagrammet */
.sales-color {
    background-color: #4c8077;
}

.orders-color {
    background-color: #b9f29a;
}

/* Stilar för sammanfattningswidgetar */
.customer-summary-widgets {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.summary-widget {
    flex: 1;
    background: #000000;
    border: 1px solid #dfdfdf;
    border-radius: 15px;
    padding: 4% 2%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.summary-widget h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #fff;
    text-align: left;
}

.summary-widget .summary-value {
    font-size: 3.5rem;
    font-weight: bold;
    color: #4c8077;
    line-height: 1;
    background: linear-gradient(0deg, rgb(212 212 212) 20%, rgb(125, 229, 186) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: baseline;
    justify-content: center;
}

/* Responsiv design för mindre skärmar */
@media (max-width: 992px) {
    .customer-summary-widgets {
        flex-direction: column;
        gap: 15px;
    }
}

/* Stilar för försäljningsstatistik */
.sales-stats-view {
    padding: 1rem;
    max-width: 95vw;
    margin: 0 auto;
}

.sales-stats-header {
    text-align: left;
    margin-bottom: 2rem;
}

.sales-stats-header h2 {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    color: #000000;
    margin-top: 0px;
}

.sales-stats-description {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 1rem;
}

.sales-stats-content {
    background: #fff;
    border-radius: 15px;
    border: 1px solid #dfdfdf;
    padding: 2rem;
    min-height: 400px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.sales-chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 2rem;
}

/* Stilar för projektförsäljningsdiagram */
.project-chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 2rem;
}

/* Lägg till lite mellanrum mellan sektionerna */
.sales-stats-header {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.sales-stats-header:first-child {
    margin-top: 0;
}

.sales-summary {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 30px;
}

.summary-box {
    flex: 1;
    background: #000;
    color: #b9f29a;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.summary-box h3 {
    margin-top: 0;
    color: white;
    font-size: 16px;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 28px;
    font-weight: bold;
}

.last-updated {
    text-align: right;
    font-size: 0.9rem;
    color: #666;
    margin-top: 1rem;
}

#refresh-subscription-data {
    margin-left: 10px;
    background-color: #4c8077;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

#refresh-subscription-data:hover {
    background-color: #3a6259;
}

/* Responsiv design för mindre skärmar */
@media (max-width: 992px) {
    .sales-summary {
        flex-direction: column;
        gap: 15px;
    }
}

.iframe-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
}

.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}
