/**
 * @file plugins/generic/myjournalstats/css/myjournalstats.css
 *
 * Styles for the Advanced Journal Statistics plugin
 *
 * Copyright (c) 2024 MyJournal Stats Plugin
 * Distributed under the GNU GPL v2.
 */

/* Main Container */
.mjs-stats-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    direction: rtl;
    text-align: right;
}

/* Header */
.mjs-stats-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #3b82f6;
}

.mjs-stats-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mjs-stats-title .mjs-icon {
    font-size: 36px;
}

.mjs-stats-subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0;
}

/* Section Styles */
.mjs-section {
    margin-bottom: 40px;
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.mjs-section-title {
    font-size: 22px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mjs-subsection {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed #e2e8f0;
}

.mjs-subsection-title {
    font-size: 18px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 15px 0;
}

/* Stats Grid */
.mjs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

/* Stat Cards */
.mjs-stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e2e8f0;
}

.mjs-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.mjs-stat-card.mjs-stat-large {
    grid-column: span 2;
}

.mjs-stat-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f8fafc;
}

.mjs-stat-info {
    flex: 1;
}

.mjs-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.mjs-stat-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* Stat Card Colors */
.mjs-stat-primary {
    border-right: 4px solid #3b82f6;
}

.mjs-stat-primary .mjs-stat-icon {
    background: #eff6ff;
}

.mjs-stat-secondary {
    border-right: 4px solid #6366f1;
}

.mjs-stat-secondary .mjs-stat-icon {
    background: #eef2ff;
}

.mjs-stat-success {
    border-right: 4px solid #10b981;
}

.mjs-stat-success .mjs-stat-icon {
    background: #ecfdf5;
}

.mjs-stat-info .mjs-stat-icon {
    background: #ecfeff;
}

.mjs-stat-warning {
    border-right: 4px solid #f59e0b;
}

.mjs-stat-warning .mjs-stat-icon {
    background: #fffbeb;
}

.mjs-stat-danger {
    border-right: 4px solid #ef4444;
}

.mjs-stat-danger .mjs-stat-icon {
    background: #fef2f2;
}

/* Bar Chart */
.mjs-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mjs-bar-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mjs-bar-label {
    width: 200px;
    font-size: 14px;
    color: #334155;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mjs-bar-track {
    flex: 1;
    height: 24px;
    background: #f1f5f9;
    border-radius: 12px;
    overflow: hidden;
}

.mjs-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
    border-radius: 12px;
    transition: width 0.8s ease;
    min-width: 10px;
}

.mjs-bar-value {
    width: 50px;
    text-align: center;
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

/* Keyword Cloud */
.mjs-keyword-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 15px;
}

.mjs-keyword {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1e40af;
    border-radius: 20px;
    font-weight: 500;
    transition: transform 0.2s ease;
    cursor: default;
}

.mjs-keyword:hover {
    transform: scale(1.05);
}

.mjs-keyword sup {
    font-size: 10px;
    color: #3b82f6;
    margin-right: 3px;
}

/* Ranking List */
.mjs-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mjs-ranking-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: #f8fafc;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.mjs-ranking-item:hover {
    background: #f1f5f9;
}

.mjs-ranking-number {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

.mjs-ranking-item:nth-child(1) .mjs-ranking-number {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}

.mjs-ranking-item:nth-child(2) .mjs-ranking-number {
    background: linear-gradient(135deg, #94a3b8, #64748b);
}

.mjs-ranking-item:nth-child(3) .mjs-ranking-number {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.mjs-ranking-name {
    flex: 1;
    font-size: 14px;
    color: #334155;
}

.mjs-ranking-count {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* Country Grid */
.mjs-country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.mjs-country-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mjs-country-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.mjs-country-flag {
    font-size: 36px;
    margin-bottom: 8px;
}

.mjs-country-name {
    font-size: 13px;
    color: #334155;
    margin-bottom: 5px;
    font-weight: 500;
}

.mjs-country-count {
    font-size: 18px;
    font-weight: 700;
    color: #1e40af;
}

/* Ratio Chart */
.mjs-ratio-container {
    max-width: 600px;
    margin: 0 auto;
}

.mjs-ratio-chart {
    padding: 20px;
}

.mjs-ratio-bar {
    display: flex;
    height: 50px;
    border-radius: 25px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mjs-ratio-local {
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    transition: width 0.8s ease;
}

.mjs-ratio-intl {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    transition: width 0.8s ease;
}

.mjs-ratio-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.mjs-ratio-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #334155;
}

.mjs-ratio-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.mjs-color-local {
    background: #10b981;
}

.mjs-color-intl {
    background: #3b82f6;
}

/* Chart Container */
.mjs-chart-container {
    margin-top: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
}

/* Compact Mode */
.mjs-compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.mjs-compact-item {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease;
}

.mjs-compact-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.mjs-compact-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 5px;
}

.mjs-compact-label {
    display: block;
    font-size: 12px;
    color: #64748b;
}

/* Tabs */
.mjs-tabs {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.mjs-tab-buttons {
    display: flex;
    background: #f1f5f9;
    border-bottom: 2px solid #e2e8f0;
    overflow-x: auto;
}

.mjs-tab-btn {
    padding: 15px 25px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
    transition: all 0.3s ease;
    position: relative;
}

.mjs-tab-btn:hover {
    color: #1e40af;
    background: #e2e8f0;
}

.mjs-tab-btn.active {
    color: #1e40af;
    background: #fff;
    font-weight: 600;
}

.mjs-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #3b82f6;
}

.mjs-tab-content {
    display: none;
    padding: 25px;
}

.mjs-tab-content.active {
    display: block;
}

/* Footer */
.mjs-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.mjs-last-updated {
    font-size: 13px;
    color: #94a3b8;
}

/* Sidebar Styles */
.mjs-sidebar-block {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    direction: rtl;
}

.mjs-sidebar-header {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    padding: 15px;
}

.mjs-sidebar-header h3 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.mjs-sidebar-content {
    padding: 15px;
}

.mjs-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.mjs-sidebar-icon {
    font-size: 20px;
    width: 35px;
    text-align: center;
}

.mjs-sidebar-label {
    flex: 1;
    font-size: 13px;
    color: #64748b;
}

.mjs-sidebar-value {
    font-size: 16px;
    font-weight: 700;
    color: #1e40af;
}

.mjs-sidebar-footer {
    padding: 12px 15px;
    background: #f8fafc;
    text-align: center;
}

.mjs-sidebar-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.mjs-sidebar-link:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mjs-stats-container {
        padding: 15px;
    }
    
    .mjs-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .mjs-stat-card.mjs-stat-large {
        grid-column: span 1;
    }
    
    .mjs-bar-label {
        width: 120px;
        font-size: 12px;
    }
    
    .mjs-country-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .mjs-tab-btn {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .mjs-ratio-legend {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .mjs-stats-title {
        font-size: 22px;
    }
    
    .mjs-stat-value {
        font-size: 20px;
    }
    
    .mjs-compact-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
