/**
 * Components Stylesheet
 * Specific component styles for UI elements
 * SMK Negeri Bansari - Leaderboard Kedisiplinan
 */

/* ================================================
   Mobile Cards (Card View for Mobile)
   ================================================ */

.mobile-cards {
    display: none;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
}

.mobile-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-light);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast);
}

.mobile-card:hover {
    box-shadow: var(--shadow-md);
}

.mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--color-background) 0%, var(--color-surface) 100%);
    border-bottom: 1px solid var(--color-border-light);
}

.mobile-card-rank {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.mobile-card-class-btn {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-primary);
    flex: 1;
    text-align: center;
}

.mobile-card-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
}

.mobile-card-score .score-value {
    font-size: var(--text-xl);
    background: var(--color-primary-light);
    color: #ffffff;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
}

.mobile-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface);
}

.mobile-stat {
    text-align: center;
    padding: var(--space-sm);
    background: var(--color-background);
    border-radius: var(--radius-sm);
}

.mobile-stat .stat-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-stat .stat-value {
    display: block;
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-text);
}

/* ================================================
   Doughnut Chart Legend
   ================================================ */

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--color-background);
    border-radius: var(--radius-md);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: var(--text-sm);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.legend-label {
    flex: 1;
    color: var(--color-text);
    font-weight: 500;
}

.legend-value {
    font-weight: 600;
    color: var(--color-text-light);
}

/* ================================================
   Rank Badges (Top 3 Special)
   ================================================ */

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    font-size: var(--text-xl);
    font-weight: 700;
    position: relative;
}

.rank-badge-gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #000;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.rank-badge-silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #a0a0a0 100%);
    color: #000;
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.4);
}

.rank-badge-bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.4);
}

.rank-badge-icon {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: var(--text-lg);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* ================================================
   Score Progress Bar
   ================================================ */

.score-progress {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.score-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--color-background);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.score-progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.score-progress-fill.excellent {
    background: linear-gradient(90deg, var(--color-success-light), var(--color-success));
}

.score-progress-fill.good {
    background: linear-gradient(90deg, var(--color-primary-light), var(--color-primary));
}

.score-progress-fill.average {
    background: linear-gradient(90deg, var(--color-warning-light), var(--color-warning));
}

.score-progress-fill.poor {
    background: linear-gradient(90deg, var(--color-danger-light), var(--color-danger));
}

.score-progress-value {
    min-width: 50px;
    text-align: right;
    font-weight: 700;
    font-size: var(--text-base);
}

/* ================================================
   Attendance Breakdown Visual
   ================================================ */

.attendance-breakdown {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.attendance-segment {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
}

.attendance-segment-label {
    color: inherit;
}

.attendance-segment-value {
    font-weight: 700;
}

.segment-ontime {
    background: rgba(var(--color-success-rgb), 0.15);
    color: var(--color-success);
}

.segment-late1 {
    background: rgba(var(--color-warning-rgb), 0.15);
    color: var(--color-warning);
}

.segment-late2 {
    background: rgba(230, 126, 34, 0.15);
    color: #e67e22;
}

.segment-late3 {
    background: rgba(var(--color-danger-rgb), 0.15);
    color: var(--color-danger);
}

.segment-lateMore3 {
    background: rgba(192, 57, 43, 0.15);
    color: #c0392b;
}

/* ================================================
   Tooltip
   ================================================ */

.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-text);
    color: #ffffff;
    font-size: var(--text-xs);
    font-weight: 500;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-md);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ================================================
   Loading Indicator
   ================================================ */

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--color-text-muted);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary-light);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-md);
}

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

.loading-text {
    font-size: var(--text-sm);
}

/* ================================================
   Empty State
   ================================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-lg);
    color: var(--color-text-muted);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.empty-state-description {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    max-width: 400px;
}

/* ================================================
   Notification/Alert
   ================================================ */

.notification {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.notification-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: var(--text-sm);
    margin-bottom: var(--space-xs);
}

.notification-message {
    font-size: var(--text-sm);
    color: var(--color-text-light);
}

.notification-success {
    background: rgba(var(--color-success-rgb), 0.1);
    border-left: 4px solid var(--color-success);
}

.notification-success .notification-icon {
    color: var(--color-success);
}

.notification-warning {
    background: rgba(var(--color-warning-rgb), 0.1);
    border-left: 4px solid var(--color-warning);
}

.notification-warning .notification-icon {
    color: var(--color-warning);
}

.notification-danger {
    background: rgba(var(--color-danger-rgb), 0.1);
    border-left: 4px solid var(--color-danger);
}

.notification-danger .notification-icon {
    color: var(--color-danger);
}

.notification-info {
    background: rgba(var(--color-primary-rgb), 0.1);
    border-left: 4px solid var(--color-primary-light);
}

.notification-info .notification-icon {
    color: var(--color-primary-light);
}

/* ================================================
   Divider
   ================================================ */

.divider {
    height: 1px;
    background: var(--color-border-light);
    margin: var(--space-lg) 0;
    border: none;
}

.divider-vertical {
    width: 1px;
    height: 100%;
    background: var(--color-border-light);
    margin: 0 var(--space-md);
}

/* ================================================
   Badge (Generic)
   ================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1;
}

.badge-primary {
    background: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-primary);
}

.badge-success {
    background: rgba(var(--color-success-rgb), 0.15);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(var(--color-warning-rgb), 0.15);
    color: var(--color-warning);
}

.badge-danger {
    background: rgba(var(--color-danger-rgb), 0.15);
    color: var(--color-danger);
}

/* ================================================
   Tag
   ================================================ */

.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    background: var(--color-background);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--color-text-light);
}

.tag-icon {
    width: 12px;
    height: 12px;
}

/* ================================================
   Avatar/Class Icon
   ================================================ */

.class-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: var(--text-sm);
    color: #ffffff;
    flex-shrink: 0;
}

.class-icon-grade-x {
    background: linear-gradient(135deg, var(--color-success-light), var(--color-success));
}

.class-icon-grade-xi {
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
}

.class-icon-grade-xii {
    background: linear-gradient(135deg, var(--color-warning-light), var(--color-warning));
}

/* ================================================
   Comparison Arrow
   ================================================ */

.comparison-arrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    font-weight: 600;
}

.comparison-arrow-up {
    color: var(--color-success);
}

.comparison-arrow-down {
    color: var(--color-danger);
}

.comparison-arrow-same {
    color: var(--color-text-muted);
}

.comparison-arrow-icon {
    width: 16px;
    height: 16px;
}

/* ================================================
   Skeleton Loader
   ================================================ */

.skeleton {
    background: linear-gradient(90deg,
        var(--color-background) 0%,
        var(--color-border-light) 50%,
        var(--color-background) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--space-sm);
}

.skeleton-text-sm {
    height: 12px;
    width: 60%;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-rect {
    height: 200px;
}
