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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #2d4243;
    min-height: 100vh;
}

header {
    background: #006b5e;
    color: #fff;
    padding: 2em;
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.3em;
}

.subtitle {
    opacity: 0.85;
    font-size: 1rem;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5em;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5em;
    flex-wrap: wrap;
    gap: 1em;
}

.btn {
    border: none;
    padding: 0.6em 1.2em;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-add {
    background: #006b5e;
    color: #fff;
}

.btn-add:hover {
    background: #004d44;
}

.memory-controls {
    display: flex;
    gap: 0.5em;
    margin-bottom: 1.5em;
    flex-wrap: wrap;
}

.btn-memory {
    background: #fff;
    color: #006b5e;
    border: 1px solid #006b5e;
    font-size: 0.85rem;
    padding: 0.45em 1em;
}

.btn-memory:hover {
    background: #006b5e;
    color: #fff;
}

.btn-reset {
    color: #e74c3c;
    border-color: #e74c3c;
}

.btn-reset:hover {
    background: #e74c3c;
    color: #fff;
}

.memory-toast {
    position: fixed;
    bottom: 1.5em;
    left: 50%;
    transform: translateX(-50%);
    background: #2d4243;
    color: #fff;
    padding: 0.7em 1.5em;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
}

.memory-toast.show {
    opacity: 1;
}

.btn-small {
    padding: 0.35em 0.8em;
    font-size: 0.8rem;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #e0e6ea;
    color: #2d4243;
}

.btn-secondary:hover {
    background: #cdd4d9;
}

.filter-bar {
    display: flex;
    gap: 0.4em;
}

.filter-btn {
    border: 1px solid #cdd4d9;
    background: #fff;
    padding: 0.4em 1em;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #2d4243;
    transition: all 0.2s;
}

.filter-btn.active {
    background: #006b5e;
    color: #fff;
    border-color: #006b5e;
}

/* Folders */
.folder {
    background: #fff;
    border-radius: 10px;
    margin-bottom: 1em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 1em 1.2em;
    cursor: pointer;
    user-select: none;
    gap: 0.8em;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
}

.folder-header:hover {
    background: #f9fafb;
}

.folder.open .folder-header {
    border-bottom-color: #e8ecef;
}

.folder-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.folder.open .folder-icon {
    transform: rotate(90deg);
}

.folder-name {
    font-weight: 600;
    font-size: 1.05rem;
    flex-grow: 1;
}

.folder-name-input {
    font-weight: 600;
    font-size: 1.05rem;
    border: 1px solid #006b5e;
    border-radius: 4px;
    padding: 0.2em 0.5em;
    outline: none;
    flex-grow: 1;
}

.folder-progress {
    font-size: 0.8rem;
    color: #7c9097;
    white-space: nowrap;
}

.folder-actions {
    display: flex;
    gap: 0.4em;
    opacity: 0;
    transition: opacity 0.15s;
}

.folder-header:hover .folder-actions {
    opacity: 1;
}

.folder-body {
    display: none;
    padding: 0.5em 1.2em 1.2em;
}

.folder.open .folder-body {
    display: block;
}

/* Items */
.item {
    display: flex;
    align-items: flex-start;
    padding: 0.6em 0;
    border-bottom: 1px solid #f0f2f4;
    gap: 0.7em;
}

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

.item input[type="checkbox"] {
    margin-top: 0.25em;
    width: 18px;
    height: 18px;
    accent-color: #006b5e;
    cursor: pointer;
    flex-shrink: 0;
}

.item-content {
    flex-grow: 1;
    min-width: 0;
}

.item-title {
    font-size: 0.95rem;
    line-height: 1.4;
}

.item.done .item-title {
    text-decoration: line-through;
    opacity: 0.5;
}

.item-link {
    display: inline-block;
    font-size: 0.8rem;
    color: #006b5e;
    margin-top: 0.15em;
    word-break: break-all;
}

.item-link:hover {
    text-decoration: underline;
}

.item-type {
    font-size: 0.7rem;
    padding: 0.15em 0.5em;
    border-radius: 10px;
    background: #e8ecef;
    color: #5a6b6e;
    white-space: nowrap;
    margin-top: 0.25em;
    flex-shrink: 0;
}

.item-type.article { background: #dff0ed; color: #006b5e; }
.item-type.video { background: #fde8e8; color: #c0392b; }
.item-type.course { background: #e8eafd; color: #3b4cc0; }
.item-type.docs { background: #fff3da; color: #b5850a; }
.item-type.tool { background: #e6f0fa; color: #2471a3; }

.item-actions {
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.item:hover .item-actions {
    opacity: 1;
}

/* Add item form */
.add-item-row {
    display: flex;
    gap: 0.5em;
    margin-top: 0.8em;
    flex-wrap: wrap;
}

.add-item-row input[type="text"] {
    flex: 1;
    min-width: 150px;
    padding: 0.5em 0.8em;
    border: 1px solid #cdd4d9;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
}

.add-item-row input[type="text"]:focus {
    border-color: #006b5e;
}

.add-item-row select {
    padding: 0.5em;
    border: 1px solid #cdd4d9;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    background: #fff;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3em;
    color: #7c9097;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5em;
}

/* Responsive */
@media (max-width: 600px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar {
        justify-content: center;
    }
    .folder-actions {
        opacity: 1;
    }
    .item-actions {
        opacity: 1;
    }
    .add-item-row {
        flex-direction: column;
    }
}
