/**
 * User Profile Modern Styles
 * 
 * Aligned with existing plugin color variables and design system.
 *
 * @package RandoBrevets
 */

/* ====================================
   PROFILE MODERN - CONTAINER
   ==================================== */

.rando-profile {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--gap-lg, 20px);
    font-family: var(--font-body, 'Inter', sans-serif);
}

/* ====================================
   PROFILE HEADER CARD
   ==================================== */

.rando-profile-header-card {
    background: linear-gradient(135deg, var(--color-surface-2, #f8fafc) 0%, var(--color-white, #fff) 100%);
    border-radius: var(--radius-xl, 16px);
    padding: var(--gap-xl, 30px) var(--gap-xxl, 40px);
    margin-bottom: var(--gap-xl, 30px);
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
    border: 1px solid var(--color-border, #e5e7eb);
}

.rando-profile-header-content {
    display: flex;
    align-items: center;
    gap: var(--gap-xl, 30px);
}

.rando-profile-avatar {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--color-white, #fff);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
}

.rando-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rando-profile-info {
    flex: 1;
}

.rando-profile-name {
    font-size: var(--font-size-4xl, 28px);
    font-weight: var(--font-weight-bold, 700);
    color: var(--color-text, #0f172a);
    margin: 0 0 var(--gap-sm, 10px) 0;
    line-height: 1.2;
}

.rando-profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-md, 15px);
}

.rando-profile-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-base, 14px);
    color: var(--color-text-muted, #475569);
}

.rando-profile-icon {
    width: 18px;
    height: 18px;
    color: var(--color-primary, #2563eb);
}

/* ====================================
   PROFILE SECTIONS
   ==================================== */

.rando-profile-section {
    background: var(--color-white, #fff);
    border-radius: var(--radius-lg, 12px);
    padding: var(--gap-xl, 30px);
    margin-bottom: var(--gap-xl, 30px);
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
    border: 1px solid var(--color-border, #e5e7eb);
}

.rando-profile-section-header {
    margin-bottom: var(--gap-lg, 20px);
    padding-bottom: var(--gap-md, 15px);
    border-bottom: 2px solid var(--color-surface-2, #f8fafc);
}

.rando-profile-section-title {
    font-size: var(--font-size-2xl, 20px);
    font-weight: var(--font-weight-bold, 700);
    color: var(--color-text, #0f172a);
    margin: 0 0 var(--gap-sm, 10px) 0;
}

.rando-profile-section-subtitle {
    font-size: var(--font-size-base, 14px);
    color: var(--color-text-muted, #475569);
    margin: 0;
}

/* ====================================
   YEAR FILTER
   ==================================== */

.rando-profile-year-filter {
    margin-bottom: var(--gap-lg, 20px);
}

.rando-year-filter-form {
    display: flex;
    align-items: center;
    gap: var(--gap-md, 15px);
}

.rando-year-filter-label {
    font-size: var(--font-size-base, 14px);
    font-weight: var(--font-weight-semi-bold, 600);
    color: var(--color-text, #0f172a);
}

.rando-year-filter-select {
    padding: var(--padding-md, 10px) var(--padding-lg, 15px);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-md, 8px);
    font-size: var(--font-size-base, 14px);
    color: var(--color-text, #0f172a);
    background: var(--color-white, #fff);
    cursor: pointer;
    min-width: 140px;
    transition: border-color var(--transition-fast, 150ms ease), box-shadow var(--transition-fast, 150ms ease);
}

.rando-year-filter-select:hover {
    border-color: var(--color-primary, #2563eb);
}

.rando-year-filter-select:focus {
    outline: none;
    border-color: var(--color-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ====================================
   STATS CARDS GRID
   ==================================== */

.rando-profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap-lg, 20px);
}

.rando-profile-stat-card {
    display: flex;
    align-items: center;
    gap: var(--gap-md, 15px);
    padding: var(--gap-lg, 20px);
    border-radius: var(--radius-lg, 12px);
    background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
    border: 1px solid var(--color-border, #e5e7eb);
    transition: transform var(--transition-fast, 150ms ease), box-shadow var(--transition-fast, 150ms ease);
}

.rando-profile-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

.rando-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg, 12px);
    flex-shrink: 0;
}

.rando-stat-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 2;
}

/* Primary stat - Blue */
.rando-stat-primary .rando-stat-icon {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(30, 64, 175, 0.15) 100%);
    color: var(--color-primary, #2563eb);
}

/* Secondary stat - Teal */
.rando-stat-secondary .rando-stat-icon {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
    color: var(--color-secondary, #0ea5e9);
}

/* Accent stat - Amber/Green */
.rando-stat-accent .rando-stat-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%);
    color: var(--color-success, #10b981);
}

.rando-stat-content {
    flex: 1;
    min-width: 0;
}

.rando-stat-value {
    font-size: var(--font-size-3xl, 24px);
    font-weight: var(--font-weight-bold, 700);
    color: var(--color-text, #0f172a);
    line-height: 1.2;
}

.rando-stat-unit {
    font-size: var(--font-size-lg, 16px);
    font-weight: var(--font-weight-semi-bold, 600);
    color: var(--color-text-muted, #475569);
    margin-left: 2px;
}

.rando-stat-label {
    font-size: var(--font-size-sm, 12px);
    color: var(--color-text-muted, #475569);
    margin-top: 4px;
}

/* ====================================
   DETAILED STATS
   ==================================== */

.rando-profile-detailed-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap-lg, 20px);
}

.rando-profile-stat-group {
    background: var(--color-surface-2, #f8fafc);
    border-radius: var(--radius-md, 8px);
    padding: var(--gap-md, 15px);
}

.rando-stat-group-title {
    font-size: var(--font-size-sm, 12px);
    font-weight: var(--font-weight-semi-bold, 600);
    color: var(--color-text-muted, #475569);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 var(--gap-md, 15px) 0;
    padding-bottom: var(--gap-sm, 10px);
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.rando-stat-items {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm, 10px);
}

.rando-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--padding-sm, 5px) 0;
}

.rando-stat-item-label {
    font-size: var(--font-size-base, 14px);
    color: var(--color-text, #0f172a);
}

.rando-stat-item-value {
    font-size: var(--font-size-base, 14px);
    font-weight: var(--font-weight-bold, 700);
    color: var(--color-primary, #2563eb);
}

/* ====================================
   TABLE STYLES
   ==================================== */

.rando-profile-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--color-border, #e5e7eb);
}

.rando-profile-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.rando-profile-table thead th {
    background: var(--color-surface-2, #f8fafc);
    padding: var(--padding-lg, 15px) var(--padding-md, 10px);
    text-align: left;
    font-size: var(--font-size-sm, 12px);
    font-weight: var(--font-weight-semi-bold, 600);
    color: var(--color-text-muted, #475569);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-border, #e5e7eb);
    white-space: nowrap;
    user-select: none;
}

.rando-profile-table thead th.sortable {
    cursor: pointer;
    transition: background-color var(--transition-fast, 150ms ease);
}

.rando-profile-table thead th.sortable:hover {
    background: var(--color-light-gray, #cbd5e1);
}

.rando-profile-table thead th .sort-icon {
    margin-left: 4px;
    opacity: 0.5;
    font-size: 10px;
}

.rando-profile-table thead th.sort-asc .sort-icon,
.rando-profile-table thead th.sort-desc .sort-icon {
    opacity: 1;
    color: var(--color-primary, #2563eb);
}

.rando-profile-table thead th.sort-asc .sort-icon::after {
    content: '↑';
}

.rando-profile-table thead th.sort-desc .sort-icon::after {
    content: '↓';
}

.rando-profile-table thead th.sort-asc .sort-icon,
.rando-profile-table thead th.sort-desc .sort-icon {
    font-size: 0; /* Hide original content */
}

.rando-profile-table thead th.sort-asc .sort-icon::after,
.rando-profile-table thead th.sort-desc .sort-icon::after {
    font-size: 12px;
}

.rando-profile-table tbody tr {
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    transition: background-color var(--transition-fast, 150ms ease);
}

.rando-profile-table tbody tr:hover {
    background: var(--color-surface-2, #f8fafc);
}

.rando-profile-table tbody tr:last-child {
    border-bottom: none;
}

.rando-profile-table tbody td {
    padding: var(--padding-md, 10px);
    font-size: var(--font-size-base, 14px);
    color: var(--color-text, #0f172a);
    vertical-align: middle;
}

/* Column styles */
.rando-profile-table .col-date {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.rando-profile-table .col-event {
    min-width: 200px;
}

.rando-profile-table .col-event .event-link {
    color: var(--color-primary, #2563eb);
    text-decoration: none;
    font-weight: var(--font-weight-semi-bold, 600);
    transition: color var(--transition-fast, 150ms ease);
}

.rando-profile-table .col-event .event-link:hover {
    color: var(--color-primary-dark, #1e40af);
    text-decoration: underline;
}

.rando-profile-table .col-event .event-name {
    font-weight: var(--font-weight-semi-bold, 600);
}

.rando-profile-table .col-event .event-type-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: var(--font-weight-semi-bold, 600);
    background: var(--color-surface-2, #f8fafc);
    color: var(--color-text-muted, #475569);
    white-space: nowrap;
}

.rando-profile-table .col-distance,
.rando-profile-table .col-time {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.rando-profile-table .col-status {
    text-align: center;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: var(--font-size-sm, 12px);
    font-weight: var(--font-weight-semi-bold, 600);
    white-space: nowrap;
}

.status-badge.status-completed {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%);
    color: var(--color-success, #10b981);
}

.status-badge.status-dns,
.status-badge.status-dnf {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    color: var(--color-error, #ef4444);
}

.status-badge.status-pending {
    background: var(--color-surface-2, #f8fafc);
    color: var(--color-text-muted, #475569);
}

/* Row status styles */
.rando-profile-table tbody tr.status-dns,
.rando-profile-table tbody tr.status-dnf {
    background: rgba(239, 68, 68, 0.03);
}

.rando-profile-table tbody tr.status-dns:hover,
.rando-profile-table tbody tr.status-dnf:hover {
    background: rgba(239, 68, 68, 0.06);
}

/* Table footer */
.rando-profile-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--padding-md, 10px) 0;
    margin-top: var(--gap-md, 15px);
}

.table-count {
    font-size: var(--font-size-sm, 12px);
    color: var(--color-text-muted, #475569);
}

/* Empty state */
.rando-profile-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--gap-xxl, 40px);
    text-align: center;
}

.rando-profile-empty-state .empty-icon {
    width: 64px;
    height: 64px;
    color: var(--color-light-gray, #cbd5e1);
    margin-bottom: var(--gap-md, 15px);
}

.rando-profile-empty-state p {
    font-size: var(--font-size-base, 14px);
    color: var(--color-text-muted, #475569);
    margin: 0;
}

/* ====================================
   RESPONSIVE DESIGN
   ==================================== */

@media (max-width: 1024px) {
    .rando-profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rando-profile-detailed-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .rando-profile {
        padding: var(--gap-md, 15px);
    }
    
    .rando-profile-header-card {
        padding: var(--gap-lg, 20px);
    }
    
    .rando-profile-header-content {
        flex-direction: column;
        text-align: center;
        gap: var(--gap-md, 15px);
    }
    
    .rando-profile-avatar {
        width: 80px;
        height: 80px;
    }
    
    .rando-profile-name {
        font-size: var(--font-size-2xl, 20px);
    }
    
    .rando-profile-meta {
        justify-content: center;
    }
    
    .rando-profile-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .rando-profile-detailed-stats {
        grid-template-columns: 1fr;
    }
    
    .rando-profile-section {
        padding: var(--gap-md, 15px);
    }
    
    .rando-profile-stat-card {
        padding: var(--gap-md, 15px);
    }
    
    .rando-stat-icon {
        width: 48px;
        height: 48px;
    }
    
    .rando-stat-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .rando-stat-value {
        font-size: var(--font-size-xl, 18px);
    }
    
    /* Table responsive */
    .rando-profile-table .col-event .event-type-badge {
        display: block;
        margin-left: 0;
        margin-top: 4px;
        width: fit-content;
    }
}

@media (max-width: 480px) {
    .rando-year-filter-form {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--gap-sm, 10px);
    }
    
    .rando-year-filter-select {
        width: 100%;
    }
    
    .rando-profile-stat-card {
        flex-direction: column;
        text-align: center;
    }
}
