@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary-color: #06b6d4;
    --success-color: #059669;
    --success-hover: #047857;
    --warning-color: #d97706;
    --warning-hover: #b45309;
    --danger-color: #e11d48;
    --danger-hover: #be123c;
    --dark-color: #0f172a;
    --card-bg: #ffffff;
    --body-bg: #f8fafc;
    --border-color: #e2e8f0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--body-bg);
    color: #334155;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* Custom Navbar */
.navbar-custom {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.navbar-brand {
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 8px;
    padding: 0.5rem 0.85rem !important;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff !important;
}

/* Custom Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--card-bg);
}

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

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 700;
}

/* Stat Cards */
.stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: #e0e7ff; color: #4338ca; }
.stat-success .stat-icon { background: #d1fae5; color: #047857; }
.stat-warning .stat-icon { background: #fef3c7; color: #b45309; }
.stat-info .stat-icon { background: #cffafe; color: #0e7490; }

/* ==========================================================================
   BUTTONS DESIGN SYSTEM (Modern, Sleek, Consistent & Responsive)
   ========================================================================== */
.btn {
    font-weight: 600;
    font-size: 0.92rem;
    border-radius: 10px;
    padding: 0.55rem 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    line-height: 1.4;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.btn:active {
    transform: scale(0.98);
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.32);
}

/* Success Button (Emerald) */
.btn-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.2);
}

.btn-success:hover, .btn-success:focus {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.32);
}

/* Warning Button (Warm Gold/Amber) */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff !important;
    border: none;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover, .btn-warning:focus {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.32);
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover, .btn-danger:focus {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.32);
}

/* Outline Buttons */
.btn-outline-primary {
    border: 1.5px solid #4f46e5;
    color: #4f46e5;
    background: transparent;
}
.btn-outline-primary:hover {
    background: #4f46e5;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn-outline-secondary {
    border: 1.5px solid #cbd5e1;
    color: #475569;
    background: #ffffff;
}
.btn-outline-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
    transform: translateY(-1px);
}

.btn-outline-danger {
    border: 1.5px solid #fca5a5;
    color: #dc2626;
    background: transparent;
}
.btn-outline-danger:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

/* Light Button */
.btn-light {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: #334155;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}
.btn-light:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
    transform: translateY(-1px);
}

/* Rounded Pill modifier */
.btn-pill, .rounded-pill {
    border-radius: 50rem !important;
}

/* Button Sizes */
.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.825rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 0.75rem 1.6rem;
    font-size: 1rem;
    border-radius: 12px;
}

/* Form Controls Harmonization */
.form-control, .form-select {
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding: 0.55rem 0.9rem;
    font-size: 0.92rem;
    color: #334155;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Action button container */
.action-btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   Upload Preview Box
   ========================================================================== */
.preview-box {
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 1.25rem;
    text-align: center;
    background-color: #f8fafc;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.preview-box:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

.preview-box img {
    max-height: 200px;
    width: 100%;
    object-fit: cover;
    border-radius: 10px;
}

/* ==========================================================================
   Leaderboard Rankings
   ========================================================================== */
.rank-badge {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}

.rank-1 {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
}

.rank-2 {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(148, 163, 184, 0.4);
}

.rank-3 {
    background: linear-gradient(135deg, #d97706 0%, #92400e 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.4);
}

.podium-card {
    background: #fff;
    border-radius: 20px;
    padding: 1.75rem 1rem;
    text-align: center;
    border: 2px solid transparent;
    position: relative;
}

.podium-1 {
    border-color: #fbbf24;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
    transform: scale(1.04);
}

.podium-2 {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.podium-3 {
    border-color: #fcd34d;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
}

/* Mobile Leaderboard Spotlight & Item Cards */
.spotlight-card {
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
    border: 2px solid #f59e0b;
    border-radius: 20px;
    padding: 1.25rem;
    box-shadow: 0 8px 20px -4px rgba(245, 158, 11, 0.2);
    position: relative;
}

.spotlight-card-sub {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
}

.ranking-item-mobile {
    background: #ffffff;
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.ranking-item-mobile.is-me {
    border-color: #6366f1;
    background: #eef2ff;
}

.avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}


/* ==========================================================================
   Image Hover & Modal Lightbox
   ========================================================================== */
a[href*="uploads/tasks/"], .img-popup-trigger {
    cursor: zoom-in;
    display: inline-block;
    transition: transform 0.2s ease;
}

a[href*="uploads/tasks/"]:hover img, .img-popup-trigger:hover img {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

#imagePopupModal .modal-body {
    user-select: none;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    background-color: #fff;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    color: #64748b;
    font-size: 0.9rem;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Mobile & Tablet Enhancements)
   ========================================================================== */
@media (max-width: 768px) {
    /* Action Button Groups in headers */
    .action-btn-group {
        width: 100%;
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }

    .action-btn-group .btn {
        flex: 1 1 0;
        justify-content: center;
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Stat Cards */
    .stat-card {
        padding: 1rem;
        gap: 0.75rem;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }

    /* Modal dialogs */
    .modal-dialog {
        margin: 0.75rem;
    }

    /* Tables */
    .table-responsive {
        border-radius: 12px;
    }
}

@media (max-width: 576px) {
    .action-btn-group {
        flex-direction: column;
    }

    .action-btn-group .btn {
        width: 100%;
    }

    .btn-mobile-full {
        width: 100% !important;
    }
}
