/* wl.pt — Watch List V1.0.0 */
/* Mobile-first · Dark/Light · DM Sans */

:root {
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 14px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
    --max-width: 560px;
    --fab-size: 56px;
}

/* ── Dark theme (default) ── */
[data-theme="dark"] {
    --bg: #0d0d0d;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222;
    --bg-input: #252525;
    --bg-modal: #1a1a1a;
    --bg-done: #141414;
    --text: #f0f0f0;
    --text-secondary: #888;
    --text-muted: #555;
    --border: #2a2a2a;
    --accent: #E67E22;
    --accent-glow: rgba(230, 126, 34, 0.15);
    --accent-text: #fff;
    --danger: #e74c3c;
    --danger-bg: rgba(231, 76, 60, 0.1);
    --success: #2ecc71;
    --success-bg: rgba(46, 204, 113, 0.1);
    --shadow: 0 2px 16px rgba(0,0,0,0.3);
    --overlay: rgba(0,0,0,0.7);
    --tag-bg: #2a2a2a;
    --tag-active: var(--accent);
    --swipe-done: rgba(46, 204, 113, 0.15);
    --swipe-delete: rgba(231, 76, 60, 0.15);
}

/* ── Light theme ── */
[data-theme="light"] {
    --bg: #f5f5f0;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-input: #f0f0eb;
    --bg-modal: #ffffff;
    --bg-done: #f8f8f5;
    --text: #1a1a1a;
    --text-secondary: #666;
    --text-muted: #aaa;
    --border: #e5e5e0;
    --accent: #d35400;
    --accent-glow: rgba(211, 84, 0, 0.08);
    --accent-text: #fff;
    --danger: #c0392b;
    --danger-bg: rgba(192, 57, 43, 0.06);
    --success: #27ae60;
    --success-bg: rgba(39, 174, 96, 0.06);
    --shadow: 0 2px 16px rgba(0,0,0,0.06);
    --overlay: rgba(0,0,0,0.4);
    --tag-bg: #e8e8e3;
    --tag-active: var(--accent);
    --swipe-done: rgba(39, 174, 96, 0.08);
    --swipe-delete: rgba(192, 57, 43, 0.08);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

/* ── Login ── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px 32px;
    box-shadow: var(--shadow);
    animation: fadeUp 0.4s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.login-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition);
}

.form-group input:focus {
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.btn-login {
    padding: 14px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
    margin-top: 4px;
}

.btn-login:hover { opacity: 0.9; }
.btn-login:disabled { opacity: 0.4; cursor: not-allowed; }

.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 24px;
}

/* ── Top Bar ── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
    flex: 1;
    text-align: center;
}

.top-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text);
    font-size: 18px;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    line-height: 1;
}

.btn-icon:hover {
    background: var(--bg-card-hover);
}

.btn-back {
    font-size: 20px;
    font-weight: 300;
}

/* ── Views ── */
.view {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 100px;
    min-height: calc(100dvh - 53px - 40px);
}

/* ── Lists View ── */
.lists-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    animation: fadeUp 0.3s ease both;
    user-select: none;
    -webkit-user-select: none;
}

.list-card:hover {
    background: var(--bg-card-hover);
}

.list-card:active {
    transform: scale(0.98);
}

.list-card.dragging {
    opacity: 0.5;
    transform: scale(0.96);
}

.list-card.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.list-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: 12px;
}

.list-info {
    flex: 1;
    min-width: 0;
}

.list-name {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-count {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.list-arrow {
    color: var(--text-muted);
    font-size: 18px;
    flex-shrink: 0;
}

.list-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.list-card:hover .list-card-actions {
    opacity: 1;
}

@media (max-width: 768px) {
    .list-card-actions { opacity: 1; }
}

/* ── Items View ── */
.items-header {
    margin-bottom: 12px;
}

.items-filter {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-pill {
    padding: 5px 12px;
    background: var(--tag-bg);
    border: none;
    border-radius: 20px;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

.tag-pill:hover,
.tag-pill.active {
    background: var(--tag-active);
    color: var(--accent-text);
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.item-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background var(--transition), transform 0.15s ease;
    animation: fadeUp 0.25s ease both;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.item-card.dragging {
    opacity: 0.5;
    transform: scale(0.96);
}

.item-card.drag-over {
    border-color: var(--accent);
}

.item-card.swiping {
    transition: none;
}

.item-card.swipe-done {
    background: var(--swipe-done);
}

.item-card.swipe-delete {
    background: var(--swipe-delete);
}

.item-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    background: transparent;
}

.item-check:hover {
    border-color: var(--accent);
}

.item-check.checked {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
    font-size: 12px;
}

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

.item-title {
    font-size: 15px;
    font-weight: 400;
    word-break: break-word;
}

.item-title a {
    color: var(--accent);
    text-decoration: none;
}

.item-title a:hover {
    text-decoration: underline;
}

.item-note {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    word-break: break-word;
}

.item-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
    flex-wrap: wrap;
}

.item-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--tag-bg);
    border-radius: 10px;
    color: var(--text-secondary);
}

.item-added-by {
    font-size: 11px;
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition);
}

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

@media (max-width: 768px) {
    .item-actions { opacity: 1; }
}

.item-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    padding: 6px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

.item-action-btn:hover {
    color: var(--text);
    background: var(--bg-input);
}

.item-action-btn.delete:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* Done items */
.item-card.done {
    opacity: 0.5;
}

.item-card.done .item-title {
    text-decoration: line-through;
    color: var(--text-secondary);
}

/* ── Done section ── */
.done-section {
    margin-top: 16px;
}

.done-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 0;
}

.done-toggle-icon {
    transition: transform var(--transition);
    display: inline-block;
}

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

.done-count {
    background: var(--tag-bg);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.done-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

/* ── FAB ── */
.fab {
    position: fixed;
    bottom: 56px;
    right: max(16px, calc((100vw - var(--max-width)) / 2));
    width: var(--fab-size);
    height: var(--fab-size);
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: 50%;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(230, 126, 34, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition), box-shadow var(--transition);
    z-index: 50;
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(230, 126, 34, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal {
    width: 100%;
    max-width: var(--max-width);
    background: var(--bg-modal);
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 85dvh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
    }
    .modal {
        border-radius: var(--radius);
        max-height: 80vh;
        margin: 24px;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 14px;
}

.modal-body label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.modal-body input[type="text"],
.modal-body input[type="url"],
.modal-body textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition);
    resize: vertical;
}

.modal-body input:focus,
.modal-body textarea:focus {
    border-color: var(--accent);
}

.modal-body textarea {
    min-height: 72px;
}

.modal-body .url-row {
    display: flex;
    gap: 8px;
}

.modal-body .url-row input {
    flex: 1;
}

.btn-fetch {
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-fetch:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-fetch.loading {
    opacity: 0.5;
    pointer-events: none;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.btn-save {
    flex: 1;
    padding: 13px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
}

.btn-save:hover { opacity: 0.9; }

.btn-cancel {
    padding: 13px 20px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-cancel:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    padding: 13px 20px;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    cursor: pointer;
    transition: opacity var(--transition);
}

.btn-danger:hover { opacity: 0.8; }

/* Emoji picker grid */
.emoji-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.emoji-option {
    font-size: 24px;
    padding: 8px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition);
}

.emoji-option:hover,
.emoji-option.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* ── Footer ── */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 90;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state-text {
    font-size: 15px;
}

.empty-state-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Stagger animation for list items */
.list-card:nth-child(1) { animation-delay: 0s; }
.list-card:nth-child(2) { animation-delay: 0.04s; }
.list-card:nth-child(3) { animation-delay: 0.08s; }
.list-card:nth-child(4) { animation-delay: 0.12s; }
.list-card:nth-child(5) { animation-delay: 0.16s; }
.list-card:nth-child(6) { animation-delay: 0.2s; }
.list-card:nth-child(7) { animation-delay: 0.24s; }
.list-card:nth-child(8) { animation-delay: 0.28s; }

.item-card:nth-child(1) { animation-delay: 0s; }
.item-card:nth-child(2) { animation-delay: 0.03s; }
.item-card:nth-child(3) { animation-delay: 0.06s; }
.item-card:nth-child(4) { animation-delay: 0.09s; }
.item-card:nth-child(5) { animation-delay: 0.12s; }
.item-card:nth-child(6) { animation-delay: 0.15s; }
.item-card:nth-child(7) { animation-delay: 0.18s; }
.item-card:nth-child(8) { animation-delay: 0.21s; }
.item-card:nth-child(9) { animation-delay: 0.24s; }
.item-card:nth-child(10) { animation-delay: 0.27s; }

/* ── Confirm dialog ── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.confirm-dialog {
    background: var(--bg-modal);
    border-radius: var(--radius);
    padding: 28px 24px 20px;
    width: 90%;
    max-width: 340px;
    text-align: center;
    box-shadow: var(--shadow);
}

.confirm-dialog h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.confirm-dialog p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.confirm-actions {
    display: flex;
    gap: 8px;
}

.confirm-actions button {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
}

.confirm-actions .btn-confirm-cancel {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.confirm-actions .btn-confirm-ok {
    background: var(--danger);
    color: #fff;
}
