/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme variables */
    --primary-color: #667eea;
    --primary-hover: #5a6fd8;
    --secondary-color: #764ba2;
    --background-primary: #ffffff;
    --background-secondary: #f8f9fa;
    --background-tertiary: #e9ecef;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e9ecef;
    --border-hover: #dee2e6;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
}

[data-theme="dark"] {
    /* Dark theme variables */
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
    --secondary-color: #a855f7;
    --background-primary: #1a1a1a;
    --background-secondary: #2d2d2d;
    --background-tertiary: #404040;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    --border-color: #404040;
    --border-hover: #555555;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --success-color: #22c55e;
    --warning-color: #fbbf24;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    --gradient-card: linear-gradient(145deg, #2d2d2d 0%, #1a1a1a 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    transition: all 0.3s ease;
}

.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem;
    background: var(--background-primary);
    min-height: 100vh;
    box-shadow: 0 0 50px var(--shadow-light);
    transition: all 0.3s ease;
    border-radius: 24px;
}

/* Desktop container optimization */
@media (min-width: 768px) {
    .container {
        padding: 1.25rem;
    }
}

/* Header Styles - Mobile First */
.header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem 1rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 20px 20px 0 0;
    margin: -1rem -1rem 1.5rem -1rem;
    box-shadow: 0 4px 20px var(--shadow-medium);
    position: relative;
}

.header-content {
    position: relative;
    max-width: 100%;
}

.header h1 {
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
}

.header h1 i {
    margin-right: 0.5rem;
    color: #ffd700;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    font-size: 0.9em;
}

.subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    opacity: 0.9;
    font-weight: 300;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1.4;
}

.header-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.75rem;
    border-radius: 16px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Desktop header adjustments */
@media (min-width: 768px) {
    .header {
        padding: 2rem 0;
        margin: -1.25rem -1.25rem 2rem -1.25rem;
    }
    
    .header-controls {
        top: 1.5rem;
        right: 1.5rem;
    }
    
    .theme-toggle {
        padding: 0.75rem 1rem;
    }
}

/* Navigation Tabs - Mobile First */
.nav-tabs {
    display: flex;
    background: var(--background-secondary);
    border-radius: 20px;
    padding: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px var(--shadow-light);
    border: 1px solid var(--border-color);
}

.nav-tab {
    flex: 1;
    padding: 0.875rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.nav-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.nav-tab.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.nav-tab i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* Desktop navigation */
@media (min-width: 768px) {
    .nav-tabs {
        padding: 0.5rem;
        margin-bottom: 2rem;
    }
    
    .nav-tab {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .nav-tab i {
        margin-right: 0.625rem;
        font-size: 1.1rem;
    }
}

/* Mobile navigation optimizations */
@media (max-width: 768px) {
    .nav-tabs {
        padding: 6px;
        margin-bottom: 20px;
    }
    
    .nav-tab {
        padding: 12px 20px;
        font-size: 0.9rem;
        font-weight: 700;
    }
    
    .nav-tab i {
        margin-right: 8px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .nav-tab {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    .nav-tab i {
        margin-right: 6px;
        font-size: 0.9rem;
    }
}

/* Mobile-First Layout */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
}

.sidebar-left {
    background: var(--background-secondary);
    border-radius: 20px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    order: 1;
    width: 100%;
}

.content-main {
    background: transparent;
    border-radius: 0;
    border: none;
    overflow: visible;
    order: 2;
    width: 100%;
}

/* Tablet layout */
@media (min-width: 768px) {
    .main-layout {
        gap: 1.5rem;
    }
    
    .sidebar-left {
        padding: 1.25rem;
    }
}

/* Desktop layout */
@media (min-width: 992px) {
    .main-layout {
        display: grid;
        grid-template-columns: 350px 1fr;
        gap: 2rem;
        align-items: start;
    }
    
    .sidebar-left {
        position: sticky;
        top: 20px;
        order: 0;
    }
    
    .content-main {
        order: 0;
    }
}

/* Large desktop layout */
@media (min-width: 1200px) {
    .main-layout {
        grid-template-columns: 380px 1fr;
        gap: 2.5rem;
    }
}

/* Compact Statistics */
.compact-stats h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: var(--background-primary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-ring {
    margin: 15px auto;
    text-align: center;
    width: 100px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.progress-ring svg {
    width: 80px;
    height: 80px;
    transform: rotate(-90deg);
    position: absolute;
    top: 10px;
    left: 10px;
}

.progress-ring circle {
    fill: none;
    stroke-width: 8;
}

.progress-ring .progress-bg {
    stroke: var(--border-color);
}

.progress-ring .progress-fill {
    stroke: var(--primary-color);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 85px;
    position: relative;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .main-layout {
        grid-template-columns: 320px 1fr;
        gap: 25px;
    }
}

@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 300px 1fr;
        gap: 20px;
    }
}

@media (max-width: 992px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sidebar-left {
        position: static;
        max-height: none;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        margin: -10px -10px 20px -10px;
        padding: 20px 15px;
    }
    
    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 8px;
        text-align: center;
    }
    
    .header h1 i {
        margin-right: 8px;
        font-size: 1.6rem;
    }
    
    .subtitle {
        font-size: 1rem;
        text-align: center;
    }
    
    .header-controls {
        position: static;
        text-align: center;
        margin-top: 15px;
    }
    
    .theme-toggle {
        padding: 10px 12px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header h1 i {
        display: block;
        margin: 0 0 5px 0;
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
}

/* Statistics Overview */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--gradient-card);
    padding: 25px 20px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 25px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px var(--shadow-medium);
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 8px;
    text-shadow: 0 2px 4px var(--shadow-light);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Filters Section */
.filters-section {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: none;
    border: none;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.filters-header h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.filters-header h3 i {
    color: var(--primary-color);
    margin-right: 8px;
}

.btn-clear {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear:hover {
    background: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

.filters-row {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.filter-card {
    background: var(--background-primary);
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 2px 8px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.filter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.filter-card label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.filter-card label i {
    color: var(--primary-color);
    margin-right: 8px;
    width: 16px;
}

.filter-card input,
.filter-card select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--background-primary);
    color: var(--text-primary);
}

.filter-card input:focus,
.filter-card select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.multi-select-container select {
    min-height: 80px;
}

.range-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.range-container input[type="range"] {
    flex: 1;
    cursor: pointer;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.range-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px var(--shadow-light);
}

.range-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px var(--shadow-light);
}

.range-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
    min-width: 40px;
    text-align: center;
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
}

.filter-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
    box-shadow: 0 4px 15px var(--shadow-light);
}

.btn-secondary:hover {
    background: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.btn-secondary:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Table Styles - Mobile First */
.table-container {
    background: var(--background-primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--shadow-light);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

#problems-table {
    width: 100%;
    border-collapse: collapse;
    display: none; /* Hidden on mobile, replaced with cards */
}

/* Mobile Card Layout */
.mobile-problem-cards {
    display: block;
}

.problem-card {
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: all 0.3s ease;
}

.problem-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.problem-card.solved {
    border-left: 6px solid var(--success-color);
    background: rgba(40, 167, 69, 0.08);
    border-radius: 20px;
}

.problem-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.problem-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.3;
    flex: 1;
}

.problem-checkbox-mobile {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    background: var(--background-primary);
    transition: all 0.3s ease;
    position: relative;
}

.problem-checkbox-mobile:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.problem-checkbox-mobile:checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.problem-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.problem-actions-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Desktop Table Layout */
@media (min-width: 768px) {
    .mobile-problem-cards {
        display: none;
    }
    
    #problems-table {
        display: table;
        min-width: 800px;
    }
    
    .table-container {
        overflow-x: auto;
        overflow-y: visible;
    }
}

@media (min-width: 1200px) {
    #problems-table {
        min-width: 1000px;
    }
}

#problems-table th {
    background: var(--primary-color);
    color: white;
    padding: 18px 15px;
    text-align: left;
    font-weight: 700;
    font-size: 0.95rem;
    position: sticky;
    top: 0;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.sortable:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

.sortable i {
    margin-left: 8px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

#problems-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    background: var(--background-primary);
    transition: all 0.3s ease;
}

#problems-table tbody tr:hover {
    background: var(--background-secondary);
    transform: scale(1.001);
}

.problem-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.problem-solved {
    background: rgba(40, 167, 69, 0.1) !important;
    border-left: 4px solid var(--success-color);
}

.difficulty-easy {
    color: var(--success-color);
    font-weight: 700;
    padding: 4px 8px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 6px;
    font-size: 0.85rem;
}

.difficulty-medium {
    color: var(--warning-color);
    font-weight: 700;
    padding: 4px 8px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 6px;
    font-size: 0.85rem;
}

.difficulty-hard {
    color: var(--danger-color);
    font-weight: 700;
    padding: 4px 8px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 6px;
    font-size: 0.85rem;
}

.company-count {
    background: var(--primary-color);
    color: white;
    padding: 6px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

.frequency-score {
    background: var(--success-color);
    color: white;
    padding: 6px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-block;
    min-width: 50px;
    text-align: center;
}

.tag {
    display: inline-block;
    background: var(--background-tertiary);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    margin: 2px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.company {
    display: inline-block;
    background: rgba(255, 243, 205, 0.8);
    color: #856404;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    margin: 2px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(133, 100, 4, 0.2);
}

[data-theme="dark"] .company {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning-color);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.company:hover {
    background: var(--warning-color);
    color: white;
    transform: scale(1.05);
}

.companies-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* Company logos in table */
.company-logo-item {
    display: inline-flex;
    align-items: center;
    margin: 2px;
    transition: all 0.3s ease;
}

.company-logo-item:hover {
    transform: scale(1.1);
}

.company-logo-item .company-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-light);
    border: 1px solid var(--border-color);
}

.company-logo-item .company-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
}

.company-logo-item .company-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 10px;
}

.company-logo-item.company-more {
    cursor: pointer;
    position: relative;
}

.company-logo-item.company-more .company-logo {
    background: linear-gradient(135deg, var(--info-color), var(--primary-color));
    border: 2px solid var(--info-color);
    box-shadow: 0 3px 8px rgba(23, 162, 184, 0.3);
    position: relative;
    overflow: hidden;
}

.company-logo-item.company-more .company-logo::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.company-logo-item.company-more:hover .company-logo::before {
    animation: shimmer 0.6s ease-in-out;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); opacity: 0; }
}

.company-logo-item.company-more .company-fallback {
    background: transparent;
    font-size: 11px;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.5px;
}

.company-logo-item.company-more:hover {
    transform: scale(1.15);
}

.company-logo-item.company-more:hover .company-logo {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.company-logo-item.company-more:hover .company-fallback {
    color: white;
}

/* Mobile company logos */
.companies-list-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.company-logo-item-mobile {
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

.company-logo-item-mobile:hover {
    transform: scale(1.1);
}

.company-logo-item-mobile .company-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-light);
    border: 1px solid var(--border-color);
}

.company-logo-item-mobile .company-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
}

.company-logo-item-mobile .company-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 8px;
}

.company-logo-item-mobile.company-more {
    cursor: pointer;
    position: relative;
}

.company-logo-item-mobile.company-more .company-logo {
    background: linear-gradient(135deg, var(--info-color), var(--primary-color));
    border: 2px solid var(--info-color);
    box-shadow: 0 2px 6px rgba(23, 162, 184, 0.3);
}

.company-logo-item-mobile.company-more .company-fallback {
    background: transparent;
    font-size: 9px;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.3px;
}

.company-logo-item-mobile.company-more:hover {
    transform: scale(1.2);
}

.company-logo-item-mobile.company-more:hover .company-logo {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

.company-logo-item-mobile.company-more:hover .company-fallback {
    color: white;
}

.company-more {
    cursor: pointer;
    background: var(--info-color) !important;
    color: white !important;
    border: 1px solid var(--info-color) !important;
    text-decoration: underline;
}

.company-more:hover {
    background: var(--primary-color) !important;
}

.tag-more {
    cursor: pointer;
    background: var(--warning-color) !important;
    color: white !important;
    border: 1px solid var(--warning-color) !important;
    text-decoration: underline;
}

.tag-more:hover {
    background: var(--primary-color) !important;
    color: white !important;
}

.action-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.1);
}

.action-link:hover {
    color: white;
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--background-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-light);
}

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

/* Statistics Tab */
.stats-section {
    padding: 20px 0;
}

.stats-section h2 {
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
    font-size: 2.2rem;
    font-weight: 800;
}

.chart-container {
    background: var(--background-primary);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 25px var(--shadow-light);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.chart-container h3 {
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
}

.frequency-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

/* Company frequency styles with logos */
.company-frequency-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--background-secondary);
    border-radius: 6px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.company-frequency-item:hover {
    background: var(--background-tertiary);
    transform: translateY(-1px);
}

.company-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.company-logo {
    width: 24px;
    height: 24px;
    position: relative;
    flex-shrink: 0;
}

.company-logo img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: contain;
}

.company-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
}

.company-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9em;
}

.company-count {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

@media (max-width: 768px) {
    .company-frequency-item {
        padding: 6px 10px;
    }
    
    .company-logo {
        width: 20px;
        height: 20px;
    }
    
    .company-name {
        font-size: 0.85em;
    }
    
    .company-count {
        font-size: 0.75em;
        padding: 3px 6px;
    }
    
    /* Enhanced mobile statistics */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .stat-item {
        padding: 8px;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .progress-ring {
        width: 80px;
        height: 80px;
        margin: 10px auto;
    }
    
    .progress-ring svg {
        width: 60px;
        height: 60px;
        top: 5px;
        left: 10px;
    }
    
    .progress-text {
        font-size: 0.8rem;
        margin-top: 65px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .stat-item {
        padding: 6px;
    }
    
    .stat-value {
        font-size: 0.9rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .progress-ring {
        width: 70px;
        height: 70px;
        margin: 8px auto;
    }
    
    .progress-ring svg {
        width: 50px;
        height: 50px;
        top: 5px;
        left: 10px;
    }
    
    .progress-ring circle {
        stroke-width: 6;
    }
    
    .progress-text {
        font-size: 0.75rem;
        margin-top: 55px;
    }
}

/* Tips Tab */
.tips-section {
    padding: 20px 0;
}

.tips-section h2 {
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
    font-size: 2.2rem;
    font-weight: 800;
}

.tip-card {
    background: var(--background-primary);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 25px var(--shadow-light);
    margin-bottom: 25px;
    border-left: 5px solid var(--primary-color);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.tip-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px var(--shadow-medium);
}

.tip-card h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 700;
}

.tip-card h3 i {
    color: var(--primary-color);
    margin-right: 12px;
    font-size: 1.2rem;
}

.tip-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 1rem;
}

/* Enhanced Tips Section - Full Width Grid */
.tips-section-enhanced {
    background: var(--background-primary);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow-light);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.tips-section-enhanced h2 {
    color: var(--text-primary);
    margin-bottom: 35px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.tips-section-enhanced h2 i {
    color: var(--warning-color);
    font-size: 1.8rem;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: var(--background-secondary);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tip-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(102, 126, 234, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.tip-item:hover::before {
    opacity: 0.05;
}

.tip-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--shadow-medium);
    border-left-color: var(--secondary-color);
}

.tip-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    position: relative;
    z-index: 2;
}

.tip-content {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.95rem;
    position: relative;
    z-index: 2;
}

.tip-content strong {
    color: var(--primary-color);
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
}

/* Analytics Section */
.analytics-section {
    background: var(--background-primary);
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow-light);
    border: 1px solid var(--border-color);
}

.analytics-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 35px;
    align-items: start;
}

.analytics-item {
    background: var(--background-secondary);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 6px 20px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.analytics-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px var(--shadow-medium);
}

.analytics-item h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.difficulty-analytics h3 i {
    color: var(--info-color);
}

.companies-analytics h3 i {
    color: var(--success-color);
}

.difficulty-analytics canvas {
    max-height: 250px !important;
    margin: 0 auto;
    display: block;
}

.companies-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.companies-showcase::-webkit-scrollbar {
    width: 6px;
}

.companies-showcase::-webkit-scrollbar-track {
    background: var(--background-primary);
    border-radius: 3px;
}

.companies-showcase::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.companies-showcase::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Enhanced company frequency styles for showcase */
.companies-showcase .company-frequency-item {
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.companies-showcase .company-frequency-item:hover {
    background: var(--background-tertiary);
    transform: translateX(5px);
    border-color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .companies-showcase {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .tips-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .tip-item {
        padding: 15px;
    }
    
    .tip-icon {
        width: 35px;
        height: 35px;
        font-size: 1.3rem;
    }
    
    .tip-content {
        font-size: 0.9rem;
    }
    
    .tips-section-enhanced {
        padding: 25px 15px;
        margin-bottom: 20px;
    }
    
    .tips-section-enhanced h2 {
        font-size: 1.6rem;
        margin-bottom: 25px;
    }
    
    .analytics-section {
        padding: 20px 15px;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .analytics-item {
        padding: 15px;
    }
    
    .analytics-item h3 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .difficulty-analytics canvas {
        max-height: 200px !important;
    }
    
    .companies-showcase {
        grid-template-columns: 1fr;
        max-height: 300px;
    }
    
    .companies-showcase .company-frequency-item {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .tips-section-enhanced {
        padding: 20px 12px;
    }
    
    .tips-section-enhanced h2 {
        font-size: 1.4rem;
        gap: 10px;
    }
    
    .tip-item {
        padding: 12px;
        gap: 12px;
    }
    
    .tip-icon {
        width: 30px;
        height: 30px;
        font-size: 1.1rem;
    }
    
    .tip-content {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .analytics-section {
        padding: 15px 10px;
    }
    
    .analytics-item {
        padding: 12px;
    }
    
    .analytics-item h3 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .difficulty-analytics canvas {
        max-height: 150px !important;
    }
    
    .companies-showcase {
        max-height: 250px;
        gap: 8px;
    }
}

.frequency-list-compact .frequency-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--background-primary);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px var(--shadow-light);
}

.frequency-list-compact .frequency-item:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.frequency-list-compact .frequency-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.frequency-list-compact .frequency-count {
    background: var(--primary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 25px;
    text-align: center;
}

/* Footer */
.footer {
    background: var(--gradient-primary);
    color: white;
    border-top: none;
    margin: 30px -20px -20px -20px;
    border-radius: 0;
    box-shadow: 0 -10px 30px var(--shadow-medium);
}

.footer-content {
    text-align: center;
    padding: 20px 0;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.footer-content i {
    color: #ffd700;
    margin: 0 4px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.footer-content .fa-robot {
    color: #87ceeb;
}

/* Company Expansion Modal */
.company-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.company-modal-content {
    background: var(--background-primary);
    padding: 30px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80%;
    overflow-y: auto;
    box-shadow: 0 20px 50px var(--shadow-medium);
    border: 1px solid var(--border-color);
}

.company-modal h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-align: center;
}

.company-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.company-modal-close:hover {
    color: var(--danger-color);
}

/* Company modal with logos */
.companies-list-modal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.company-logo-item-modal {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--background-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.company-logo-item-modal:hover {
    background: var(--background-tertiary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--shadow-light);
}

.company-logo-item-modal .company-logo {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.company-logo-item-modal .company-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Compact Filters Design */
.filters-compact {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.filter-row-1,
.filter-row-2,
.filter-row-3 {
    display: grid;
    gap: 15px;
    align-items: end;
}

.filter-row-1 {
    grid-template-columns: 2fr 1fr 2fr;
}

.filter-row-2 {
    grid-template-columns: 1fr 1fr;
}

.filter-row-3 {
    grid-template-columns: 1fr 1fr;
}

.filter-card.compact {
    background: var(--background-primary);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 3px 10px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.filter-card.compact:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.filter-card.compact label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.filter-card.compact label i {
    color: var(--primary-color);
    margin-right: 6px;
    width: 14px;
}

.filter-card.compact input,
.filter-card.compact select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--background-primary);
    color: var(--text-primary);
}

.filter-card.compact input:focus,
.filter-card.compact select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Difficulty Buttons */
.difficulty-buttons {
    display: flex;
    gap: 5px;
}

.difficulty-btn {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.difficulty-btn[data-difficulty="Easy"].active {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.difficulty-btn[data-difficulty="Medium"].active {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: #000;
}

.difficulty-btn[data-difficulty="Hard"].active {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

/* Compact Range Container */
.range-container.compact {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-container.compact input[type="range"] {
    flex: 1;
    height: 6px;
}

.range-container.compact .range-value {
    min-width: 35px;
    font-size: 0.85rem;
    padding: 3px 6px;
}

/* Custom Multi-Select */
.multi-select-wrapper {
    position: relative;
    z-index: 100;
}

/* Tags filter should be higher since it comes first */
.filter-card:nth-child(6) .multi-select-wrapper {
    z-index: 200;
}

/* Companies filter should be lower since it comes after */
.filter-card:nth-child(7) .multi-select-wrapper {
    z-index: 150;
}

/* Ensure consistent styling for both tag and company filters */
#selected-tags,
#selected-companies {
    min-height: 38px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 6px 10px;
    background: var(--background-primary);
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    transition: all 0.3s ease;
}

#selected-tags:hover,
#selected-companies:hover {
    border-color: var(--primary-color);
}

#selected-tags.active,
#selected-companies.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#tag-dropdown,
#company-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--background-primary);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 16px 16px;
    max-height: 200px;
    overflow-y: auto;
    z-index: inherit;
    display: none;
    box-shadow: 0 8px 25px var(--shadow-medium);
}

#tag-dropdown.show,
#company-dropdown.show {
    display: block;
    z-index: 999;
}

.selected-items {
    min-height: 38px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    background: var(--background-primary);
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    transition: all 0.3s ease;
}

.selected-items:hover {
    border-color: var(--primary-color);
}

.selected-items.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.selected-items .placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.selected-tag,
.selected-company {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.selected-tag:hover,
.selected-company:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.selected-tag .remove,
.selected-company .remove {
    cursor: pointer;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.2);
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.selected-tag .remove:hover,
.selected-company .remove:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--background-primary);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: inherit;
    display: none;
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.dropdown-content.show {
    display: block;
    z-index: 999; /* Force above everything when shown */
}

/* When dropdown is active, elevate the entire wrapper */
.multi-select-wrapper.dropdown-active {
    z-index: 999 !important;
    position: relative;
}

/* When any dropdown is active, lower all other multi-select wrappers */
.multi-select-wrapper.dropdown-active ~ * .multi-select-wrapper,
.multi-select-wrapper.dropdown-active + * .multi-select-wrapper {
    z-index: 50 !important;
}

/* Global class to lower all inactive dropdowns when any is active */
body.dropdown-open .multi-select-wrapper:not(.dropdown-active) {
    z-index: 50 !important;
}

/* Disable visual hover effects on inactive filter elements when dropdown is open */
body.dropdown-open .multi-select-wrapper:not(.dropdown-active) .selected-items:hover {
    border-color: var(--border-color) !important;
    background: var(--background-primary) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Disable hover effects on all filter cards when any dropdown is open */
body.dropdown-open .filter-card:hover {
    transform: none !important;
    box-shadow: 0 2px 8px var(--shadow-light) !important;
}

/* Suppress all hover animations when dropdown is open */
body.dropdown-open .filter-card.compact:hover {
    transform: none !important;
    box-shadow: 0 3px 10px var(--shadow-light) !important;
}

.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: var(--background-secondary);
}

.dropdown-item.selected {
    background: var(--primary-color) !important;
    color: white !important;
    border-left: 4px solid var(--secondary-color);
    font-weight: 600;
}

.dropdown-item.selected:hover {
    background: var(--primary-hover) !important;
    color: white !important;
}

.dropdown-item:last-child {
    border-bottom: none;
}

/* Enhanced Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--background-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-light);
}

.pagination-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-number.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-number.ellipsis {
    cursor: default;
    border: none;
    background: transparent;
    color: var(--text-muted);
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.page-jump span {
    color: var(--text-secondary);
    font-weight: 500;
}

#page-input {
    width: 60px;
    padding: 6px 8px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
    background: var(--background-primary);
    color: var(--text-primary);
}

#page-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

#go-to-page {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.pagination-details {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Compact filters on mobile */
@media (max-width: 768px) {
    .filter-row-1,
    .filter-row-2,
    .filter-row-3 {
        grid-template-columns: 1fr;
    }
    
    .sidebar-left {
        padding: 15px;
        border-radius: 8px;
    }
    
    .filters-header h3 {
        font-size: 1rem;
    }
    
    .filter-card.compact {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .filter-card.compact label {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }
    
    .filter-card.compact input,
    .filter-card.compact select {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .difficulty-buttons {
        gap: 8px;
    }
    
    .difficulty-btn {
        padding: 10px 8px;
        font-size: 0.8rem;
        font-weight: 700;
    }
    
    .selected-items {
        min-height: 42px;
        padding: 8px 12px;
    }
    
    .selected-tag,
    .selected-company {
        padding: 8px 12px;
        font-size: 0.8rem;
        border-radius: 18px;
    }
    
    .dropdown-content {
        max-height: 180px;
        font-size: 0.85rem;
    }
    
    .dropdown-item {
        padding: 10px 14px;
    }
    
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination-info {
        order: -1;
    }
    
    .page-numbers {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-number {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-width: 36px;
    }
}

/* Mobile-specific dropdown optimizations */
@media (max-width: 768px) {
    /* Ensure dropdowns work properly on mobile */
    .multi-select-wrapper {
        position: relative;
        z-index: 100 !important;
    }
    
    /* Make dropdowns full width and more visible */
    #tag-dropdown,
    #company-dropdown {
        position: fixed;
        top: auto;
        left: 1rem;
        right: 1rem;
        bottom: 10vh;
        border-radius: 16px;
        max-height: 50vh;
        border: 2px solid var(--primary-color);
        box-shadow: 0 15px 50px var(--shadow-medium);
        background: var(--background-primary);
        z-index: 1000 !important;
    }
    
    #tag-dropdown.show,
    #company-dropdown.show {
        display: block;
        z-index: 1001 !important;
    }
    
    /* Add a close button overlay for mobile */
    #tag-dropdown::before,
    #company-dropdown::before {
        content: '✕ Close';
        display: block;
        padding: 12px;
        background: var(--primary-color);
        color: white;
        text-align: center;
        font-weight: bold;
        margin: -2px -2px 10px -2px;
        border-radius: 14px 14px 0 0;
        cursor: pointer;
    }
    
    /* Improve selected items visibility on mobile */
    .selected-tag,
    .selected-company {
        font-size: 0.85rem;
        padding: 8px 12px;
        margin: 2px;
        border-radius: 20px;
    }
    
    /* Fix the +5 display issue */
    .selected-items .placeholder {
        font-size: 0.9rem;
        padding: 4px 0;
    }
    
    /* Ensure dropdowns don't get cut off */
    .filters-compact {
        overflow: visible;
        z-index: auto;
    }
    
    .filter-card.compact {
        overflow: visible;
        z-index: auto;
    }
}
