* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0f1115;
    color: #ffffff;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 25px 15px;
    padding: 25px;
    background-color: #1a1d23;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: #4a90e2;
    text-decoration: none;
    letter-spacing: -0.5px;
}

/* Header buttons container and notification button styles */
.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.notification-button {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 8px 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.notification-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.notification-button.clicked {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.notification-icon {
    font-size: 16px;
}

.nav-buttons {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #4a90e2;
}

.nav-link.active {
    color: #4a90e2;
    background-color: rgba(74, 144, 226, 0.1);
}

.install-btn {
    background-color: #4a90e2;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.install-btn:hover {
    background-color: #357abd;
}

.nav-link:hover {
    color: #4a90e2;
}

.nav-link.active {
    color: #4a90e2;
}

.install-btn {
    background-color: #4a90e2;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.install-btn:hover {
    background-color: #357abd;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* No back button needed anymore */

/* Logo styles already defined above */

main h1 {
    font-size: 36px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 40px;
    color: #4a90e2;
    letter-spacing: -0.5px;
    padding: 0 10px;
}

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

.filters-section {
    margin-bottom: 20px;
}

.filters-section p {
    font-size: 20px;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 15px;
}

.buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filters-section button {
    background: linear-gradient(135deg, #2a2d3a 0%, #1e2028 100%);
    color: #e5e7eb;
    border: 1px solid #3a3d4a;
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    margin-bottom: 10px;
    margin-right: 8px;
}

.filters-section button.active {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.filters-section button:hover:not(.active) {
    background: linear-gradient(135deg, #32353f 0%, #24262e 100%);
    border-color: #4a90e2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Filter group styles consolidated into regular filter buttons */

.search-section {
    margin-bottom: 30px;
    position: relative;
}

.search-section::before {
    content: '🔍';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #9ca3af;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 15px 15px 15px 50px;
    background: linear-gradient(135deg, #2a2d3a 0%, #1e2028 100%);
    border: 1px solid #3a3d4a;
    border-radius: 25px;
    color: #ffffff;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.search-input:hover {
    border-color: #4a90e2;
}

.search-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}

.search-input::placeholder {
    color: #9ca3af;
}

.problems-list {
    min-height: 200px;
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    justify-content: flex-start;
}

.loading {
    text-align: center;
    font-size: 18px;
    color: #9ca3af;
    padding: 40px 20px;
    width: 100%;
}

.problem-item {
    background: linear-gradient(135deg, #2a2d3a 0%, #1e2028 100%);
    border: 1px solid #3a3d4a;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    height: 200px; /* Fixed height */
    justify-content: space-between;
    overflow: hidden;
    width: calc(33.33% - 14px); /* Exactly 3 per row */
    margin-bottom: 20px;
    box-sizing: border-box;
    position: relative;
}

.problem-item:hover {
    background: linear-gradient(135deg, #32353f 0%, #24262e 100%);
    border-color: #4a5568;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.problem-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    flex: 1;
}

.problem-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: auto;
    max-height: 48px; /* Allow for two lines of text */
}

.problem-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.problem-id {
    font-size: 16px;
    color: #9ca3af;
    font-weight: 600;
}

.problem-difficulty {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.problem-difficulty.easy {
    color: #10b981;
}

.problem-difficulty.medium {
    color: #f59e0b;
}

.problem-difficulty.hard {
    color: #ef4444;
}

.problem-difficulty.unrated {
    color: #9ca3af;
}

.problem-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
    max-height: 60px;
    overflow: hidden;
}

.tag {
    background-color: rgba(55, 65, 81, 0.5);
    color: #a3b1cc;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
    border: 1px solid rgba(74, 144, 226, 0.2);
}

.problem-actions {
    display: flex;
    justify-content: flex-end;
    position: absolute;
    bottom: 20px;
    right: 20px;
}

.solve-btn {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border: none;
    padding: 8px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
    white-space: nowrap;
    min-width: 80px;
    letter-spacing: 0.5px;
}

.solve-btn:hover {
    background: linear-gradient(135deg, #357abd 0%, #2563eb 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
}

.load-more-section {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    margin-bottom: 20px;
}

.load-more-btn {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.load-more-btn:hover {
    background: linear-gradient(135deg, #357abd 0%, #2563eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.difficulty-easy {
    color: #10b981;
    font-weight: 600;
}

.difficulty-medium {
    color: #f59e0b;
    font-weight: 600;
}

.difficulty-hard {
    color: #ef4444;
    font-weight: 600;
}

.load-more-section {
    text-align: center;
    margin-top: 30px;
}

.load-more-btn {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.load-more-btn:hover {
    background: linear-gradient(135deg, #357abd 0%, #2563eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    text-align: center;
    color: #ef4444;
    font-size: 16px;
    padding: 20px;
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    margin: 20px 0;
}

/* Responsive Design */
@media (min-width: 1201px) {
    .problem-item {
        width: calc(33.33% - 14px); /* 3 problems per row */
    }
}

@media (max-width: 1200px) and (min-width: 769px) {
    .problem-item {
        width: calc(50% - 14px); /* 2 problems per row */
    }
    
    .container {
        padding: 25px;
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 20px 15px;
        padding: 20px;
        max-width: 100%;
        border-radius: 12px;
    }
    
    main h1 {
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .problem-item {
        width: 100%; /* 1 problem per row */
        margin-right: 0;
        height: auto;
        min-height: 180px;
    }
    
    .buttons-row {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .filters-section button {
        padding: 8px 12px;
        font-size: 12px;
        margin-right: 4px;
        margin-bottom: 8px;
    }
    
    .filters-section p {
        text-align: center;
        margin-bottom: 10px;
    }
    
    .search-input {
        padding: 12px 15px 12px 40px;
        font-size: 14px;
    }
    
    .search-section::before {
        left: 15px;
        font-size: 14px;
    }
    
    .problem-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .problem-name {
        font-size: 16px;
        min-width: auto;
    }
    
    .problem-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

@media (min-width: 769px) {
    .filters-section {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .filter-group {
        flex: 1;
        margin-right: 30px;
    }
    
    .filter-group:last-child {
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 15px 10px;
        padding: 15px;
        border-radius: 10px;
    }
    
    header {
        margin-bottom: 20px;
    }
    
    main h1 {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .problem-header {
        margin-bottom: 8px;
    }
    
    .problem-title {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .tag {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .solve-btn {
        padding: 6px 15px;
        font-size: 12px;
        min-width: 70px;
    }
    
    .load-more-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}
