:root {
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --bg-color: #f0f2f5;
    --text-color: #1c1e21;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --white: #ffffff;
    --border-radius: 8px;
    --border-radius-lg: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--bg-color);
    margin: 0;
    padding-bottom: 80px;
    color: var(--text-color);
}

.container {
    max-width: 800px;
    margin: 20px auto;
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* --- Admin Styles --- */
.admin-body {
    padding: 20px;
}

h1 {
    margin-top: 0;
    /* border-bottom: 2px solid #eee; */
    padding-bottom: 10px;
    font-size: 1.5rem;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.nav-card {
    display: block;
    padding: 20px;
    background: var(--accent-color);
    color: var(--white);
    text-decoration: none;
    border-radius: var(--border-radius);
    text-align: center;
    transition: transform 0.2s;
    position: relative;
}

.nav-card:hover {
    transform: translateY(-5px);
    background: var(--accent-hover);
}

.nav-card h3 {
    margin: 0;
    font-size: 1.2rem;
}

.badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

th {
    background: #f8f9fa;
    font-weight: 600;
}

tr:hover {
    background: #f8f9fa;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    color: white;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--accent-color);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: var(--danger-color);
}

.btn-danger:hover {
    background: #bd2130;
}

.btn-success {
    background: var(--success-color);
}

.btn-warning {
    background: var(--warning-color);
    color: #212529;
}

.btn-outline {
    background: white;
    border: 1px solid #6c757d;
    color: #6c757d;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* Forms & Auth */
.login-box {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.form-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    border: 1px solid #eee;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
}

.error {
    color: var(--danger-color);
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.alert {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

/* Admin: Lists Management */
.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.status-published {
    background: #d4edda;
    color: #155724;
}

.status-draft {
    background: #e2e3e5;
    color: #383d41;
}

.drag-handle {
    cursor: grab;
    color: #aaa;
    font-size: 1.2rem;
    width: 30px;
    text-align: center;
}

.sortable-ghost {
    opacity: 0.4;
    background: #c8ebfb;
}

.actions-cell {
    white-space: nowrap;
    width: 1%;
}

/* Admin: Item Layout */
.item-row {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: white;
    flex-wrap: wrap;
    gap: 10px;
}

.item-row:last-child {
    border-bottom: none;
}

.item-handle {
    cursor: grab;
    margin-right: 10px;
    color: #aaa;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.item-content {
    flex-grow: 1;
    min-width: 200px;
    word-break: break-word;
}

.item-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .item-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 5px;
    }
}

.global-badge {
    background: #17a2b8;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: 5px;
}

.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    margin-left: 3px;
    vertical-align: middle;
}

.item-row.inherited-item {
    background: #f3e5f5;
    border-left: 4px solid #6f42c1;
}

.item-row.local-item {
    border-left: 4px solid #28a745;
}


.note-card.handled {
    background: #f8f9fa;
    opacity: 0.7;
}

.note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #666;
}

.note-body {
    font-size: 1.1rem;
    margin-bottom: 15px;
    white-space: pre-wrap;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-wrapper input {
    width: 18px;
    height: 18px;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
}

/* --- Front-End List Styles --- */

.inner-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    text-align: center;
}

.inner-header h1 {
    margin: 0;
    font-size: 1.5rem;
    border: none;
    padding: 0;
}

.nav-header {
    max-width: 800px;
    margin: 20px auto 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.back-btn {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
}

.checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.check-item {
    background: var(--white);
    padding: 16px;
    margin-bottom: 12px;
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, background 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.check-item:active {
    transform: scale(0.98);
}

.check-item.checked {
    background: #e6f4ea;
    opacity: 1;
}

.item-main {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.item-content {
    flex-grow: 1;
    margin-left: 16px;
    font-size: 1.05rem;
    line-height: 1.5;
    font-weight: 500;
    margin-top: 2px;
}

/* Checkbox */
.checkbox {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid #e4e6eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    margin-top: 2px;
    background: var(--white);
}

.check-item.checked .checkbox {
    background: var(--success-color);
    border-color: var(--success-color);
    transform: scale(1.1);
}

.check-item.checked .checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Sub-items logic adaptation */
.check-item[data-has-subs="1"] {
    background: var(--white);
}

.check-item[data-has-subs="1"].checked {
    background: #e6f4ea;
}

.check-item.disabled .checkbox {
    border-color: #dcdcdc;
    background: #e9ecef;
    cursor: not-allowed;
}

.check-item.disabled.checked .checkbox {
    background: var(--success-color);
    border-color: var(--success-color);
    opacity: 0.8;
}

.important-text {
    color: #e0245e;
    font-size: 0.85rem;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.expand-btn {
    background: none;
    border: none;
    color: #65676b;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 10px;
    transition: transform 0.3s;
}

.description-box {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #65676b;
    line-height: 1.5;
    border: 1px solid #eee;
}

.sub-items {
    list-style: none;
    padding: 0;
    margin-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 12px;
    display: block;
}

.sub-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    font-size: 0.95rem;
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.2s;
}

.sub-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #adb5bd;
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: white;
    flex-shrink: 0;
}

.sub-item.checked {
    color: #6c757d;
}

.sub-item.checked .sub-checkbox {
    background: var(--success-color);
    border-color: var(--success-color);
}

.sub-item.checked .sub-checkbox::after {
    content: '✓';
    color: white;
    font-size: 11px;
}

/* FAB & Popups */
.fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.fab-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
}

.fab-btn:active {
    transform: scale(0.95);
}

.fab-btn.secondary {
    background: white;
    color: var(--accent-color);
    width: 48px;
    height: 48px;
    font-size: 20px;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.popup-prominent {
    z-index: 3000;
}

.popup-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    box-sizing: border-box;
    text-align: center;
}

.popup-icon {
    font-size: 80px;
    display: block;
    margin-bottom: 30px;
    animation: bounce 1s infinite;
}

.popup-content h2 {
    font-size: 2rem;
    margin: 0 0 15px 0;
    color: var(--text-color);
}

.popup-content p {
    font-size: 1.1rem;
    color: #65676b;
    margin-bottom: 40px;
    max-width: 400px;
    line-height: 1.6;
}

.popup-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 16px 60px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(0, 123, 255, 0.2);
    transition: all 0.3s;
    font-weight: 600;
}

.popup-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(0, 123, 255, 0.3);
}

/* Front Page List Grid */
.list-grid {
    display: grid;
    /* grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); */
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
}

.list-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.list-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.08);
}

.list-card h2,
.list-name {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.list-card p,
.list-desc {
    margin: 0;
    color: #8c8c8c;
    /* Lighter grey */
    font-size: 0.85rem;
    /* Smaller */
    line-height: 1.4;
}

.arrow {
    font-size: 1.5rem;
    color: #ccc;
    margin-left: 15px;
}


.badge-warning {
    background: #dc3545;
}

.badge-sub {
    background: #000;
}

.badge-note {
    background: #6c757d;
}

.badge-desc {
    background: #007bff;
}

/* Utils */
.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.mb-20 {
    margin-bottom: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}