* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f5f7;
    color: #222;
}

a {
    color: #2563eb;
}

/* Kirjautuminen / rekisteröinti */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-form {
    background: #fff;
    padding: 32px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 360px;
}

.auth-form h1 {
    margin-top: 0;
    font-size: 22px;
}

.auth-form label {
    display: block;
    margin: 14px 0 6px;
    font-size: 14px;
    font-weight: 600;
}

.auth-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d3d9;
    border-radius: 6px;
    font-size: 14px;
}

.auth-form button {
    width: 100%;
    margin-top: 20px;
    padding: 11px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.auth-form button:hover {
    background: #1d4ed8;
}

.auth-link {
    margin-top: 16px;
    font-size: 14px;
    text-align: center;
}

.error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
}

.success {
    background: #dcfce7;
    color: #15803d;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
}

/* Sovellusnäkymä */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 16px 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.topbar h1 {
    font-size: 20px;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    color: #555;
}

#add-list-form {
    max-width: 720px;
    margin: 24px auto 0;
    padding: 0 20px;
    display: flex;
    gap: 8px;
}

#add-list-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d0d3d9;
    border-radius: 6px;
    font-size: 14px;
}

#add-list-form button {
    padding: 10px 16px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

#lists-container {
    max-width: 720px;
    margin: 20px auto 60px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.loading {
    text-align: center;
    color: #888;
}

.list-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 16px 18px;
}

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

.list-header h2 {
    font-size: 17px;
    margin: 0;
}

.count {
    color: #888;
    font-weight: normal;
    font-size: 0.9em;
}

.list-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    vertical-align: middle;
}

.list-check.flash {
    animation: list-check-pop 0.9s ease;
}

@keyframes list-check-pop {
    0% {
        transform: scale(0);
        opacity: 0;
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5);
    }
    40% {
        transform: scale(1.4);
        opacity: 1;
        box-shadow: 0 0 0 8px rgba(22, 163, 74, 0);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.list-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.btn-delete-list,
.btn-delete-item {
    background: none;
    border: none;
    color: #b91c1c;
    cursor: pointer;
    font-size: 13px;
}

.btn-toggle-list-body {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 13px;
}

.list-body {
    overflow: hidden;
}

.item-list {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.item-list .item-list {
    padding-left: 24px;
    margin-top: 4px;
}

.item {
    border-top: 1px solid #eee;
    padding: 6px 0;
}

.list-card > .item-list > .item:first-child {
    border-top: none;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.item-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.item-title {
    word-break: break-word;
}

.item-row.done .item-title {
    text-decoration: line-through;
    color: #999;
}

.item-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.item-actions button {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 12.5px;
    padding: 2px 4px;
}

.sub-item-form,
.add-item-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.sub-item-form input,
.add-item-form input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #d0d3d9;
    border-radius: 6px;
    font-size: 13px;
}

.sub-item-form button,
.add-item-form button {
    padding: 7px 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.add-item-form {
    margin-top: 12px;
    border-top: 1px dashed #eee;
    padding-top: 12px;
}

.comments-panel {
    margin: 8px 0 4px 26px;
    background: #f9fafb;
    border-radius: 8px;
    padding: 10px 12px;
}

.comments-list {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.comments-list li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
}

.comment-text {
    flex: 1;
    word-break: break-word;
}

.comment-date {
    color: #999;
    font-size: 11px;
    display: block;
}

.btn-delete-comment {
    background: none;
    border: none;
    color: #b91c1c;
    cursor: pointer;
    font-size: 12px;
}

.comment-form {
    display: flex;
    gap: 8px;
}

.comment-form input {
    flex: 1;
    padding: 6px 9px;
    border: 1px solid #d0d3d9;
    border-radius: 6px;
    font-size: 13px;
}

.comment-form button {
    padding: 6px 10px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.empty-hint {
    color: #999;
    font-size: 13px;
    padding: 6px 0;
}
