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

body {
    font-family: Arial, sans-serif;
    background-color: #111827;
    color: #f9fafb;
    min-height: 100vh;
    padding: 30px 15px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 950px;
    margin: auto;
    background-color: #1f2937;
    padding: 25px;
    border-radius: 12px;
    transition: background-color 0.3s ease;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.topbar h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.topbar p {
    color: #9ca3af;
}

#theme-btn {
    border: none;
    background-color: #374151;
    color: white;
    padding: 9px 16px;
    border-radius: 6px;
    cursor: pointer;
}

#theme-btn:hover {
    background-color: #4b5563;
}

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

.search-section > p:first-child {
    margin-bottom: 10px;
}

.user-input-container {
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 11px 12px;
    border: 1px solid #4b5563;
    border-radius: 6px;
    outline: none;
    font-size: 1rem;
}

#user-input:focus {
    border-color: #22c55e;
}

#search-btn {
    padding: 11px 22px;
    border: none;
    border-radius: 6px;
    background-color: #22c55e;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

#search-btn:hover {
    background-color: #16a34a;
}

#search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#error-message {
    color: #f87171;
    margin-top: 10px;
    min-height: 20px;
}

.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    color: #9ca3af;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #4b5563;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.profile-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #111827;
    padding: 18px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.profile-info h2 {
    margin-bottom: 5px;
}

.profile-info p {
    color: #9ca3af;
    margin-bottom: 10px;
}

#profile-link {
    color: #22c55e;
    text-decoration: none;
    font-size: 0.9rem;
}

#profile-link:hover {
    text-decoration: underline;
}

.profile-ranking {
    text-align: right;
}

.profile-ranking p {
    color: #9ca3af;
    font-size: 0.9rem;
}

.profile-ranking h3 {
    margin-top: 5px;
}

.stats-container h2,
.recent-searches h2 {
    margin-bottom: 20px;
}

.progress {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.progress-item {
    display: flex;
    justify-content: center;
}

.circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;

    background: conic-gradient(
        var(--circle-color) var(--progress-degree, 0%),
        #374151 0%
    );
}

.circle::before {
    content: "";
    width: 105px;
    height: 105px;
    background-color: #1f2937;
    border-radius: 50%;
    position: absolute;
}

.circle span,
.circle p {
    position: relative;
    z-index: 1;
}

.circle span {
    font-weight: bold;
    font-size: 1rem;
}

.circle p {
    margin-top: 5px;
    font-size: 0.9rem;
    color: #d1d5db;
}

.total-progress {
    --circle-color: #8b5cf6;
}

.easy-progress {
    --circle-color: #22c55e;
}

.medium-progress {
    --circle-color: #f59e0b;
}

.hard-progress {
    --circle-color: #ef4444;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 35px;
}

.card {
    background-color: #111827;
    padding: 18px;
    border-radius: 8px;
}

.card h4 {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.card p {
    font-size: 1.4rem;
    font-weight: bold;
}

.recent-searches {
    margin-top: 20px;
}

.recent-searches-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.clear-history-btn {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.9rem;
}

.clear-history-btn:hover {
    color: #f87171;
}

#search-history {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#search-history p {
    color: #9ca3af;
}

.history-item {
    border: none;
    background-color: #374151;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.history-item:hover {
    background-color: #4b5563;
}

.hidden {
    display: none;
}


/* light theme */

body.light-theme {
    background-color: #f3f4f6;
    color: #111827;
}

body.light-theme .container {
    background-color: #ffffff;
}

body.light-theme .topbar p {
    color: #6b7280;
}

body.light-theme #theme-btn {
    background-color: #e5e7eb;
    color: #111827;
}

body.light-theme .profile-section {
    background-color: #f3f4f6;
}

body.light-theme .profile-info p,
body.light-theme .profile-ranking p {
    color: #6b7280;
}

body.light-theme .circle {
    background: conic-gradient(
        var(--circle-color) var(--progress-degree, 0%),
        #d1d5db 0%
    );
}

body.light-theme .circle::before {
    background-color: #ffffff;
}

body.light-theme .circle p {
    color: #4b5563;
}

body.light-theme .card {
    background-color: #f3f4f6;
}

body.light-theme .card h4 {
    color: #6b7280;
}

body.light-theme #search-history p {
    color: #6b7280;
}

body.light-theme .history-item {
    background-color: #e5e7eb;
    color: #111827;
}

body.light-theme .history-item:hover {
    background-color: #d1d5db;
}

body.light-theme .clear-history-btn {
    color: #6b7280;
}

body.light-theme .loading {
    color: #6b7280;
}


@media (max-width: 800px) {
    .progress {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}


@media (max-width: 500px) {
    body {
        padding: 15px 10px;
    }

    .container {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar h1 {
        font-size: 1.6rem;
    }

    .user-input-container {
        flex-direction: column;
    }

    #search-btn {
        width: 100%;
    }

    .profile-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .profile-ranking {
        text-align: left;
    }

    .progress {
        grid-template-columns: 1fr;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }
}