/**
 * Standard Taxonomy Cards - Updated CSS
 * Version: 1.2.0
 */
 
/* --- Color Palette --- */
:root {
    --std-primary-color: #0077b6;
    --std-secondary-color: #00b4d8;
    --std-text-dark: #023047;
    --std-text-light: #457b9d;
    --std-bg-light: #ffffff;
    --std-bg-medium: #f1faee;
    --std-border-color: #e0e0e0;
    --std-shadow-light: 0 2px 8px rgba(0, 0, 0, 0.07);
    --std-shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Container */
.std-taxonomy-cards-container-zxc951 {
    width: 100%;
    margin: 10px 0;
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Grid Layout */
.std-taxonomy-cards-grid-zxc951 {
    display: grid;
    gap: 11px;
    margin-bottom: 14px;
}

.std-taxonomy-cards-grid-zxc951.columns-2 { grid-template-columns: repeat(2, 1fr); }
.std-taxonomy-cards-grid-zxc951.columns-3 { grid-template-columns: repeat(3, 1fr); }
.std-taxonomy-cards-grid-zxc951.columns-4 { grid-template-columns: repeat(4, 1fr); }
.std-taxonomy-cards-grid-zxc951.columns-5 { grid-template-columns: repeat(5, 1fr); }
.std-taxonomy-cards-grid-zxc951.columns-6 { grid-template-columns: repeat(6, 1fr); }

/* Card Styles */
.std-taxonomy-card-zxc951 {
    position: relative;
    background: var(--std-bg-light);
    border-radius: 8px;
    box-shadow: var(--std-shadow-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border: 1px solid var(--std-border-color);
}

.std-taxonomy-card-zxc951:hover {
    transform: translateY(-4px);
    box-shadow: var(--std-shadow-hover);
}

.std-taxonomy-card-link-zxc951 { 
    display: block; 
    text-decoration: none; 
    color: inherit; 
    height: 100%; 
}

/* Card Header */
.std-taxonomy-card-header-zxc951 {
    position: relative;
    padding: 14px 10px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
}

.std-taxonomy-card-count-large-zxc951 { 
    text-align: center; 
}

.count-number-huge {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    color: white;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.count-label-small {
    font-size: 0.53rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* Card Body */
.std-taxonomy-card-body-zxc951 {
    padding: 10px;
}

.std-taxonomy-card-title-zxc951 {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--std-text-dark);
    margin: 0 0 6px 0;
}

.std-taxonomy-card-description-zxc951 {
    font-size: 0.56rem;
    color: var(--std-text-light);
    line-height: 1.4;
    margin: 0 0 7px 0;
}

.std-taxonomy-card-footer-zxc951 {
    padding-top: 6px;
    border-top: 1px solid #f0f0f0;
}

.view-all-link {
    color: var(--std-primary-color);
    font-size: 0.56rem;
    font-weight: 600;
    transition: all 0.2s;
}

.std-taxonomy-card-zxc951:hover .view-all-link { 
    transform: translateX(4px); 
}

/* Statistics Button */
.std-taxonomy-card-stats-btn-zxc951 {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--std-text-dark);
    transition: all 0.3s ease;
    z-index: 10;
}

.std-taxonomy-card-stats-btn-zxc951:hover { 
    background: white; 
    transform: scale(1.1); 
}

.std-taxonomy-card-stats-btn-zxc951:focus {
    outline: 2px solid var(--std-primary-color);
    outline-offset: 2px;
}

/* --- Modal Styles --- */
.std-modal-overlay-zxc951 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.std-modal-overlay-zxc951.active {
    opacity: 1;
    visibility: visible;
}

.std-modal-container-zxc951 {
    background: white;
    border-radius: 11px;
    max-width: 420px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.std-modal-overlay-zxc951.active .std-modal-container-zxc951 {
    transform: scale(1) translateY(0);
}

.std-modal-header-zxc951 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 17px;
    border-bottom: 1px solid var(--std-border-color);
    background: linear-gradient(135deg, var(--std-primary-color) 0%, var(--std-secondary-color) 100%);
    color: white;
}

.std-modal-title-zxc951 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
}

.std-modal-close-zxc951 {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.std-modal-close-zxc951:hover {
    background: rgba(255, 255, 255, 0.2);
}

.std-modal-body-zxc951 {
    padding: 17px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Loading State */
.modal-loading-zxc951 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 14px;
    text-align: center;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 2px solid var(--std-border-color);
    border-top: 2px solid var(--std-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 11px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Statistics Content --- */
.stats-graph-container-zxc951 {
    margin-bottom: 17px;
    padding: 14px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 1px solid var(--std-border-color);
}

.stats-graph-container-zxc951 h5 {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--std-text-dark);
    margin: 0 0 14px 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stats-graph-zxc951 {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 8px;
    height: 98px;
    padding: 14px 10px 7px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.graph-year-item-zxc951 {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.graph-bar-zxc951 {
    width: 100%;
    max-width: 28px;
    background: linear-gradient(to top, var(--std-primary-color), var(--std-secondary-color));
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: all 0.5s ease-out;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 3px;
}

.graph-bar-zxc951[data-count="0"] {
    display: none;
    height: 0 !important;
}

.graph-bar-zxc951:hover {
    transform: scaleY(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.graph-bar-zxc951 .count-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.53rem;
    font-weight: 700;
    color: var(--std-text-dark);
    background: rgba(255, 255, 255, 0.95);
    padding: 3px 6px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
    margin-bottom: 3px;
    border: 1px solid var(--std-border-color);
}

.graph-year-item-zxc951:hover .count-label {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

.graph-year-label-zxc951 {
    font-size: 0.56rem;
    color: var(--std-text-light);
    margin-top: 6px;
    font-weight: 600;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 3px;
    border: 1px solid #dee2e6;
}

/* Year Statistics */
.year-stats-zxc951 {
    margin-bottom: 14px;
}

.year-header-zxc951 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.year-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--std-text-dark);
}

.year-total {
    font-size: 0.56rem;
    background: var(--std-bg-medium);
    color: var(--std-text-dark);
    padding: 3px 7px;
    border-radius: 8px;
    font-weight: 600;
}

.month-grid-zxc951 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.month-item-zxc951 {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 7px 4px;
    border-radius: 6px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    font-size: 0.49rem;
    transition: all 0.2s ease;
}

.month-item-zxc951.has-posts { 
    background: #e9f5ff; 
    border-color: var(--std-secondary-color); 
    font-weight: 600; 
}

.month-item-zxc951.has-posts:hover {
    transform: scale(1.05);
    background: #d1ecf1;
}

.month-name {
    color: #6c757d;
    margin-bottom: 3px;
}

.month-count {
    font-size: 0.63rem;
    color: var(--std-text-dark);
    font-weight: 700;
}

.month-item-zxc951.has-posts .month-count {
    color: var(--std-primary-color);
}

/* Total Summary */
.stats-total-summary-zxc951 {
    margin-top: 14px;
    padding: 11px;
    background: linear-gradient(135deg, var(--std-bg-medium) 0%, #e8f4fd 100%);
    border-radius: 7px;
    text-align: center;
    border: 1px solid var(--std-border-color);
}

.stats-total-summary-zxc951 strong {
    color: var(--std-primary-color);
    font-size: 0.77rem;
}

/* No Stats Message */
.no-stats {
    text-align: center;
    padding: 28px 14px;
    color: var(--std-text-light);
    font-style: italic;
    font-size: 0.7rem;
}

/* Empty State */
.std-taxonomy-cards-empty-zxc951 {
    text-align: center;
    padding: 28px 14px;
    color: var(--std-text-light);
    font-size: 0.7rem;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .std-taxonomy-cards-grid-zxc951.columns-6 {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1200px) {
    .std-taxonomy-cards-grid-zxc951.columns-5,
    .std-taxonomy-cards-grid-zxc951.columns-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .std-taxonomy-cards-grid-zxc951.columns-4,
    .std-taxonomy-cards-grid-zxc951.columns-5,
    .std-taxonomy-cards-grid-zxc951.columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .std-taxonomy-cards-grid-zxc951.columns-3,
    .std-taxonomy-cards-grid-zxc951.columns-4,
    .std-taxonomy-cards-grid-zxc951.columns-5,
    .std-taxonomy-cards-grid-zxc951.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .std-modal-container-zxc951 {
        width: 95%;
        max-height: 90vh;
    }

    .std-modal-header-zxc951,
    .std-modal-body-zxc951 {
        padding: 11px;
    }
    
    .month-grid-zxc951 { 
        grid-template-columns: repeat(3, 1fr); 
    }
}

@media (max-width: 480px) {
    .std-taxonomy-cards-grid-zxc951.columns-2,
    .std-taxonomy-cards-grid-zxc951.columns-3,
    .std-taxonomy-cards-grid-zxc951.columns-4,
    .std-taxonomy-cards-grid-zxc951.columns-5,
    .std-taxonomy-cards-grid-zxc951.columns-6 {
        grid-template-columns: 1fr;
    }
    
    .month-grid-zxc951 { 
        grid-template-columns: repeat(2, 1fr); 
    }
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}