:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --bg-gradient-start: #EEF2FF;
    --bg-gradient-end: #E0E7FF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --card-bg: rgba(255, 255, 255, 0.9);
    --success-color: #10B981;
    --danger-color: #EF4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
}

.app-container {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    backdrop-filter: blur(10px);
    margin-top: 2rem;
    align-self: flex-start;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.progress-section {
    margin-bottom: 2rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.progress-bar-container {
    height: 10px;
    background: #E5E7EB;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--success-color);
    width: 0%;
    transition: width 0.5s ease-out;
}

.add-topic-section {
    margin-bottom: 1.5rem;
}

#add-topic-form {
    display: flex;
    gap: 0.5rem;
}

#add-topic-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #D1D5DB;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#add-topic-form input:focus {
    border-color: var(--primary-color);
}

#add-topic-form button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

#add-topic-form button:hover {
    background: var(--primary-hover);
}

#add-topic-form button:active {
    transform: scale(0.98);
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab {
    flex: 1;
    background: transparent;
    border: 1px solid #D1D5DB;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.topics-list ul {
    list-style: none;
}

.topic-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    border: 1px solid #F3F4F6;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.topic-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.topic-item.completed .topic-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.topic-checkbox {
    margin-top: 3px;
    margin-right: 1rem;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--success-color);
}

.topic-content {
    flex: 1;
}

.topic-title {
    font-weight: 500;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
    color: var(--text-main);
}

.topic-note-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-icon.edit-note:hover {
    color: var(--primary-color);
}

.btn-icon.delete-topic:hover {
    color: var(--danger-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    animation: scaleUp 0.3s ease-out;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

#note-textarea {
    width: 100%;
    height: 150px;
    padding: 1rem;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    outline: none;
    transition: border-color 0.2s;
}

#note-textarea:focus {
    border-color: var(--primary-color);
}

#save-note-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    transition: background 0.2s;
}

#save-note-btn:hover {
    background: var(--primary-hover);
}

@media (max-width: 480px) {
    .filter-tabs {
        flex-direction: column;
    }

    #add-topic-form {
        flex-direction: column;
    }

    #add-topic-form button {
        padding: 0.75rem;
    }
}