@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700;800;900&display=swap');

:root {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --primary-color: #03a9f4;
    --accent-color: #00bcd4;
    --danger-color: #ff5252;
    --success-color: #4caf50;
    --border-color: rgba(0, 0, 0, 0.1);
    --input-bg: #f9f9f9;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --primary-color: #03a9f4;
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: #2d2d2d;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

* {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: -webkit-fill-available; /* Full screen on mobile */
    background: var(--bg-body);
    transition: var(--transition);
    overflow: hidden; /* Prevent body scroll */
}

html {
    height: -webkit-fill-available;
}

.list {
    position: relative;
    background: var(--bg-card);
    width: 100%;
    max-width: 450px;
    height: 95vh;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

/* Header Sticky area */
.list-header {
    padding: 25px 25px 10px;
    background: var(--bg-card);
    z-index: 10;
}

.header-main {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.header-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.title-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 25px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
    align-self: flex-start;
}

.list h2 {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
    padding: 0;
    border: none;
}

.sync-status {
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sync-status.local {
    color: var(--text-secondary);
    opacity: 0.45;
}

.sync-status.synced {
    color: var(--success-color);
    opacity: 0.95;
    filter: drop-shadow(0 0 4px rgba(76, 175, 80, 0.3));
    animation: pulseSync 2s infinite ease-in-out;
}

.sync-status.syncing {
    color: var(--primary-color);
    opacity: 0.9;
    animation: spinSync 1.5s infinite linear;
}

@keyframes pulseSync {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

@keyframes spinSync {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollable Content */
.list-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 25px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.list-content::-webkit-scrollbar {
    width: 6px;
}

.list-content::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

select {
    width: 100%;
    padding: 12px 15px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2303a9f4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}

.header-actions button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    transition: var(--transition);
}

#themeToggle { background: var(--text-primary); color: var(--bg-card); }
#shareList { background-color: var(--accent-color); }
#addNewList { background-color: var(--success-color); }
#deleteList { background-color: var(--danger-color); }

.list ul li {
    list-style: none;
    padding: 12px 15px;
    background: var(--input-bg);
    border-radius: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.list ul li:hover {
    border-color: var(--primary-color);
}

.list ul li label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
}

.list ul li label p {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    word-break: break-all;
}

.list ul li label input { display: none; }

.list ul li label span {
    min-width: 22px;
    height: 22px;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
}

.list ul li label span::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 11px;
    color: white;
    display: none;
}

.list ul li label input:checked ~ p {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.6;
}

.list ul li label input:checked ~ span { background: var(--primary-color); }
.list ul li label input:checked ~ span::after { display: block; }

/* Actions wrapper for list item */
.todo-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Edit and Delete button styling */
.edit-todo, .delete-todo {
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.edit-todo:hover {
    color: var(--primary-color);
}

.delete-todo:hover {
    color: var(--danger-color);
}

/* Drag and Drop styling */
.drag-handle {
    color: var(--text-secondary);
    cursor: grab;
    padding: 5px 8px 5px 2px;
    font-size: 0.95rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    user-select: none;
}

.drag-handle:hover {
    color: var(--primary-color);
}

.drag-handle:active {
    cursor: grabbing;
}

.list ul li.dragging {
    opacity: 0.45;
    border: 1.5px dashed var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.list ul li.drag-over {
    border-top: 2px solid var(--primary-color);
    margin-top: 6px;
    margin-bottom: 18px;
    transition: margin 0.2s ease, border 0.1s ease;
}

/* Add Todo Bottom section */
.addTodo {
    padding: 15px 25px;
    background: var(--bg-card);
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--border-color);
}

.addTodo input {
    flex: 1;
    border-radius: 14px;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    padding: 12px 15px;
    color: var(--text-primary);
    outline: none;
}

.addTodo button {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Footer with fixed clear button */
.footer {
    padding: 15px 25px;
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 10;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.footer-brand {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}

.brand-app {
    color: var(--primary-color);
    font-weight: 700;
}

.brand-by {
    color: var(--text-secondary);
    opacity: 0.6;
    font-weight: 400;
}

.brand-company {
    color: var(--text-primary);
    font-weight: 600;
}

.footer-button {
    background: rgba(255, 82, 82, 0.08);
    color: var(--danger-color);
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    transition: var(--transition);
}

.footer-button i {
    font-size: 0.9rem;
}

.footer-button:hover {
    background: var(--danger-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.2);
}

.footer-button:active {
    transform: translateY(0);
}

/* Toast Notification Styles */
.toast-notification {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 14px 28px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
}

[data-theme="dark"] .toast-notification {
    background: rgba(30, 30, 30, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    color: #fff;
}

.toast-notification.show {
    bottom: 40px;
}

.toast-notification i {
    color: var(--success-color);
    font-size: 1.1rem;
}

@media (max-width: 480px) {
    body { padding: 0; }
    .list {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }
}