
/* Grundläggande reset */
* {
    box-sizing: border-box;
}

/* Container och layout */
.smort-stats-container {
    max-width: 1200px;
    width: 100%;
    margin: 3% auto;
    padding: 0 1rem;
}

.smort-stats-layout {
    display: flex;
    gap: 2rem;
    width: 100%;
    min-height: 800px; /* Sätt en minsta höjd för layouten */
}

.main-column {
    width: 60%;
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid #dfdfdf;
    height: auto; /* Låt höjden anpassas efter innehållet */
    display: flex;
    flex-direction: column;
}

.side-column {
    width: 40%;
    flex-shrink: 0;
    border-radius: 12px;
    padding: 0rem;
    display: flex;
    flex-direction: column;
    gap: 0rem;
    height: 100%;
}

/* Justera höjden på de två första sektionerna */
.side-column .stats-section:not(.image-section) {
    flex-shrink: 0;
}

/* Ny sektion för bakgrundsbild */
.image-section {
    background: transparent;
    padding: 0;
    margin-top: 1rem;
    flex-grow: 1;
    min-height: 100px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    display: flex; /* Lägg till flexbox */
    flex-direction: column;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/wp-content/uploads/2025/05/dashboard-image.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    flex-grow: 1; /* Låt bilden växa för att fylla utrymmet */
}

span.metric-suffix{
    font-size: 30px;
}
.stats-section {
    height: auto;
    background: #000;
    border-radius: 12px;
    padding: 2.5rem 2rem;
}

/* Header och period selector */
.stats-header {
    margin-bottom: 1rem;
    text-align: left;
}

.stats-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #000;
    font-family: 'Helvetica';
    margin-bottom: 20px;
    font-weight: 500;
}

.stats-section h2 {
    color: #fff;
}

.period-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.period-selector button {
    padding: 8px 10px;
    background: #fff;
    border: 0px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #000;
}


.period-selector button.active {
    color: #4c8077;
    border-bottom: 1px solid #4c8077;
}

/* Metric cards */
.stats-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}


.metric-card {
    background: #f9f9f9;
    border: 0px;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.metric-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: #000;
    width: 100%;
    text-align: center;
}

.metric-card .metric-value {
    font-size: 4rem;
    line-height: 1;
    font-weight: bold;
    color: #000;
    width: 100%;
    text-align: center;
}

.metric-card.highlight {
    background: #4c8077;
    border: none;
}

.metric-card.highlight h3,
.metric-card.highlight .metric-value {
    color: #b9f29a;
}

/* Loader */
.stats-loader {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    border-top-color: #b9f29a;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    position: relative;
    display: block;
}

/* Specifik styling för laddare i metric-cards */
.metric-card .metric-value .stats-loader {
    margin: 10px auto;
}

/* Specifik styling för laddare i leaderboard */
#leaderboard .stats-loader {
    margin: 20px auto;
}

/* Specifik styling för laddare i diagram */
.chart-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-width: 4px;
    z-index: 10;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Reconnect box */
.reconnect-box {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: none;
}

.reconnect-box.show {
    display: block;
}

.reconnect-box h3 {
    color: #856404;
    margin: 0 0 1rem 0;
}

.reconnect-button {
    background: #4c8077;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    margin-top: 1rem;
    border: none;
    cursor: pointer;
}

.reconnect-button:hover {
    background: #4e8434;
}

/* Disconnect button */
.gmail-disconnect-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 10px;
}

.disconnect-button {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.disconnect-button:hover {
    background: #c82333;
}

.force-disconnect-button {
    background: #343a40;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.force-disconnect-button:hover {
    background: #23272b;
}

/* Leaderboard */
.stats-leaderboard {
    margin-top: 2rem;
    background: #fff;
    border-radius: 8px;
    padding: 0;
    text-align: left;
}

.stats-leaderboard h3 {
    margin: 0 0 1rem 0;
    color: #000;
    border-left: 3px solid #b9f29a;
    padding-left: 10px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
    width: 100%;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-name {
    font-weight: 500;
}

.leaderboard-value {
    color: #000000;
    font-weight: bold;
    background-color: #b9f29a;
    width: 50px;
    height: 25px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: anchor-center;
    border-radius: 5px;
}

/* Monthly stats */
.stats-monthly {
    margin-top: 2rem;
    margin-bottom: 15px; /* Lägg till en mindre marginal nedåt */
    background: #fff;
    border-radius: 8px;
    padding: 0rem;
    text-align: left;
    height: auto; /* Låt höjden anpassas efter innehållet */
    position: relative;
}

.stats-monthly h3 {
    margin: 0 0 1rem 0;
    color: #000;
    border-left: 3px solid #b9f29a;
    padding-left: 10px;
}

/* Loader för diagram */
.chart-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-width: 4px;
}

/* Chart tooltip */
.chartjs-tooltip {
    background: white !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important;
}

/* Chart.js legend spacing */
.stats-monthly .chartjs-legend-list {
    margin-bottom: 30px !important;
}

/* Alternativt kan vi målrikta canvas elementet direkt */
#monthlyChart {
    margin-top: 0px !important;
    max-height: 300px !important; /* Begränsa höjden på diagrammet */
    margin-bottom: 10px !important; /* Lägg till en mindre marginal nedåt */
}

/* Om ovanstående inte fungerar, prova denna mer specifika selector */
.stats-monthly canvas#monthlyChart {
    margin-top: 0px !important;
}

/* Detaljerad statistik */
.detailed-metrics {
    height: calc(100% - 3rem); /* Tar hänsyn till header och margin */
}

.detailed-metric-row {
    display: flex;
    gap: 1rem;
    height: 100%;
}

.detailed-metric-card {
    flex: 1;
    padding: 0rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.detailed-metric-card h3 {
    margin: 0 0 1rem 0;
    font-size: 0.6rem;
    color: #fff;
}

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

.detailed-metric-value::after {
    content: attr(data-suffix);
    font-size: 2.5rem;
    margin-left: 0.2rem;
    -webkit-text-fill-color: initial;
    background: none;
    color: inherit;
}

.detailed-metric-unit {
    display: none; /* Dölj den separata enheten eftersom vi nu visar den direkt i värdet */
}
div#ticketPrognosis {
    background: linear-gradient(0deg, rgb(37 37 37) 20%, rgb(125, 229, 186) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
/* Ny widget-rad */
.detailed-metric-row.secondary {
    height: 30%;
    margin-top: 1rem;
}

.detailed-metric-row.secondary .detailed-metric-card {
    background: #f9f9f9;
}

/* Anpassa för mindre skärmar */
@media (max-width: 1200px) {
    .detailed-metric-row {
        flex-direction: column;
    }

    .detailed-metric-card {
        margin-bottom: 1rem;
    }
}

/* Prognosis section */
.prognosis-section {
    background: #fff !important;
    color: #000 !important;
    margin-top: 1rem;
    position: relative; /* Lägg till position relative för att hantera innehållet korrekt */
    padding-bottom: 3.5rem;
    border: 1px solid #e3e3e3;
}

.prognosis-section h2,
.prognosis-section h3 {
    color: #000 !important;
}

.prognosis-section .detailed-metric-value {
    color: #4c8077;
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    font-size: 6rem;
}

.prognosis-section .detailed-metric-unit {
    color: #000;
}

.prognosis-actions {
    margin-top: 20px;
    text-align: center;
    position: relative; /* Behåll knappen i flödet */
    z-index: 2;
}

.prognosis-settings {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: 8px;
    background: #f9f9f9;
    border: 1px solid #eee;
    position: absolute; /* Positionera formuläret absolut */
    left: 0;
    right: 0;
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Ta bort expanded-klassen och dess padding-bottom eftersom vi nu använder position: absolute */
.prognosis-section.expanded {
    padding-bottom: 3.5rem; /* Behåll samma padding som normalt */
}

.prognosis-settings h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.settings-form {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.prognosis-button {
    background: transparent;
    color: #000000;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
    border: 2px solid;
    width: 100%;
    padding: 10px;
    font-weight: 800;
}

.prognosis-button:hover {
    background: #3a6059;
}

.prognosis-button.secondary {
    background: #f1f1f1;
    color: #333;
    border: 1px solid #ddd;
    margin-left: 0rem;
    margin-top:5px;
}

.prognosis-button.secondary:hover {
    background: #e5e5e5;
}

@media (max-width: 768px) {
    .settings-form {
        grid-template-columns: 1fr;
    }
}

.metric-suffix {
    font-size: 2.5rem;
    vertical-align: baseline;
    -webkit-text-fill-color: initial;
    background: none;
    color: inherit;
}

.detailed-metric-unit {
    display: none; /* Dölj den separata enheten eftersom vi nu visar den direkt i värdet */
}

/* View Selector */
.view-selector {
    position: fixed;
    top: 5%;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 100;
    background: #fff;
    padding: 15px 10px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #dfdfdf;
}

.view-selector-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.view-selector-item.active {
    background: #f5f5f5;
}

.view-selector-item:hover {
    background: #f9f9f9;
}

.view-selector-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.view-selector-icon svg {
    width: 100%;
    height: 100%;
}

.view-selector-label {
    font-size: 10px;
    text-align: center;
    color: #333;
}

/* View Container */
.view-container {
    width: 100%;
}

.view {
    display: none;
    width: 100%;
}

.view.active {
    display: block;
}

/* Customer Stats View - Minimal */
.customer-stats-view {
    padding: 2rem;
    max-width: 95vw;
    margin: 0 auto;
}

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

.customer-stats-view p {
    text-align: center;
    margin-bottom: 2rem;
    color: #666;
}

.chart-container {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #dfdfdf;
}

/* Customer Summary */
.customer-summary {
    display: flex;
    justify-content: space-around;
    margin-top: 2rem;
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #dfdfdf;
}

.summary-item {
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4c8077;
}

/* Stilar för kundförsäljningsvyn */
.customer-sales-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.customer-sales-box {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #dfdfdf;
}

.customer-sales-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
}

.sales-amount {
    font-size: 28px;
    font-weight: bold;
    color: #4c8077;
    margin: 15px 0;
}

.order-count {
    font-size: 16px;
    margin-bottom: 10px;
}

.order-status-container {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.order-status {
    background: #f9f9f9;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
}

.status-label {
    color: #666;
}

.status-value {
    font-weight: bold;
}

.avg-order-value {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.data-source {
    font-size: 12px;
    color: #999;
    margin-top: 15px;
}

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

.total-sales-summary h3 {
    margin-top: 0;
    color: white;
}

.total-sales-amount {
    font-size: 32px;
    font-weight: bold;
    margin-top: 10px;
}

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

#refresh-woocommerce-data {
    margin-bottom: 20px;
}

.error-message {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 5px;
    margin: 20px 0;
}

/* Stilar för autentiseringsmeddelanden */
.auth-message {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    border: 1px solid #dee2e6;
}

.auth-message.error {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.auth-message p {
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

.reconnect-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4c8077;
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s;
}

.reconnect-button:hover {
    background-color: #3a6059;
    color: white;
    text-decoration: none;
}

/* Stilar för frånkopplingsknappen */
.gmail-disconnect-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

.disconnect-button {
    padding: 4px 8px;
    background-color: transparent;
    color: #999;
    border: none;
    cursor: pointer;
    font-size: 12px;
    transition: color 0.3s;
    text-decoration: underline;
}

.disconnect-button:hover {
    color: #666;
}

.force-disconnect-button {
    display: none; /* Dölj denna knapp helt */
}

/* Återställ preloader-färgen för support-fliken */
#gmailStatsView .stats-loader {
    border-top: 4px solid #b9f29a;
}

/* Behåll den gröna färgen för kundfliken */
#customerStatsView .stats-loader {
    border-top: 4px solid #4c8077;
}

/* Lägg till dessa stilar för period-väljaren */
.customer-period {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.detailed-metric-row .detailed-metric-unit {
    display: block;
    color: #fff;
}
.customer-period button {
    padding: 8px 16px;
    background: #fff;
    border-radius: 0px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #000;
    font-size: 18px;
}

.customer-period button.active {
    color: #000;
    border-color: #000;
    border-bottom: 2px solid #000;
}

.customer-period button:hover:not(.active) {
    background: #f5f5f5;
}

/* Lägg till dessa stilar för sammanfattningswidgetar */
.customer-summary-widgets {
    display: flex;
    gap: 20px;
    margin-top: 30px;
    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: 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;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: baseline;
    flex-direction: column;
}

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

/* Styling för försäljningsvyn */
.sales-chart-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.summary-box {
    background-color: #000;
    color: #fff;
    border-radius: 8px;
    padding: 20px;
    flex: 1;
    margin-right: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.summary-box:last-child {
    margin-right: 0;
}

.summary-box h3 {
    font-size: 14px;
    margin: 0 0 10px 0;
    color: #ccc;
}

.summary-value {
    font-size: 28px;
    font-weight: bold;
    color: #4c8077;
}

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

.positive {
    color: #4CAF50;
}

.negative {
    color: #F44336;
}

.stats-loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4c8077;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 100px auto;
}

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

.error-message {
    color: #F44336;
    padding: 15px;
    background-color: #FFEBEE;
    border-radius: 4px;
    margin: 20px 0;
}

