/* ============================================
   Bounty Platform — Premium Dark Theme
   ============================================ */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2333;
    --bg-card-hover: #222d3f;
    --bg-sidebar: #0d1117;
    --bg-topbar: rgba(13, 17, 23, 0.85);
    --border-color: rgba(99, 102, 241, 0.15);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #656d76;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow);
    }
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    padding: 0.5rem 0.75rem;
}

.sidebar-nav .nav-section {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1rem 0.75rem 0.4rem;
    text-transform: uppercase;
    list-style: none;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.1));
    color: var(--accent-hover);
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-nav .nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* ============================================
   TOPBAR
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0;
    }
}

.topbar {
    background: var(--bg-topbar);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-height);
}

.page-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.wallet-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success);
}

.wallet-badge small {
    font-weight: 400;
    opacity: 0.7;
    font-size: 0.7rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.user-menu-btn {
    color: var(--text-secondary);
    border: none;
}

.user-menu-btn:hover {
    color: var(--text-primary);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--border-color);
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-color);
    box-shadow: var(--shadow-glow);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================
   TABLES
   ============================================ */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
}

.table thead th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem;
}

.table tbody td {
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem;
    vertical-align: middle;
    font-size: 0.85rem;
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

/* ============================================
   BADGES & STATUS
   ============================================ */
.badge-status {
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-draft      { background: rgba(101,109,118,0.2); color: #8b949e; }
.badge-open       { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-in_progress { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-in_review  { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-completed  { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-revision   { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-pending    { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-delivered  { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-cancelled  { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-refunded   { background: rgba(6,182,212,0.15); color: #22d3ee; }
.badge-active     { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-suspended  { background: rgba(239,68,68,0.15); color: #f87171; }

.badge-priority-low      { background: rgba(101,109,118,0.2); color: #8b949e; }
.badge-priority-medium   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-priority-high     { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-priority-critical { background: rgba(239,68,68,0.2); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

/* Transaction badges */
.tx-earning  { color: var(--success); }
.tx-bonus    { color: #a855f7; }
.tx-penalty  { color: var(--danger); }
.tx-purchase { color: var(--warning); }
.tx-refund   { color: var(--info); }
.tx-manual   { color: var(--text-secondary); }
.tx-positive { color: var(--success); }
.tx-negative { color: var(--danger); }

/* Skill tag badge */
.skill-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #818cf8, var(--accent));
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-outline-primary:hover {
    background: var(--accent);
    color: white;
}

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    background: var(--bg-secondary);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    color: var(--text-primary);
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notification-dropdown {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.2s;
}

.notification-item:hover {
    background: rgba(99,102,241,0.06);
}

.notification-item.unread {
    background: rgba(99,102,241,0.04);
    border-left: 3px solid var(--accent);
}

/* ============================================
   TASK CARD (Pool)
   ============================================ */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.task-card:hover {
    border-color: var(--border-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.task-card .bounty-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.05));
    border: 1px solid rgba(16,185,129,0.25);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--success);
}

/* ============================================
   PRODUCT CARD (Market)
   ============================================ */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-card:hover {
    border-color: var(--border-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.product-card .product-image {
    height: 180px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted);
    overflow: hidden;
}

.product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card .product-body {
    padding: 1rem;
}

.product-card .product-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(16,185,129,0.1);
    color: #34d399;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: rgba(239,68,68,0.1);
    color: #f87171;
    border-left: 4px solid var(--danger);
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at top, rgba(99,102,241,0.08), transparent 60%),
                      radial-gradient(ellipse at bottom right, rgba(168,85,247,0.06), transparent 50%);
    padding: 2rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--accent), #a855f7, #ec4899);
}

/* ============================================
   DROPDOWN MENU
   ============================================ */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.dropdown-item {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background: rgba(99,102,241,0.08);
    color: var(--text-primary);
}

/* ============================================
   MODAL
   ============================================ */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
}

.modal-header {
    border-bottom: 1px solid var(--border-subtle);
}

.modal-footer {
    border-top: 1px solid var(--border-subtle);
}

/* ============================================
   PAGINATION
   ============================================ */
.page-link {
    background: var(--bg-card);
    border-color: var(--border-subtle);
    color: var(--text-secondary);
}

.page-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease forwards;
}

.stat-card, .task-card, .product-card {
    animation: fadeInUp 0.4s ease forwards;
}

/* Stagger animation */
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
