:root {
    --bg-color: #f4f6f9;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --glass-bg: rgba(244, 246, 249, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

/* --- Global Native Feedback --- */
button:active, .icon-btn:active, .fab:active, .tab:active, .color-dot:active {
    transform: scale(0.92) !important;
    transition: transform 0.1s cubic-bezier(0.25, 1, 0.5, 1) !important;
    opacity: 0.8;
}

@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    /* Giới hạn chiều rộng để giống app mobile trên PC */
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    overflow-x: hidden;
}

/* Accessibility & Semantic SEO */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Header & Logo --- */
.app-header {
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    background: #ffffff;
    position: relative;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-back {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid rgba(0, 0, 0, 0.22);
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 18px;
    padding: 0;
    box-sizing: border-box;
}

.btn-back i,
.btn-back svg {
    color: inherit;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #000000;
    transform: translateX(-2px);
    border-color: rgba(0, 0, 0, 0.45);
}

.btn-back:active {
    transform: scale(0.92);
    background: rgba(0, 0, 0, 0.12);
    border-color: rgba(0, 0, 0, 0.55);
    opacity: 0.85;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.brand-link:hover {
    opacity: 0.92;
}

.brand-logo-card {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    padding: 3.5px;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

.brand-link:hover .brand-logo-card {
    transform: scale(1.04);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.brand-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    line-height: 1;
    white-space: nowrap;
}

.brand-name {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 800;
    font-size: 19px;
    color: #111827;
    letter-spacing: -0.025em;
    line-height: 1;
}

.brand-divider {
    font-size: 14px;
    font-weight: 300;
    color: var(--text-muted);
    opacity: 0.7;
    user-select: none;
}

.brand-app {
    font-family: 'Caveat', cursive, sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: 0.5px;
    line-height: 1;
    transform: translateY(-0.5px);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.sync-status-btn {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    color: #64748b;
    flex-shrink: 0;
}

.sync-status-btn svg {
    width: 19px;
    height: 19px;
    transition: transform 0.2s ease;
}

.sync-status-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1.04);
}

.sync-status-btn:active {
    transform: scale(0.92);
}

.sync-status-btn.synced {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.35);
    color: #10b981;
}

.sync-status-btn.syncing {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.35);
    color: #3b82f6;
}

.sync-status-btn.dirty {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.35);
    color: #f59e0b;
}

.sync-status-btn.offline {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.sync-status-btn .spin {
    animation: spinSync 1s linear infinite;
}

@keyframes spinSync {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.user-header-btn {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.user-header-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
    transform: scale(1.04);
}

.user-header-btn:active {
    transform: scale(0.92);
}

.user-avatar-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    overflow: hidden;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-default-icon {
    width: 18px;
    height: 18px;
    color: #64748b;
}

@media (max-width: 600px) {
    .sync-status-btn,
    .user-header-btn {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }
}

@media (max-width: 600px) {
    .btn-back {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 16px;
    }

    .brand-logo-card {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        padding: 3px;
    }

    .brand-name {
        font-size: 17px;
    }

    .brand-divider {
        font-size: 13px;
    }

    .brand-app {
        font-size: 19px;
    }
}

/* --- Search Bar --- */
.search-container {
    padding: 25px 20px 15px;
    position: sticky;
    top: 0;
    z-index: 9;
    /* Glassmorphism */
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.search-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04),
                inset 0 2px 4px rgba(255, 255, 255, 1);
    border-radius: 30px;
    padding: 10px 18px;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.search-box:focus-within {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08),
                inset 0 2px 4px rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.search-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-right: 12px;
}

.search-input {
    border: none;
    outline: none;
    font-size: 16px;
    width: 100%;
    font-family: 'Quicksand', sans-serif;
    background: transparent;
}

/* --- Tabs --- */
/* --- Tabs --- */
.tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px 20px;
    background: transparent;
}

.tabs-left {
    display: flex;
    align-items: center;
    gap: 25px;
}

.tab-info-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.04);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Quicksand', sans-serif;
}

.tab-info-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-main);
    transform: translateY(-1px);
}

.tab-info-btn:active {
    transform: scale(0.95);
}

.tab {
    font-size: 18px;
    font-style: italic;
    color: var(--text-main);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.2s;
}

.tab:not(.active) {
    opacity: 0.5;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1.5px;
    background-color: var(--text-main);
}

.tab-icon {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- User Header Button & Avatar --- */
.user-header-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.user-header-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.25);
    transform: scale(1.05);
}

.user-avatar-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.user-initial-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #FFFFFF;
    background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
    text-transform: uppercase;
    user-select: none;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.user-default-icon {
    width: 18px;
    height: 18px;
    display: block;
}


/* --- Notes List (Giao diện Swipe kiểu Gmail) --- */
.notes-list {
    display: flex;
    flex-direction: column;
    padding: 0 20px 100px 20px;
    gap: 24px;
}

.note-wrapper {
    position: relative;
    border-radius: 28px;
    opacity: 0;
    animation: slideUpFade 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.note-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    background-color: #e5e5ea;
    z-index: 1;
}

.bg-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
}

.bg-action svg {
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
    stroke-width: 2.5;
}

.bg-action span {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.note-foreground {
    position: relative;
    padding: 25px 30px;
    min-height: 140px;
    border-radius: inherit;
    /* Cấu trúc Đổ bóng & Nổi khối 3D cao cấp */
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.08),
                inset 2px 2px 4px rgba(255, 255, 255, 0.6),
                inset -2px -2px 6px rgba(0, 0, 0, 0.04);
    z-index: 2;
    cursor: pointer;
    touch-action: pan-y;
    /* Quan trọng: Cho phép cuộn dọc, chặn cuộn ngang trình duyệt để mượt gesture */
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.note-foreground:active {
    transform: translateY(4px) scale(0.98);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1),
                inset 2px 2px 4px rgba(255, 255, 255, 0.3),
                inset -2px -2px 6px rgba(0, 0, 0, 0.02);
}

.note-foreground:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12),
                inset 2px 2px 4px rgba(255, 255, 255, 0.8),
                inset -2px -2px 6px rgba(0, 0, 0, 0.05);
    transform: translateY(-4px);
}

.note-date {
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 10px;
    opacity: 0.8;
    letter-spacing: 0.5px;
}

.note-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-preview {
    font-size: 14px;
    opacity: 0.7;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Floating Action Button --- */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    background: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    /* Khối shadow nổi 3D xịn */
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12),
                inset 0 2px 4px rgba(255, 255, 255, 1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

@media (min-width: 500px) {
    .fab {
        right: calc(50vw - 250px + 30px);
    }
}

.fab:hover {
    transform: scale(1.05) rotate(-5deg);
}

.fab-icon {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: var(--text-main);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Editor UI (Redesigned - Modern Bottom Sheet) --- */
.editor-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    /* Màu nền sẽ được set bằng JS dựa theo màu Note */
}

.editor-view.active {
    transform: translateY(0);
}

.editor-top-bar {
    padding: 20px 20px 40px 20px;
    /* Padding dưới lớn để thẻ trắng đè lên đẹp hơn */
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Chữ trắng/đen sẽ set qua JS */
}

.icon-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    color: inherit;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.icon-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Thẻ trắng bo tròn chứa nội dung */
.editor-card {
    background-color: #ffffff;
    flex: 1;
    border-radius: 40px 40px 0 0;
    box-shadow: 0 -24px 48px rgba(0, 0, 0, 0.15),
                inset 0 4px 8px rgba(255, 255, 255, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    color: #1a1a1a;
    /* Nội dung luôn là chữ tối màu do nền trắng */
}

/* Thanh nắm kéo (trang trí) */
.drag-handle {
    width: 40px;
    height: 5px;
    background-color: #e5e7eb;
    border-radius: 5px;
    margin: 15px auto 5px;
}

.editor-content {
    flex: 1;
    padding: 20px 30px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.editor-title-input {
    font-size: 34px;
    font-weight: 700;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Quicksand', sans-serif;
    color: #111827;
    width: 100%;
    letter-spacing: -0.5px;
}

.editor-title-input::placeholder {
    color: #d1d5db;
}

.editor-body-input {
    flex: 1;
    font-size: 18px;
    line-height: 1.7;
    font-weight: 500;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Quicksand', sans-serif;
    resize: none;
    color: #374151;
    width: 100%;
}

.editor-body-input::placeholder {
    color: #9ca3af;
}

.editor-actions {
    display: flex;
    gap: 12px;
}

/* Utilities */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    font-style: italic;
}

.saved-icon {
    position: absolute;
    top: 25px;
    right: 30px;
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

/* --- Nút Xóa Nhanh Trên Thẻ (Quick Delete) --- */
.quick-delete-btn {
    position: absolute;
    bottom: 20px;
    right: 25px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    opacity: 0.5;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: none;
    z-index: 10;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.quick-delete-btn:hover {
    opacity: 1;
    background: rgba(255, 59, 48, 0.15);
    /* Nền đỏ nhạt nhẹ nhàng */
    color: #FF3B30 !important;
    /* Đổi icon thành màu đỏ */
    transform: scale(1.1);
}

.quick-delete-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Popup Chọn Màu --- */
.color-picker-wrapper {
    position: relative;
}

.color-popup {
    position: absolute;
    top: 55px;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), inset 0 2px 4px rgba(255, 255, 255, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 300;
}

.color-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.color-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.color-dot:hover {
    transform: scale(1.15) translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.color-dot.active {
    border-color: #000;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #fff inset, 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* --- UI MODAL XÓA (iPHONE ACTION SHEET TÙY CHỈNH THEO THEME) --- */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Căn xuống đáy màn hình */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.confirm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.action-sheet {
    width: 100%;
    max-width: 500px; /* Bằng max-width của body */
    padding: 0 10px 30px 10px; /* Cách đáy screen một chút */
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    font-family: 'Quicksand', sans-serif;
}

.confirm-modal-overlay.active .action-sheet {
    transform: translateY(0);
}

.action-sheet-group {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 20px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), inset 0 2px 4px rgba(255,255,255,0.6);
    border: 1.5px solid rgba(255, 255, 255, 0.8);
}

.action-sheet-group:last-child {
    margin-bottom: 0;
}

.action-sheet-text {
    padding: 15px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
    line-height: 1.4;
    font-weight: 500;
}

.action-sheet-btn {
    width: 100%;
    background: transparent;
    border: none;
    padding: 16px;
    font-size: 18px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    outline: none;
}

.action-sheet-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.action-sheet-btn.delete {
    color: #FF3B30;
    font-weight: 500;
}

.action-sheet-btn.cancel {
    color: #007AFF;
    font-weight: 600;
}

/* --- INFO POPUP / SEO Modal --- */
.info-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Nằm dưới đáy trên mobile */
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.info-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.info-popup-card {
    background: #ffffff;
    width: 100%;
    border-radius: 35px 35px 0 0;
    padding: 35px 25px max(35px, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -24px 48px rgba(0, 0, 0, 0.15), inset 0 4px 8px rgba(255, 255, 255, 1);
}

.info-popup-overlay.active .info-popup-card {
    transform: translateY(0);
}

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

.info-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #10B981, #3B82F6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.header-info-btn,
.close-info-btn {
    background: #f3f4f6 !important;
    color: #1f2937 !important;
}

.header-info-btn:hover,
.close-info-btn:hover {
    background: #e5e7eb !important;
    transform: scale(1.05);
}

.info-body p {
    font-size: 16px;
    line-height: 1.6;
    color: #4b5563;
    margin-bottom: 16px;
}

.info-body p strong {
    color: #111827;
}

.info-body h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 30px 0 16px 0;
}

.info-body ul {
    list-style: none;
    padding: 0;
    margin-bottom: 25px;
}

.info-body li {
    font-size: 15.5px;
    line-height: 1.6;
    color: #4b5563;
    margin-bottom: 14px;
    position: relative;
    padding-left: 18px;
}

.info-body li::before {
    content: "•";
    color: #3B82F6;
    font-weight: bold;
    font-size: 18px;
    position: absolute;
    left: 0;
    top: 0;
}

/* --- Đa Thiết Bị / Responsive --- */
@media (min-width: 600px) {
    body {
        max-width: 600px;
        margin: 20px auto;
        min-height: calc(100vh - 40px);
        border-radius: 30px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
        border: 1px solid var(--border-color);
    }

    .app-header {
        border-top-left-radius: 30px;
        border-top-right-radius: 30px;
    }

    .search-container {
        border-radius: 20px;
    }

    .editor-view {
        height: calc(100vh - 40px);
        top: 20px;
        bottom: 20px;
        left: 50%;
        transform: translate(-50%, 120%);
        max-width: 600px;
        border-radius: 30px;
        overflow: hidden;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    }

    .editor-view.active {
        transform: translate(-50%, 0);
    }

    .action-sheet {
        max-width: 600px;
    }

    .fab {
        right: calc(50vw - 300px + 30px);
    }

    .info-popup-overlay {
        align-items: center; /* Đưa ra giữa màn hình trên Desktop */
    }

    .info-popup-card {
        max-width: 520px;
        border-radius: 35px;
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }

    .info-popup-overlay.active .info-popup-card {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Sync Status Button & Indicator --- */
.sync-status-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    padding: 0;
    flex-shrink: 0;
}

.sync-status-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.25);
    transform: scale(1.05);
}

.sync-status-btn:active {
    transform: scale(0.92);
}

.sync-status-btn svg {
    width: 19px;
    height: 19px;
    display: block;
    transition: transform 0.25s ease, color 0.25s ease;
}

/* Trạng thái: Synced (Đã đồng bộ) */
.sync-status-btn.synced {
    color: #10b981;
    background: rgba(16, 185, 129, 0.09);
    border-color: rgba(16, 185, 129, 0.35);
}

/* Trạng thái: Syncing (Đang đồng bộ - xoay mượt) */
.sync-status-btn.syncing {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.09);
    border-color: rgba(59, 130, 246, 0.4);
}

.sync-status-btn.syncing svg {
    animation: syncSpin 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes syncSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Trạng thái: Dirty / Pending (Đang đợi debounce) */
.sync-status-btn.dirty {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.09);
    border-color: rgba(245, 158, 11, 0.35);
}

.sync-status-btn.dirty::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    background: #f59e0b;
    border-radius: 50%;
    border: 1.5px solid #ffffff;
}

/* Trạng thái: Offline / Guest */
.sync-status-btn.offline {
    color: #9ca3af;
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    opacity: 0.75;
}