/**
 * Badge System Styles
 * Styling for badge panels, notifications, and components
 */

/* ===== Badges Panel ===== */
.badges-panel-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.badges-panel {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.badges-header {
    margin-bottom: 30px;
}

.badges-header h2 {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
}

.badge-summary {
    display: flex;
    gap: 30px;
    margin-top: 15px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    background: var(--surface-color, #f5f5f5);
    border-radius: 8px;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color, #667eea);
}

.summary-label {
    font-size: 12px;
    color: var(--text-secondary, #666);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Badge Tabs ===== */
.badge-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
}

.badge-tabs .tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary, #666);
    transition: all 0.2s;
}

.badge-tabs .tab:hover {
    color: var(--primary-color, #667eea);
    background: var(--hover-color, #f9f9f9);
}

.badge-tabs .tab.active {
    color: var(--primary-color, #667eea);
    border-bottom-color: var(--primary-color, #667eea);
}

/* ===== Badge Grid ===== */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* ===== Badge Card ===== */
.badge-card {
    background: var(--surface-color, #ffffff);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.badge-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.badge-card.locked {
    opacity: 0.6;
    filter: grayscale(80%);
}

.badge-card.locked .badge-icon {
    opacity: 0.5;
}

.badge-card.in_progress {
    border: 2px solid var(--warning-color, #ffa500);
}

.badge-card.earned {
    border: 2px solid var(--success-color, #10b981);
}

/* ===== Badge Icon ===== */
.badge-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.badge-icon svg {
    width: 40px;
    height: 40px;
}

/* ===== Badge Content ===== */
.badge-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-primary, #1a1a1a);
}

.badge-description {
    font-size: 13px;
    color: var(--text-secondary, #666);
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.badge-points {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-color, #667eea);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.badge-progress {
    margin-top: 12px;
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--border-color, #e0e0e0);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: -20px;
    right: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #666);
}

.badge-date {
    font-size: 11px;
    color: var(--text-tertiary, #999);
    margin-top: 8px;
}

.badge-category {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    font-size: 10px;
    color: var(--text-secondary, #666);
    text-transform: uppercase;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary, #666);
}

.empty-state p {
    margin: 10px 0;
}

/* ===== Badge Notification (Toast) ===== */
.badge-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    transform: translateX(400px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    max-width: 400px;
    min-width: 300px;
}

.badge-notification.show {
    transform: translateX(0);
}

.badge-notification-content {
    display: flex;
    gap: 15px;
    align-items: center;
    position: relative;
}

.badge-icon-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.badge-icon-large svg {
    width: 30px;
    height: 30px;
    color: white;
}

.badge-info {
    flex: 1;
}

.badge-title {
    font-size: 12px;
    text-transform: uppercase;
    opacity: 0.9;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-notification .badge-name {
    font-size: 18px;
    font-weight: 700;
    margin: 4px 0;
    color: white;
}

.badge-notification .badge-description {
    font-size: 13px;
    opacity: 0.9;
    margin: 4px 0;
    color: white;
}

.badge-notification .badge-points {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
    font-size: 12px;
    margin-top: 6px;
}

.badge-close {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.badge-close:hover {
    background: rgba(0,0,0,0.4);
}

/* ===== Leaderboard ===== */
.leaderboard {
    background: var(--surface-color, #ffffff);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    background: var(--background-color, #f5f5f5);
}

.leaderboard-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    border-bottom: 2px solid var(--border-color, #e0e0e0);
}

.leaderboard-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.leaderboard-table tbody tr:hover {
    background: var(--hover-color, #f9f9f9);
}

.leaderboard-table .rank {
    font-weight: 700;
    font-size: 18px;
}

.leaderboard-table .rank.top-rank {
    color: var(--primary-color, #667eea);
}

.leaderboard-table .user {
    font-weight: 500;
}

.leaderboard-table .points {
    font-weight: 600;
    color: var(--primary-color, #667eea);
}

/* ===== Loading & Error States ===== */
.badges-loading,
.leaderboard-loading,
.badges-error {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 4px solid var(--border-color, #e0e0e0);
    border-top-color: var(--primary-color, #667eea);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .badge-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .badge-summary {
        flex-direction: column;
        gap: 10px;
    }

    .badge-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .badge-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== Dark Theme Support ===== */
[data-theme="dark"] .badge-card {
    background: #2a2a2a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .badge-name {
    color: #ffffff;
}

[data-theme="dark"] .badge-description {
    color: #b0b0b0;
}

[data-theme="dark"] .summary-item {
    background: #2a2a2a;
}

[data-theme="dark"] .leaderboard {
    background: #2a2a2a;
}

[data-theme="dark"] .leaderboard-table thead {
    background: #1a1a1a;
}

[data-theme="dark"] .leaderboard-table th {
    color: #ffffff;
}

[data-theme="dark"] .leaderboard-table tbody tr:hover {
    background: #333333;
}
