/**
 * Article Statistics Display Plugin - Styles
 * 
 * Copyright (c) 2026 Kerim Sarıgül
 * Distributed under the GNU GPL v3.
 *
 * Modern, aesthetic design for all themes
 */

/* ========================================
   COMMON STYLES
   ======================================== */

.asd-stats {
    --asd-theme-primary: #008cba;
    --asd-theme-soft: rgba(0, 140, 186, 0.08);
    --asd-theme-soft-strong: rgba(0, 140, 186, 0.14);
    --asd-theme-border: rgba(0, 140, 186, 0.32);
    --asd-theme-shadow: rgba(0, 140, 186, 0.22);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 15px 0;
    padding: 0 !important;
}

.asd-icon {
    font-style: normal;
    display: inline-block;
}

.asd-label {
    font-weight: 500;
    color: #555;
}

.asd-count {
    font-weight: 700;
}

/* Hide JSON data */
.asd-galley-data {
    display: none !important;
}

/* ========================================
   BADGE STYLE
   Card with colored badges
   ======================================== */

.asd-style-badge {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px 20px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.asd-style-badge .asd-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.95em;
    transition: all 0.2s ease;
}

/* Abstract Views - follows the active journal theme */
.asd-style-badge .asd-abstract-views {
    background: var(
        --asd-galley-background,
        linear-gradient(to bottom, #fff 0%, #f6f6f6 47%, #ededed 100%)
    );
    border: 1px solid var(--asd-galley-border, #efefef);
    color: var(--asd-galley-color, #222);
}

.asd-style-badge .asd-abstract-views:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.asd-style-badge .asd-abstract-views .asd-icon {
    font-size: 1.1em;
}

.asd-style-badge .asd-abstract-views .asd-label {
    color: var(--asd-galley-color, #222);
}

.asd-style-badge .asd-abstract-views .asd-count {
    color: var(--asd-galley-color, #222);
    font-size: 1.15em;
}

/* Galley Downloads - follows the active journal theme */
.asd-style-badge .asd-galley-downloads {
    background: var(
        --asd-galley-background,
        linear-gradient(to bottom, #fff 0%, #f6f6f6 47%, #ededed 100%)
    );
    border: 1px solid var(--asd-galley-border, #efefef);
    color: var(--asd-galley-color, #222);
}

.asd-style-badge .asd-galley-downloads:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.asd-style-badge .asd-galley-downloads .asd-icon {
    font-size: 1.1em;
}

.asd-style-badge .asd-galley-downloads .asd-label {
    color: var(--asd-galley-color, #222);
}

.asd-style-badge .asd-galley-downloads .asd-count {
    color: var(--asd-galley-color, #222);
    font-size: 1.15em;
}

/* ========================================
   INLINE STYLE
   Clean card with inline text
   ======================================== */

.asd-style-inline {
    background: linear-gradient(135deg, #fafafa 0%, #ffffff 100%);
    border: 1px solid #e0e0e0;
    border-left: 4px solid var(--asd-theme-primary);
    border-radius: 8px;
    padding: 14px 20px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

.asd-style-inline .asd-stat-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #444;
    font-size: 0.95em;
}

.asd-style-inline .asd-stat-inline .asd-icon {
    font-size: 1.1em;
}

.asd-style-inline .asd-stat-inline .asd-label {
    color: #666;
}

.asd-style-inline .asd-stat-inline .asd-count {
    color: var(--asd-theme-primary);
    font-size: 1.1em;
    margin-left: 4px;
}

/* Separator between items */
.asd-style-inline .asd-stat-inline:not(:last-child)::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 20px;
    background: #ddd;
    margin-left: 20px;
    vertical-align: middle;
}

/* ========================================
   SUMMARY VIEW (Issue TOC / Homepage)
   Compact button style - next to PDF galley
   ======================================== */

/* Initially hidden - JS will show after moving to correct position */
.asd-stats-summary {
    display: none !important;
}

/* Once moved to galleys container, show it */
.galleys_links .asd-stats-summary,
.galleys .asd-stats-summary,
.galley-links .asd-stats-summary,
.article-summary-galleys .asd-stats-summary,
.asd-stats-summary.asd-moved {
    display: inline !important;
}

/* Fix for Bootstrap theme - prevent cutting off galley buttons */
.obj_article_summary .galleys,
.obj_article_summary .galleys_links,
.article_summary .galleys {
    overflow: visible !important;
}

/* Fix Bootstrap btn-group radius issue */
.btn-group .galley-link,
.btn-group .obj_galley_link,
.btn-group > a:last-of-type {
    border-top-right-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
}

/* Ensure stats don't break btn-group styling */
.btn-group .asd-stat-compact {
    margin-left: 8px;
}

.asd-stat-compact {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    padding: 3px 12px;
    margin: 2px 4px 2px 0;
    border-radius: 5px;
    font-size: 0.9em;
    vertical-align: middle;
    background: var(
        --asd-galley-background,
        linear-gradient(to bottom, #fff 0%, #f6f6f6 47%, #ededed 100%)
    );
    border: 1px solid var(--asd-galley-border, #efefef);
    color: var(--asd-galley-color, #222);
}

.asd-stat-compact.asd-views {
    background: var(
        --asd-galley-background,
        linear-gradient(to bottom, #fff 0%, #f6f6f6 47%, #ededed 100%)
    );
    border-color: var(--asd-galley-border, #efefef);
    color: var(--asd-galley-color, #222);
}

.asd-stat-compact.asd-downloads {
    background: var(
        --asd-galley-background,
        linear-gradient(to bottom, #fff 0%, #f6f6f6 47%, #ededed 100%)
    );
    border-color: var(--asd-galley-border, #efefef);
    color: var(--asd-galley-color, #222);
}

.asd-stat-compact:hover {
    filter: brightness(0.95);
}

.asd-stat-compact .asd-icon {
    font-size: 14px;
    line-height: 1;
}

.asd-stat-compact .asd-count {
    font-weight: 700;
    font-size: 1.05em;
}

/* ========================================
   PLAIN TEXT STYLE
   Match the simple two-line reference layout
   ======================================== */

.asd-style-badge {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
}

.asd-style-badge .asd-stat,
.asd-style-badge .asd-abstract-views,
.asd-style-badge .asd-galley-downloads {
    width: auto;
    gap: 3px;
    margin: 0;
    padding: 0;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    color: #4b7d92;
    transform: none !important;
}

.asd-style-badge .asd-label,
.asd-style-badge .asd-count {
    color: inherit !important;
    font-size: inherit;
    font-weight: 400;
}

.asd-style-badge .asd-icon,
.asd-stat-compact .asd-icon {
    display: none !important;
}

.galleys_links .asd-stats-summary,
.galleys .asd-stats-summary,
.galley-links .asd-stats-summary,
.article-summary-galleys .asd-stats-summary,
.asd-stats-summary.asd-moved {
    display: inline-flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

.asd-stat-compact,
.asd-stat-compact.asd-views,
.asd-stat-compact.asd-downloads {
    display: inline-flex !important;
    gap: 3px;
    margin: 0;
    padding: 0;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    color: #4b7d92;
    filter: none !important;
}

.asd-stat-compact .asd-label,
.asd-stat-compact .asd-count {
    color: inherit;
    font-size: inherit;
    font-weight: 400;
}

.asd-style-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
}

.asd-style-inline .asd-stat-inline {
    gap: 3px;
    padding: 0;
    background: transparent !important;
    border: 0 !important;
    color: #4b7d92;
}

.asd-style-inline .asd-stat-inline::after,
.asd-style-inline .asd-icon {
    display: none !important;
}

.asd-style-inline .asd-label,
.asd-style-inline .asd-count {
    color: inherit !important;
    font-size: inherit;
    font-weight: 400;
    margin-left: 0;
}

.asd-style-badge .asd-galley-downloads::before,
.asd-style-inline .asd-stat-inline:not(:first-child)::before,
.asd-stat-compact.asd-downloads::before {
    content: "|";
    display: inline-block;
    margin: 0 10px;
    color: #4b7d92;
}

.asd-style-badge .asd-stat,
.asd-style-inline .asd-stat-inline,
.asd-stat-compact {
    white-space: nowrap;
}

/* ========================================
   SIDEBAR / VERTICAL LAYOUT
   Each stat on its own line
   ======================================== */

.asd-stats.asd-vertical {
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center !important;
    gap: 0 !important;
    padding: 0 !important;
}

.asd-stats.asd-vertical.asd-style-badge {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0 !important;
}

.asd-stats.asd-vertical.asd-style-badge::before {
    display: none;
}

.asd-stats.asd-vertical .asd-stat {
    display: flex !important;
    width: auto;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    border-radius: 6px;
}

.asd-stats.asd-vertical .asd-stat .asd-label {
    flex: 1;
}

.asd-stats.asd-vertical .asd-stat .asd-count {
    text-align: right;
    min-width: 50px;
}

/* Inline style vertical */
.asd-stats.asd-vertical.asd-style-inline {
    border-left: none;
    background: transparent;
    padding: 0 !important;
}

.asd-stats.asd-vertical.asd-style-inline .asd-stat-inline {
    display: flex !important;
    width: 100%;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.asd-stats.asd-vertical.asd-style-inline .asd-stat-inline::after {
    display: none !important;
}

.asd-stats.asd-vertical.asd-style-inline .asd-stat-inline .asd-count {
    margin-left: auto;
}

/* Sidebar wrapper */
.asd-sidebar-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .asd-style-badge {
        padding: 0 !important;
    }

    .asd-style-inline {
        padding: 0 !important;
    }
    
    .asd-style-badge .asd-stat {
        padding: 0;
        font-size: 0.85em;
    }
    
    .asd-style-inline {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0;
    }
    
    .asd-style-inline .asd-stat-inline:not(:last-child)::after {
        display: none;
    }
    
    .asd-style-button {
        flex-direction: row;
    }
    
    .asd-style-button .asd-btn {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

/* ========================================
   ELEGANT MINIMAL FINISH
   ======================================== */

.asd-stats.asd-style-badge,
.asd-stats.asd-style-inline,
.asd-stats-summary {
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: #4b7d92;
    font-variant-numeric: tabular-nums;
}

.asd-style-badge .asd-label,
.asd-style-inline .asd-label,
.asd-stat-compact .asd-label {
    color: #4b7d92 !important;
    font-weight: 400;
}

.asd-style-badge .asd-count,
.asd-style-inline .asd-count,
.asd-stat-compact .asd-count {
    color: #4b7d92 !important;
    font-weight: 600;
}

.asd-style-badge .asd-galley-downloads::before,
.asd-style-inline .asd-stat-inline:not(:first-child)::before,
.asd-stat-compact.asd-downloads::before {
    content: "";
    display: inline-block;
    flex: 0 0 1px;
    width: 1px;
    height: 14px;
    margin: 0 12px;
    background: rgba(75, 125, 146, 0.38);
    border-radius: 1px;
}

@media (max-width: 480px) {
    .asd-style-badge .asd-galley-downloads::before,
    .asd-style-inline .asd-stat-inline:not(:first-child)::before,
    .asd-stat-compact.asd-downloads::before {
        margin: 0 8px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .asd-stats {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        background: #fff !important;
    }
    
    .asd-galley-superscript,
    .asd-galley-badge {
        display: none !important;
    }
}
