/**
 * FishComp Design System CSS
 *
 * Shared design system for consistent UI across FishComp.
 * Import this file in all new pages for consistent styling.
 *
 * Based on: Global Leaderboard design
 * Version: 1.0
 * Last Updated: December 2024
 *
 * Usage:
 *   <link rel="stylesheet" href="/css/fishcomp-design-system.css">
 */

/* ========================================
   CSS Custom Properties (Theme Variables)
   ======================================== */
:root {
    /* Brand Colors */
    --fc-primary: #0267A1;
    --fc-primary-dark: #013F63;
    --fc-accent: #00C3FF;
    --fc-accent-light: #E0F7FF;

    /* Semantic Colors */
    --fc-success: #28a745;
    --fc-warning: #ffc107;
    --fc-danger: #dc3545;

    /* Medal Colors */
    --fc-gold: #FFD700;
    --fc-silver: #C0C0C0;
    --fc-bronze: #CD7F32;

    /* Neutral Colors */
    --fc-card-bg: #ffffff;
    --fc-card-border: #e0e0e0;
    --fc-text-muted: #5a6169;
    --fc-text-dark: #212529;

    /* Effects */
    --fc-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --fc-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --fc-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    --fc-transition: all 0.3s ease;

    /* Spacing */
    --fc-spacing-xs: 0.25rem;
    --fc-spacing-sm: 0.5rem;
    --fc-spacing-md: 1rem;
    --fc-spacing-lg: 1.5rem;
    --fc-spacing-xl: 2rem;

    /* Border Radius */
    --fc-radius-sm: 6px;
    --fc-radius-md: 8px;
    --fc-radius-lg: 10px;
    --fc-radius-xl: 12px;
    --fc-radius-xxl: 16px;
    --fc-radius-pill: 20px;
    --fc-radius-circle: 50%;
}

/* Dark Mode Overrides */
html.dark-mode {
    --fc-card-bg: #1a1a1a;
    --fc-card-border: #333;
    --fc-text-muted: #adb5bd;
    --fc-text-dark: #f5f5f5;
    --fc-accent-light: #0a2540;
}

/* ========================================
   Base Components
   ======================================== */

/* Standard Card */
.fc-card {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-xl);
    transition: var(--fc-transition);
}

.fc-card:hover {
    box-shadow: var(--fc-shadow-md);
    transform: translateY(-2px);
}

/* Summary Card (Stats) */
.fc-summary-card {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-xl);
    transition: var(--fc-transition);
    text-align: center;
}

.fc-summary-card:hover {
    box-shadow: var(--fc-shadow-md);
    transform: translateY(-2px);
}

.fc-summary-card .card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fc-text-muted);
}

.fc-summary-card .card-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fc-primary);
}

/* ========================================
   Highlighted Cards (Rankings)
   ======================================== */

/* Gold (1st place) */
.fc-card-gold {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 165, 0, 0.08) 100%);
    border: 2px solid var(--fc-gold);
}

/* Silver (2nd place) */
.fc-card-silver {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.12) 0%, rgba(168, 168, 168, 0.08) 100%);
    border: 2px solid var(--fc-silver);
}

/* Bronze (3rd place) */
.fc-card-bronze {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.12) 0%, rgba(184, 115, 51, 0.08) 100%);
    border: 2px solid var(--fc-bronze);
}

/* Current User */
.fc-card-current-user {
    border: 2px solid var(--fc-primary);
    background: var(--fc-accent-light);
    box-shadow: 0 2px 12px rgba(2, 103, 161, 0.2);
}

/* ========================================
   Sticky User Badge
   ======================================== */
.fc-sticky-badge {
    position: sticky;
    top: 70px;
    z-index: 100;
    background: linear-gradient(135deg, var(--fc-primary) 0%, var(--fc-primary-dark) 100%);
    color: white;
    padding: var(--fc-spacing-md) 1.25rem;
    border-radius: var(--fc-radius-xl);
    margin-bottom: var(--fc-spacing-lg);
    box-shadow: var(--fc-shadow-md);
    animation: fc-slideDown 0.5s ease-out;
}

@keyframes fc-slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.fc-sticky-badge-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--fc-spacing-md);
}

/* ========================================
   Buttons
   ======================================== */

/* Filter Button */
.fc-filter-btn {
    padding: 0.625rem 1.25rem;
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-md);
    cursor: pointer;
    transition: var(--fc-transition);
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--fc-text-dark);
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.fc-filter-btn:hover {
    border-color: var(--fc-primary);
    color: var(--fc-primary);
    text-decoration: none;
}

.fc-filter-btn.active {
    background: var(--fc-primary);
    color: white;
    border-color: var(--fc-primary);
}

/* Ghost Button (for dark backgrounds) */
.fc-btn-ghost {
    padding: var(--fc-spacing-sm) var(--fc-spacing-md);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--fc-radius-sm);
    color: white;
    cursor: pointer;
    transition: var(--fc-transition);
    text-decoration: none;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: var(--fc-spacing-sm);
}

.fc-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    color: white;
}

/* Action Button */
.fc-action-btn {
    border-radius: var(--fc-radius-md);
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    transition: var(--fc-transition);
}

.fc-action-btn:hover {
    background: var(--fc-primary);
    color: white;
    border-color: var(--fc-primary);
}

/* ========================================
   Achievement Badges
   ======================================== */
.fc-achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--fc-radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
}

.fc-badge-beginner {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    color: #2E7D32;
}

.fc-badge-explorer {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    color: #1565C0;
}

.fc-badge-hunter {
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    color: #E65100;
}

.fc-badge-expert {
    background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
    color: #7B1FA2;
}

.fc-badge-master {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFE082 100%);
    color: #F57F17;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* Dark mode badge adjustments */
html.dark-mode .fc-badge-beginner {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 100%);
    color: #A5D6A7;
}

html.dark-mode .fc-badge-explorer {
    background: linear-gradient(135deg, #0D47A1 0%, #1565C0 100%);
    color: #90CAF9;
}

html.dark-mode .fc-badge-hunter {
    background: linear-gradient(135deg, #BF360C 0%, #E65100 100%);
    color: #FFCC80;
}

html.dark-mode .fc-badge-expert {
    background: linear-gradient(135deg, #4A148C 0%, #7B1FA2 100%);
    color: #CE93D8;
}

html.dark-mode .fc-badge-master {
    background: linear-gradient(135deg, #FF8F00 0%, #FFB300 100%);
    color: #000;
}

/* ========================================
   Badge Legend
   ======================================== */
.fc-badge-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem var(--fc-spacing-md);
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-lg);
    font-size: 0.85rem;
}

.fc-badge-legend-title {
    font-weight: 600;
    color: var(--fc-text-muted);
}

/* ========================================
   Filter Container
   ======================================== */
.fc-filters {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-xl);
    padding: var(--fc-spacing-md);
}

.fc-filter-group {
    display: flex;
    gap: var(--fc-spacing-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.fc-filter-group::-webkit-scrollbar {
    display: none;
}

/* ========================================
   List Entry Row
   ======================================== */
.fc-list-entry {
    display: flex;
    align-items: center;
    padding: var(--fc-spacing-md) 1.25rem;
    margin-bottom: 0.75rem;
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-xl);
    transition: var(--fc-transition);
}

.fc-list-entry:hover {
    box-shadow: var(--fc-shadow-md);
    transform: translateY(-2px);
}

/* Rank Column */
.fc-rank-column {
    flex: 0 0 70px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--fc-spacing-xs);
    padding-right: 0.75rem;
    border-right: 2px solid var(--fc-card-border);
}

.fc-rank-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fc-text-dark);
}

.fc-rank-medal {
    font-size: 1.25rem;
}

/* Participant Column */
.fc-participant-column {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--fc-spacing-md);
    min-width: 0;
    padding: 0 var(--fc-spacing-md);
}

/* Avatar */
.fc-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--fc-radius-circle);
    object-fit: cover;
    background: var(--fc-accent-light);
    flex-shrink: 0;
    border: 2px solid var(--fc-card-border);
}

.fc-avatar-sm {
    width: 40px;
    height: 40px;
}

.fc-avatar-lg {
    width: 64px;
    height: 64px;
}

/* Participant Info */
.fc-participant-info {
    display: flex;
    flex-direction: column;
    gap: var(--fc-spacing-xs);
    min-width: 0;
}

.fc-participant-name {
    font-weight: 600;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--fc-text-dark);
}

/* Stats Column */
.fc-stats-column {
    flex: 0 0 100px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 var(--fc-spacing-sm);
}

.fc-stat-count {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--fc-primary);
    line-height: 1;
}

.fc-stat-label {
    font-size: 0.75rem;
    color: var(--fc-text-muted);
    text-transform: uppercase;
    font-weight: 500;
}

/* Actions Column */
.fc-actions-column {
    flex: 0 0 auto;
    padding-left: var(--fc-spacing-sm);
}

/* ========================================
   Hero Section
   ======================================== */
.fc-hero {
    position: relative;
    color: white;
    padding: 50px 0;
    margin-bottom: 30px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

/* Dark overlay removed - hero images are dark by design and don't need overlay */

.fc-hero > .container {
    position: relative;
    z-index: 1;
}

.fc-hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow:
        0 0 20px rgba(0,0,0,0.8),
        0 0 40px rgba(0,0,0,0.5),
        2px 2px 4px rgba(0,0,0,0.9);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.fc-hero .lead {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 500;
    text-shadow:
        0 0 15px rgba(0,0,0,0.8),
        1px 1px 3px rgba(0,0,0,0.9);
}

/* ========================================
   Gallery Cards
   ======================================== */
.fc-gallery-card {
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-lg);
    overflow: hidden;
    transition: var(--fc-transition);
    height: 100%;
    position: relative;
}

.fc-gallery-card:hover {
    box-shadow: var(--fc-shadow-md);
    transform: translateY(-3px);
}

.fc-gallery-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    background: var(--fc-accent-light);
}

.fc-gallery-card-info {
    padding: 0.75rem;
}

.fc-gallery-card-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--fc-text-dark);
    margin-bottom: var(--fc-spacing-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fc-gallery-card-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--fc-text-muted);
    font-style: italic;
    margin-bottom: var(--fc-spacing-sm);
}

/* ========================================
   Pagination
   ======================================== */
.fc-pagination .page-link {
    border-radius: var(--fc-radius-md);
    margin: 0 0.15rem;
    color: var(--fc-primary);
    border-color: var(--fc-card-border);
    transition: var(--fc-transition);
}

.fc-pagination .page-link:hover {
    background: var(--fc-accent-light);
    color: var(--fc-primary);
    border-color: var(--fc-primary);
}

.fc-pagination .page-item.active .page-link {
    background: var(--fc-primary);
    border-color: var(--fc-primary);
    color: white;
}

.fc-pagination .page-item.disabled .page-link {
    color: var(--fc-text-muted);
}

/* Dark mode pagination */
html.dark-mode .fc-pagination .page-link {
    background: var(--fc-card-bg);
    color: var(--fc-accent);
    border-color: var(--fc-card-border);
}

html.dark-mode .fc-pagination .page-link:hover {
    background: var(--fc-accent-light);
    color: var(--fc-accent);
}

/* ========================================
   Modal Improvements
   ======================================== */
.fc-modal .modal-content {
    border-radius: var(--fc-radius-xxl);
    border: none;
}

.fc-modal .modal-header {
    border-bottom: 1px solid var(--fc-card-border);
    padding: var(--fc-spacing-md) var(--fc-spacing-lg);
}

.fc-modal .modal-body {
    padding: var(--fc-spacing-lg);
}

.fc-modal .modal-footer {
    border-top: 1px solid var(--fc-card-border);
    padding: var(--fc-spacing-md) var(--fc-spacing-lg);
}

/* ========================================
   Animations
   ======================================== */

/* Highlight Flash */
@keyframes fc-flashHighlight {
    0%, 100% {
        background: var(--fc-card-bg);
    }
    25%, 75% {
        background: rgba(0, 195, 255, 0.25);
    }
    50% {
        background: rgba(0, 195, 255, 0.4);
    }
}

.fc-highlight-flash {
    animation: fc-flashHighlight 2s ease-out;
}

/* Dark mode flash */
html.dark-mode .fc-highlight-flash {
    animation: fc-flashHighlightDark 2s ease-out;
}

@keyframes fc-flashHighlightDark {
    0%, 100% {
        background: var(--fc-card-bg);
    }
    25%, 75% {
        background: rgba(0, 195, 255, 0.2);
    }
    50% {
        background: rgba(0, 195, 255, 0.35);
    }
}

/* ========================================
   Dark Mode Component Overrides
   ======================================== */
html.dark-mode .fc-card,
html.dark-mode .fc-summary-card,
html.dark-mode .fc-filters,
html.dark-mode .fc-badge-legend,
html.dark-mode .fc-list-entry,
html.dark-mode .fc-gallery-card {
    background: var(--fc-card-bg);
    border-color: var(--fc-card-border);
}

html.dark-mode .fc-filter-btn {
    background: var(--fc-card-bg);
    color: var(--fc-text-dark);
    border-color: var(--fc-card-border);
}

html.dark-mode .fc-filter-btn:hover {
    color: var(--fc-accent);
    border-color: var(--fc-accent);
}

html.dark-mode .fc-filter-btn.active {
    background: var(--fc-primary);
    color: white;
}

html.dark-mode .fc-rank-column {
    border-right-color: var(--fc-card-border);
}

html.dark-mode .fc-avatar {
    border-color: var(--fc-card-border);
}

html.dark-mode .fc-stat-count {
    color: var(--fc-accent);
}

html.dark-mode .fc-action-btn {
    color: var(--fc-accent);
    border-color: var(--fc-accent);
}

html.dark-mode .fc-action-btn:hover {
    background: var(--fc-accent);
    color: #000;
}

/* Dark mode ranking cards */
html.dark-mode .fc-card-gold {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 165, 0, 0.1) 100%);
}

html.dark-mode .fc-card-silver {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.15) 0%, rgba(168, 168, 168, 0.1) 100%);
}

html.dark-mode .fc-card-bronze {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.15) 0%, rgba(184, 115, 51, 0.1) 100%);
}

html.dark-mode .fc-card-current-user {
    background: rgba(0, 195, 255, 0.1);
}

/* ========================================
   Responsive Styles
   ======================================== */
@media (max-width: 767px) {
    /* Hero */
    .fc-hero {
        padding: 30px 0;
    }
    .fc-hero h1 {
        font-size: 1.8rem;
    }

    /* Sticky badge */
    .fc-sticky-badge {
        top: 60px;
        padding: 0.75rem var(--fc-spacing-md);
    }
    .fc-sticky-badge-content {
        flex-direction: column;
        text-align: center;
    }

    /* List entry */
    .fc-list-entry {
        flex-wrap: wrap;
        padding: 0.75rem;
    }

    .fc-rank-column {
        flex: 0 0 55px;
        padding-right: var(--fc-spacing-sm);
    }
    .fc-rank-number {
        font-size: 1.25rem;
    }

    .fc-participant-column {
        flex: 1;
        padding: 0 var(--fc-spacing-sm);
        gap: var(--fc-spacing-sm);
    }

    .fc-avatar {
        width: 40px;
        height: 40px;
    }
    .fc-participant-name {
        font-size: 0.9rem;
    }

    .fc-stats-column {
        flex: 0 0 auto;
        padding: 0 var(--fc-spacing-sm);
    }
    .fc-stat-count {
        font-size: 1.25rem;
    }
    .fc-stat-label {
        font-size: 0.65rem;
    }

    .fc-actions-column {
        flex-basis: 100%;
        margin-top: 0.75rem;
        padding-left: 0;
    }
    .fc-actions-column .btn {
        width: 100%;
    }

    /* Filters */
    .fc-filter-group {
        width: 100%;
        justify-content: center;
    }
    .fc-filter-btn {
        padding: var(--fc-spacing-sm) 0.75rem;
        font-size: 0.8rem;
    }

    /* Badge legend */
    .fc-badge-legend {
        justify-content: center;
        font-size: 0.75rem;
    }
    .fc-badge-legend-title {
        width: 100%;
        text-align: center;
        margin-bottom: var(--fc-spacing-xs);
    }

    /* Summary cards */
    .fc-summary-card .card-title {
        font-size: 0.75rem;
    }
    .fc-summary-card .card-text {
        font-size: 1.25rem !important;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    .fc-rank-column {
        flex: 0 0 60px;
    }
    .fc-avatar {
        width: 42px;
        height: 42px;
    }
    .fc-stat-count {
        font-size: 1.5rem;
    }
}

/* ========================================
   Accessibility
   ======================================== */

/* Focus indicators */
.fc-filter-btn:focus,
.fc-action-btn:focus,
.fc-btn-ghost:focus,
.fc-pagination .page-link:focus {
    outline: 2px solid var(--fc-accent);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .fc-card,
    .fc-summary-card,
    .fc-list-entry,
    .fc-gallery-card,
    .fc-filter-btn,
    .fc-action-btn,
    .fc-sticky-badge {
        transition: none;
    }

    .fc-card:hover,
    .fc-summary-card:hover,
    .fc-list-entry:hover,
    .fc-gallery-card:hover {
        transform: none;
    }

    .fc-highlight-flash {
        animation: none;
        background: rgba(0, 195, 255, 0.3);
    }

    .fc-sticky-badge {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .fc-card,
    .fc-list-entry,
    .fc-filter-btn,
    .fc-badge-legend,
    .fc-gallery-card {
        border-width: 2px;
    }

    .fc-achievement-badge {
        border: 1px solid currentColor;
    }
}
