/**
 * Public styles for AMEDAP Stats
 */

/* Base container styles */
.amedap-stats-container {
    margin: 1em 0;
}

/* Grid layout (default) */
.amedap-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    justify-content: center;
}

.amedap-stats-grid .amedap-stat-item {
    flex: 1;
    min-width: 200px;
    max-width: 250px;
    text-align: center;
    padding: 2em 1em;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.amedap-stats-grid .amedap-stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #0073aa;
}

/* List layout */
.amedap-stats-list {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.amedap-stats-list .amedap-stat-item {
    display: flex;
    align-items: center;
    padding: 1em;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.amedap-stats-list .amedap-stat-item:hover {
    background: #fff;
    border-color: #0073aa;
}

/* Statistic elements */
.amedap-stat-number {
    font-size: 3em;
    font-weight: bold;
    line-height: 1;
    color: #0073aa;
    margin-bottom: 0.2em;
}

.amedap-stat-label {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5em;
}

.amedap-stat-description {
    font-size: 0.9em;
    color: #666;
    line-height: 1.4;
}

/* Animation classes for compatibility */
.animate-counter .amedap-stat-number,
.animate-counter .stat-number {
    transition: all 0.3s ease;
}

/* Current theme compatibility */
.stat-item {
    text-align: center;
    padding: 1em;
}

.stat-item .stat-number {
    font-size: 3em;
    font-weight: bold;
    line-height: 1;
    color: #0073aa;
    display: block;
    margin-bottom: 0.2em;
}

.stat-item .stat-label {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    display: block;
}

.stat-item .stat-description {
    font-size: 0.9em;
    color: #666;
    margin-top: 0.5em;
    display: block;
}

/* Hide the plugin wrapper container completely */
.stats-grid .amedap-stats-container {
    display: contents !important;
}

/* Ensure the stats display properly in the grid */
.stats-grid .stat-item {
    /* Reset any plugin-specific styling to let theme handle it */
    all: unset !important;
    /* Restore grid item properties */
    display: block !important;
    text-align: center !important;
}

/* Style the stat numbers with theme font and larger size */
.stats-section .stat-item .stat-number {
    all: unset !important;
    display: block !important;
    font-family: var(--font-primary) !important;
    font-size: 4em !important;
    font-weight: bold !important;
    line-height: 1 !important;
}

/* Ensure stat labels inherit theme styles */
.stats-section .stat-item .stat-label {
    all: unset !important;
    display: block !important;
}

/* Widget styles */
.widget-stats {
    text-align: center;
}

.widget-stats .amedap-stat-item {
    margin-bottom: 1em;
    padding: 1em;
    background: #f9f9f9;
    border-radius: 5px;
}

.widget-stats .amedap-stat-number {
    font-size: 2em;
}

.widget-stats .amedap-stat-label {
    font-size: 1em;
    margin-bottom: 0.2em;
}

.widget-stats .amedap-stat-description {
    font-size: 0.8em;
}

/* Color variations */
.amedap-stats-container.color-blue .amedap-stat-number,
.amedap-stats-container.color-blue .stat-number {
    color: #0073aa;
}

.amedap-stats-container.color-green .amedap-stat-number,
.amedap-stats-container.color-green .stat-number {
    color: #46b450;
}

.amedap-stats-container.color-red .amedap-stat-number,
.amedap-stats-container.color-red .stat-number {
    color: #dc3232;
}

.amedap-stats-container.color-orange .amedap-stat-number,
.amedap-stats-container.color-orange .stat-number {
    color: #ff8c00;
}

/* Responsive design */
@media screen and (max-width: 768px) {
    .amedap-stats-grid {
        flex-direction: column;
        align-items: center;
    }
    
    .amedap-stats-grid .amedap-stat-item {
        max-width: 100%;
        min-width: auto;
    }
    
    .amedap-stats-list .amedap-stat-item {
        flex-direction: column;
        text-align: center;
    }
    
    .amedap-stat-number {
        font-size: 2.5em;
    }
    
    .amedap-stat-label {
        font-size: 1.1em;
    }
}

@media screen and (max-width: 480px) {
    .amedap-stat-number {
        font-size: 2em;
    }
    
    .amedap-stat-label {
        font-size: 1em;
    }
    
    .amedap-stat-item {
        padding: 1em 0.5em;
    }
}

/* Print styles */
@media print {
    .amedap-stats-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        page-break-inside: avoid;
    }
    
    .amedap-stat-item {
        border: 1px solid #000 !important;
        background: transparent !important;
        box-shadow: none !important;
        margin: 0.5em !important;
        page-break-inside: avoid;
    }
    
    .amedap-stat-number {
        color: #000 !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .amedap-stat-item {
        border: 2px solid #000;
        background: #fff;
    }
    
    .amedap-stat-number {
        color: #000;
    }
    
    .amedap-stat-label {
        color: #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .amedap-stat-item,
    .animate-counter .amedap-stat-number,
    .animate-counter .stat-number {
        transition: none;
    }
    
    .amedap-stats-grid .amedap-stat-item:hover {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .amedap-stat-item {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .amedap-stat-label {
        color: #fff;
    }
    
    .amedap-stat-description {
        color: #ccc;
    }
    
    .amedap-stats-grid .amedap-stat-item:hover,
    .amedap-stats-list .amedap-stat-item:hover {
        background: #333;
        border-color: #0073aa;
    }
}

/* Focus styles for accessibility */
.amedap-stat-item:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Loading state */
.amedap-stats-loading {
    opacity: 0.6;
    position: relative;
}

.amedap-stats-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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