/**
 * PAT Activity Insights Shortcode Styles
 */

.pat-activity-insights-wrapper {
    /* max-width: 1200px; */
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    position: relative;
}

/* Tab Navigation */
.activity-insights-tabs {
    display: flex;
    background: #eeeeee;
    border-bottom: 1px solid #d1d1d1;
    padding: 5px 0px 0px 5px;
    margin: 0;
    gap: 5px;
}

.activity-tab-button {
    /* flex: 1; */
    padding: 10px 5px;
    background: none;
    border-radius: 4px 4px 0px 0px;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #a3a3a3 !important;
    transition: all 0.2s ease;
    position: relative;
    width: 180px;
    top: 1px
    
}

.activity-tab-button:hover {
    
    color: #495057;
}

.activity-tab-button.active {
    background: white;
    color: #777 !important;
    font-weight: 600;
    border: 1px solid #dbdbdb;
    border-bottom: 1px solid white;
}

.activity-tab-button.active:nth-child(1) {
    background: linear-gradient(180deg, #f5f5f5, #f9f9f9);
    color: #596974 !important;
    border-bottom: none;
}

.activity-tab-button.active:nth-child(2) {
    background: linear-gradient(180deg, #d6ecf9, #e0f0ff);
    color: #596974 !important;
    border-bottom: none;
}

.activity-tab-button.active:nth-child(3) {
    background: linear-gradient(180deg, #c1e2f6, #abd7f3);
    color: #404e59 !important;
    border-bottom: none;
}
    
/* Tab Content */
.activity-tab-content {
    max-height: 51vh;
    background: linear-gradient(180deg, #f9f9f9, #fff);
}

.activity-tab-content#row-by-row-tab {
    overflow-y: scroll
}

.activity-tab-content.hidden {
    display: none;
}

/* Chart Titles */
.activity-chart-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    font-family: 'Inter', sans-serif;
    display: none;
}

/* Overview Section */
.activity-overview-section {
    text-align: center;
    position: relative;
}

.activity-overview-section .comparison-toggle {
    background-color: #ededed;
    padding: 10px 10px 10px 15px;
    border: 1px solid #dddbdb;
    border-radius: 6px;
    box-shadow: 0 0px 6px -2px #d5d5d5;
    margin-bottom: 20px;
    position: absolute;
    z-index: 9999;
    top: 15px;
    left: 15px;
}

.activity-overview-section .comparison-toggle .toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #495057;
}

.activity-score-graph-container {
    /* background: #f8f9fa; */
    border-radius: 8px;
    padding: 30px 20px 30px 20px;
}

/* Comparison Section */
.activity-comparison-section {
    position: relative;
    text-align: center;
    background: linear-gradient(180deg, #e0f0ff, #fff);
    padding-top: 70px
}

.activity-comparison-section .comparison-toggle {
    background-color: #abd7f3;
    padding: 10px 10px 10px 15px;
    border: 1px solid #97c3de;
    border-radius: 6px;
    box-shadow: 0 0px 6px -2px #82b2df;
    position: absolute;
    z-index: 9999;
    top: 15px;
    left: 15px;
}

.activity-comparison-section .comparison-toggle .toggle-label {
    font-weight: 500;
    color: #526471;
}

.activity-comparison-section .toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #495057;
}

.activity-comparison-section .comparison-select {
    box-shadow: 0 0 6px 1px #89c0e3;
    border: 1px solid #94b9d1
}

/* Activity Zoom Controls */
.activity-comparison-section {
    position: relative;
}

.activity-zoom-controls {
    position: absolute;
    top: 20px;
    right: 30px;
    z-index: 10;
    display: flex;
    gap: 8px;
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 0px 6px -1px #82b2df;
    border: 1px solid #dddbdb;
}

.activity-zoom-btn {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3793d1;
    border: 1px solid #3793d1;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.activity-zoom-btn:hover {
    transform: scale(1.05);
}

.activity-zoom-btn.activity-reset-btn {
    background: #787878;
    border-color: #777;
}

@media (max-width: 585px) {
    .activity-zoom-controls {
        display: none;
    }
}

/* Ensure Chart.js tooltips have highest priority */
.chartjs-tooltip {
    z-index: 9999 !important;
    position: absolute !important;
}

/* Also ensure any other tooltips in the activity shortcode have high z-index */
.pat-activity-insights-wrapper .chartjs-tooltip,
.activity-overview-section .chartjs-tooltip,
.activity-score-graph-container .chartjs-tooltip {
    z-index: 10000 !important;
    position: absolute !important;
    pointer-events: none !important;
}

/* Sessions Section */
.activity-sessions-section {
    /* Inherits from parent */
}

.activity-sessions-table {
    width: calc(100% + 1px);
    border-collapse: collapse;
    /* margin-top: 20px; */
    font-family: 'Inter', sans-serif;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: none !important;
    overflow: hidden;
    margin-left: -1px;
}

.activity-sessions-table thead {
    background: #abd7f3;
}

.activity-sessions-table th {
    /* background: #f7f7f7; */
    color: #526471;
    font-family: 'Open Sans';
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: rgba(0, 0, 0, 0.024) 0px 4px 10px 0px inset;
    border: 1px solid #97c3de;
    padding: 10px 15px;
    border-left: none !important;
    border-top: 1px solid #97c3de;
}

.activity-sessions-table td {
    padding: 10px;
    border-top: 1px solid #e9e9e9;
    font-size: 14px !important;
    font-family: 'Open Sans';
    font-weight: 600;
    color: #6B6B6B;
    border-bottom: none;
}

.activity-sessions-table thead tr:hover {
    background: revert;
}

.activity-sessions-table tr:hover {
    background: #f8f9fa;
}

.activity-sessions-table tr.training-mode {
    background: #f0f8f0;
}

.activity-sessions-table tr.training-mode:hover {
    background: #e8f5e8;
}

.training-mode-date {
    color: #69b924 !important;
    font-weight: 500;
    border-left: 3px solid #69b924 !important;
}

/* Score color classes */
.score-above-average {
    color: #6ecc1d !important;
    font-weight: 600;
}

.score-average {
    color: #edd423 !important;
    font-weight: 600;
}

.score-below-average {
    color: #fc5656 !important;
    font-weight: 600;
}

/* Recommendations Section */
.activity-recommendations-section {
    /* Inherits from parent */
}

.activity-recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    overflow-y: scroll;
}

.recommendation-item {
    display: flex;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    border-left: 4px solid #6c757d;
}

.recommendation-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.recommendation-item.red {
    border-left-color: #dc3545;
}

.recommendation-item.yellow {
    border-left-color: #ffc107;
}

.recommendation-item.blue {
    border-left-color: #007bff;
}

.recommendation-item.green {
    border-left-color: #28a745;
}

.recommendation-image-container {
    width: 100px;
    height: 80px;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    background: #f8f9fa;
}

.recommendation-base-image,
.recommendation-overlay-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recommendation-overlay-image {
    position: absolute;
    top: 0;
    left: 0;
}

.recommendation-main-content {
    flex: 1;
    padding: 20px;
    position: relative;
}

.recommendation-title-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.recommendation-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    font-family: 'Inter', sans-serif;
    flex: 1;
    margin-right: 10px;
}

.dismiss-button {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dismiss-button:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.recommendation-description-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
}

.recommendation-description {
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
    flex: 1;
    font-family: 'Open Sans', sans-serif;
}

.recommendation-action {
    flex-shrink: 0;
}

.action-button {
    background: #3793d1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: background 0.2s ease;
}

.action-button:hover {
    background: #2980b9;
}

.action-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Loading States */
.loading-spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    min-height: 200px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.spinner-svg {
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.spinner-path {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    animation: spinner-dash 1.5s ease-in-out infinite;
}

.loading-text {
    color: #6c757d;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinner-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Mobile Warning (reuse existing styles) */
.mobile-warning-overlay.activity-insights-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-warning-overlay.activity-insights-warning.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Design */
@media (max-width: 768px) {
    .activity-insights-tabs {
        flex-wrap: wrap;
    }
    
    .activity-tab-button {
        flex: 1 1 50%;
        font-size: 13px;
        padding: 12px 15px;
    }
    
    .activity-tab-content {
        padding: 20px 15px;
    }
    
    .activity-chart-title {
        font-size: 18px;
    }
    
    .recommendation-item {
        flex-direction: column;
    }
    
    .recommendation-image-container {
        width: 100%;
        height: 120px;
    }
    
    .recommendation-description-container {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .recommendation-action {
        text-align: center;
    }
    
    .activity-sessions-table {
        font-size: 12px;
    }
    
    .activity-sessions-table th,
    .activity-sessions-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .activity-tab-button {
        flex: 1 1 100%;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .activity-tab-button:last-child {
        border-bottom: none;
    }
    
    .activity-tab-content {
        padding: 15px 10px;
    }
}