/* Haru Notes — tema musim semi + dark mode */
:root,
[data-theme="light"] {
    --sakura: #ffb7c5;
    --sakura-deep: #ff8fab;
    --peach: #ffe8d6;
    --mint: #b8e8d0;
    --sky: #d4ecff;
    --text: #3d3d4e;
    --text-muted: #6b6b7b;
    --surface: #ffffff;
    --surface-2: #fffbfc;
    --bg: #fff5f8;
    --bg-gradient: linear-gradient(160deg, #fff5f8 0%, #fff9f0 40%, #f0fff8 100%);
    --border: #f0d4dc;
    --shadow: 0 2px 12px rgba(255, 143, 171, 0.12);
    --shadow-lg: 0 8px 28px rgba(255, 143, 171, 0.18);
    --header-bg: rgba(255, 255, 255, 0.92);
    --sidebar-bg: #ffffff;
    --sidebar-active: #fff0f3;
    --overlay: rgba(61, 61, 78, 0.45);
    --radius: 12px;
    --header-h: 56px;
    --sidebar-w: 220px;
    --sidebar-w-collapsed: 64px;
    --edited-text: #8a8a9a;
    --pinned-accent: rgba(255, 143, 171, 0.18);
    --fab-size: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --font: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

[data-theme="dark"] {
    --sakura: #f5a8b8;
    --sakura-deep: #ff8fab;
    --peach: #3d3538;
    --mint: #5a9b7a;
    --sky: #4a6a85;
    --text: #e8eaed;
    --text-muted: #9aa0a6;
    --surface: #2d2e30;
    --surface-2: #35363a;
    --bg: #1e1e1e;
    --bg-gradient: none;
    --header-bg: rgba(24,24,24,0.9);
    --sidebar-bg: #232324;
    --sidebar-active: rgba(255,255,255,0.02);
    --overlay: rgba(0,0,0,0.6);
    --border: rgba(255,255,255,0.06);
    --border: #3c4043;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Global layout and typography */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background-color: var(--bg);
    background-image: var(--bg-gradient);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.is-hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.app-loading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 18px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    text-align: center;
    z-index: 999;
}

.app-body {
    min-height: 100vh;
    width: 100%;
    transition: margin-left 0.25s ease;
    padding-top: var(--header-h);
}

.loading-logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.loading-logo span {
    color: var(--sakura-deep);
}

.loading-spinner {
    width: 52px;
    height: 52px;
    border: 6px solid rgba(255, 183, 197, 0.35);
    border-top-color: var(--sakura-deep);
    border-radius: 50%;
    animation: spin 1.1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    color: inherit;
}

.main-header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    padding: 8px 12px 8px 8px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 400;
    transition: transform 0.25s ease;
    border-bottom: 1px solid var(--border);
    min-height: var(--header-h);
}

/* Sidebar */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 150;
    padding-top: var(--header-h);
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100%;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s ease, width 0.25s ease;
    padding-top: calc(var(--header-h) + 8px);
    overflow: hidden;
}

.app-sidebar.is-open {
    transform: translateX(0);
}

.app-wrapper.sidebar-collapsed .app-sidebar.is-open {
    width: var(--sidebar-w-collapsed);
}

.app-wrapper.sidebar-collapsed .sidebar-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.app-wrapper.sidebar-collapsed .sidebar-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    min-width: 0;
    margin: 10px auto;
    text-align: center;
    background: rgba(255, 183, 197, 0.18);
}

.app-wrapper.sidebar-collapsed .sidebar-item .sidebar-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-size: 1.1rem;
}

.app-wrapper.sidebar-collapsed .sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 0;
    gap: 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 0 24px 24px 0;
    background: transparent;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: left;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.clock-display {
    margin-left: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 700;
}

.sidebar-section-label {
    margin-left: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sakura-deep);
}
/* Header */
.main-header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    padding: 8px 12px 8px 8px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 400;
    transition: transform 0.25s ease;
    border-bottom: 1px solid var(--border);
    min-height: var(--header-h);
}

.main-header.header-hidden {
    transform: translateY(-100%);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-logo {
    flex-shrink: 0;
}

.header-brand h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .header-brand h1 {
    background: linear-gradient(135deg, var(--sakura-deep), #c77dff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--peach);
    color: var(--text);
}

.icon-btn-accent {
    background: var(--sakura-deep);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 300;
}

.icon-btn-accent:hover {
    filter: brightness(1.08);
    color: #fff;
}

/* Profile menu */
.profile-wrap {
    position: relative;
}

.profile-avatar-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--peach);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.header-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-avatar-fallback {
    font-size: 1rem;
    font-weight: 800;
    color: var(--sakura-deep);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    overflow: hidden;
}

.profile-dropdown-head {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.dropdown-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.dropdown-avatar-fallback {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--peach);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.profile-dropdown-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.profile-dropdown-info strong {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown-info span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.profile-dropdown-info small {
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: transparent;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
}

.dropdown-item:hover {
    background: var(--peach);
}

.dropdown-item-danger {
    color: #e85d6f;
}

.main-view-label {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 16px;
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn {
    padding: 10px 18px;
    font-size: 0.9rem;
    margin: 0;
    width: auto;
    box-shadow: var(--shadow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--sakura-deep), var(--sakura));
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-danger {
    background: #ff7b8a;
    color: #fff;
}

.btn-danger:hover {
    background: #ff5c6f;
}

.btn-ghost {
    background: var(--peach);
    color: var(--text);
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--sakura);
    color: #fff;
}

/* Papan catatan — Disematkan / Lainnya */
.notes-board {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.notes-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title {
    margin: 0 0 4px 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title-minimal {
    min-height: 28px;
}

.section-pin-icon,
.section-title-minimal .section-icon {
    font-size: 1.1rem;
    opacity: 0.75;
    line-height: 1;
}

[data-theme="dark"] .section-pin-icon {
    opacity: 0.85;
    filter: none;
}

.note-card.is-locked {
    border-color: #c9b8e0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.08) 100%);
}

.note-card.is-locked .note-card-content {
    position: relative;
    overflow: hidden;
    min-height: 120px;
}

.note-card.is-locked .locked-backdrop {
    position: absolute;
    inset: 0;
    filter: blur(14px);
    opacity: 0.18;
    user-select: none;
    pointer-events: none;
    background: transparent;
}

html[data-theme="light"] .note-card.is-locked .locked-preview {
    color: var(--text);
    text-shadow: 0 3px 8px rgba(0,0,0,0.6);
}

html[data-theme="dark"] .note-card.is-locked .locked-preview {
    color: #ffffff;
    text-shadow: none;
}



.note-card.is-locked .locked-preview {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    max-width: 84%;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(0,0,0,0.12);
}

.note-card.is-locked .locked-preview.outline {
    background: transparent;
    color: var(--text);
    border-color: rgba(0,0,0,0.16);
    box-shadow: none;
    -webkit-text-stroke: 0;
}

html[data-theme="dark"] .note-card.is-locked .locked-preview.outline {
    background: rgba(255,255,255,0.02);
    color: #fff;
    border-color: rgba(255,255,255,0.08);
}

/* subtle darker card borders in dark mode */
html[data-theme="dark"] .note-card {
    border-color: rgba(255,255,255,0.04);
}

/* header background in dark mode */
html[data-theme="dark"] .main-header {
    background: var(--header-bg);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.note-card.is-locked .locked-backdrop img,
.note-card.is-locked .locked-backdrop video,
.note-card.is-locked .locked-backdrop iframe {
    opacity: 0.1;
}

/* Rich text — spoiler & kutipan */
.spoiler {
    background: var(--text);
    color: transparent;
    border-radius: 4px;
    padding: 0 4px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.spoiler.revealed {
    background: var(--peach);
    color: var(--text);
}

.note-quote,
blockquote.note-quote {
    margin: 10px 0;
    padding: 12px 14px 12px 16px;
    border-left: 4px solid var(--sakura-deep);
    background: linear-gradient(90deg, rgba(255, 183, 197, 0.2), transparent);
    border-radius: 0 10px 10px 0;
    font-style: italic;
    color: var(--text);
}

.note-card-content s,
.note-card-content strike,
.note-content-editor s {
    text-decoration: line-through;
    opacity: 0.75;
}

.style-buttons {
    flex-wrap: wrap;
}

/* Settings & PIN modal */
.modal-settings,
.modal-pin-prompt {
    max-width: 440px;
}

.settings-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--sakura-deep);
}

.settings-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-section h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.settings-desc {
    margin: 0 0 14px;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.pin-status {
    padding: 10px 14px;
    background: var(--peach);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.pin-status.pin-active {
    background: #e8f8ef;
    color: #2d6a4f;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-form label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

.settings-form input {
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--surface-2);
    color: var(--text);
}

.settings-form .btn {
    width: 100%;
    margin-top: 4px;
}

.pin-input-large {
    width: 100%;
    padding: 16px;
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 0.4em;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    margin-bottom: 12px;
}

.pin-error {
    color: #e85d6f;
    font-size: 0.88rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--peach);
    border-radius: 10px;
    font-weight: 700;
}

.toggle-disabled {
    opacity: 0.65;
}

.toggle-badge {
    font-size: 0.72rem;
    background: var(--sky);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 800;
}

.toggle-active-row input[type="checkbox"] {
    width: 44px;
    height: 24px;
    accent-color: var(--sakura-deep);
    cursor: pointer;
}

.btn-secondary {
    background: var(--peach);
    color: var(--text);
    width: auto;
    padding: 10px 16px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 4px;
    margin: 0;
    box-shadow: none;
    width: auto;
}

.btn-text:hover {
    color: var(--sakura-deep);
}

.modal-profile {
    max-width: 400px;
}

.profile-edit-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-photo-edit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.profile-photo-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--peach);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid var(--border);
}

.profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo-preview span {
    font-size: 2.5rem;
}

.photo-upload-label {
    cursor: pointer;
}

.loading-text {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.note-card-footer {
    background: var(--surface-2);
}

[data-theme="dark"] .spoiler {
    background: #5f6368;
}

[data-theme="dark"] .spoiler.revealed {
    background: var(--peach);
    color: var(--text);
}

[data-theme="dark"] .note-quote,
[data-theme="dark"] blockquote.note-quote {
    background: rgba(255, 143, 171, 0.12);
}

/* Main content */
.notes-main {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.compose-bar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    text-align: left;
    margin-top: 0;
}

.compose-bar:hover {
    border-color: var(--sakura);
    box-shadow: var(--shadow-lg);
}

.compose-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--peach);
    border-radius: 50%;
    font-size: 1rem;
    flex-shrink: 0;
}

.compose-placeholder {
    font-weight: 600;
}

.notes-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.note-card {
    background: var(--surface);
    padding: 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    height: 100%;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--sakura);
}

.note-card.is-pinned {
    background: var(--surface);
    border-color: var(--sakura);
    box-shadow: var(--shadow), inset 0 0 0 1px var(--pinned-accent, rgba(255, 143, 171, 0.2));
}

[data-theme="dark"] .note-card.is-pinned {
    background: var(--surface);
    border-color: var(--sakura);
    box-shadow: var(--shadow), 0 0 0 1px var(--pinned-accent);
}

.note-card:nth-child(3n+1) { border-top: 3px solid var(--sakura); }
.note-card:nth-child(3n+2) { border-top: 3px solid var(--mint); }
.note-card:nth-child(3n)   { border-top: 3px solid var(--sky); }

.note-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 14px 0;
    flex-shrink: 0;
}

.note-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--sakura-deep);
    margin: 0;
    word-break: break-word;
    flex: 1;
    line-height: 1.35;
}

.note-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.note-card:hover .note-card-actions,
.note-card:focus-within .note-card-actions {
    opacity: 1;
}

.card-action-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    background: var(--peach);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.card-action-btn:hover {
    background: var(--sakura);
    border-color: var(--sakura);
}

.card-action-btn.is-active {
    background: var(--sidebar-active);
    color: var(--sakura-deep);
    border-color: var(--sakura);
}

[data-theme="dark"] .card-action-btn.is-active {
    background: var(--sidebar-active);
    color: #f5d9a8;
    border-color: var(--border);
}

.note-card-body {
    flex: 1;
    min-height: 0;
    padding: 10px 14px 0;
    display: flex;
    flex-direction: column;
}

.note-card-content {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    word-break: break-word;
    flex: 1;
}

.note-card-content b,
.note-card-content strong { font-weight: 700; }
.note-card-content i,
.note-card-content em { font-style: italic; }

.note-card-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 4px 12px 10px;
    border-top: none;
    background: transparent;
}

.note-last-edited {
    font-size: 0.6rem;
    color: var(--edited-text, var(--text-muted));
    margin: 0;
    text-align: right;
    font-style: normal;
    line-height: 1.2;
    opacity: 0.9;
}

[data-theme="dark"] .note-last-edited {
    color: var(--edited-text);
    opacity: 1;
}

[data-theme="dark"] .note-card-footer {
    background: transparent;
}

/* Modal catatan — sticky footer seperti Keep */
.modal-content.modal-note {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    max-height: min(92vh, 720px);
}

.modal-header-sticky {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--surface);
    margin: 0;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 0;
}

.note-modal-edited {
    margin: 0;
    font-size: 0.68rem;
    color: var(--edited-text, var(--text-muted));
    line-height: 1.2;
}

[data-theme="dark"] .note-modal-edited {
    color: var(--edited-text);
}

.note-form-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.note-form-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 8px;
    min-height: 120px;
}

.form-group-editor {
    margin-bottom: 0;
}

.modal-footer-sticky {
    flex-shrink: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 10px 16px 16px;
    position: sticky;
    bottom: 0;
    z-index: 2;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .modal-footer-sticky {
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
}

.modal-footer-sticky .style-buttons {
    margin-top: 0;
    margin-bottom: 8px;
}

.modal-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.modal-toolbar-icons {
    align-items: center;
}

.toolbar-icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: transparent;
    border: none;
    font-size: 1.15rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}

.toolbar-icon-btn:hover {
    background: var(--peach);
    color: var(--text);
}

.toolbar-icon-btn.is-active {
    background: var(--sidebar-active);
    color: var(--sakura-deep);
}

[data-theme="dark"] .toolbar-icon-btn.is-active {
    background: var(--sidebar-active);
    color: #f5d9a8;
}

.toolbar-icon-btn.hidden {
    display: none !important;
}

.modal-footer-sticky .form-actions {
    margin-top: 0;
}

.no-notes-message {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-weight: 600;
}

.no-notes-message .emoji {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

/* FAB */
.fab {
    position: fixed;
    right: 20px;
    bottom: calc(20px + var(--safe-bottom));
    width: var(--fab-size);
    height: var(--fab-size);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sakura-deep), var(--sakura));
    color: #fff;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    box-shadow: 0 6px 20px rgba(255, 143, 171, 0.45);
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.fab:hover {
    transform: scale(1.06);
}

/* Modal */
.modal-container {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 250;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 16px;
    overflow-y: auto;
}

.modal-container.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 560px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 20px 24px 24px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    border: 1px solid var(--border);
}

.modal-content:not(.modal-note) {
    overflow-y: auto;
}

.modal-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
}

.close-modal-btn {
    background: var(--peach);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: none;
    margin: 0;
}

.close-modal-btn:hover {
    background: var(--sakura);
    color: #fff;
}

.autosave-status {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    flex: 1;
    text-align: right;
}

.autosave-status.autosave-saving { color: var(--sakura-deep); }
.autosave-status.autosave-saved { color: #3d9b6e; }
.autosave-status.autosave-error { color: #e85d6f; }
.autosave-status.autosave-pending { font-style: italic; }

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
}

#note-title {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    background: var(--surface-2);
}

#note-title:focus {
    outline: none;
    border-color: var(--sakura-deep);
    box-shadow: 0 0 0 3px rgba(255, 143, 171, 0.25);
}

.note-content-editor {
    width: 100%;
    min-height: 160px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1.6;
    background: var(--surface-2);
    color: var(--text);
    overflow-y: auto;
}

.note-content-editor:focus {
    outline: none;
    border-color: var(--sakura-deep);
    box-shadow: 0 0 0 3px rgba(255, 143, 171, 0.25);
}

.note-content-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    font-style: italic;
    pointer-events: none;
}

.style-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    background: var(--peach);
    border-radius: 10px;
}

.style-btn {
    width: auto;
    min-width: 40px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 800;
    font-size: 0.9rem;
    border-radius: 8px;
    margin: 0;
    box-shadow: none;
}

.style-btn:hover {
    background: var(--sakura);
    color: #fff;
    border-color: var(--sakura);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.form-actions .btn {
    flex: 1;
}

body.modal-open {
    overflow: hidden;
}

/* Login page */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-gradient);
}

.login-container {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    padding: 40px 32px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    text-align: center;
}

.login-container .brand-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.login-container h1 {
    margin: 0 0 4px;
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--sakura-deep), #e8a0ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-container .tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 28px;
}

.input-group {
    text-align: left;
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--surface-2);
    color: var(--text);
}

.input-group input:focus {
    outline: none;
    border-color: var(--sakura-deep);
    box-shadow: 0 0 0 3px rgba(255, 143, 171, 0.25);
}

.login-form button {
    width: 100%;
    padding: 13px;
    margin-top: 8px;
    font-size: 1rem;
}

.login-form button[type="submit"] {
    background: linear-gradient(135deg, var(--sakura-deep), var(--sakura));
    color: #fff;
    box-shadow: var(--shadow);
}

#register-button {
    background: var(--mint);
    color: var(--text);
}

.message {
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}

.message.success {
    background: #e8f8ef;
    color: #2d6a4f;
    display: block;
}

.message.error {
    background: #ffe8ec;
    color: #c9184a;
    display: block;
}

/* Mobile */
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: inline-flex !important; }

    .fab {
        display: flex;
    }

    .main-header {
        padding: 10px 14px;
    }

    .header-brand h1 {
        font-size: 1.25rem;
    }

    .notes-main {
        padding: 12px 14px calc(var(--fab-size) + 32px + var(--safe-bottom));
    }

    .notes-container {
        grid-template-columns: 1fr;
    }

    .note-card {
        min-height: 180px;
    }

    .note-card-actions {
        opacity: 1;
    }

    .modal-container {
        padding: 0;
        background: var(--surface);
        align-items: stretch;
    }

    .modal-content.modal-note {
        max-width: none;
        max-height: none;
        min-height: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .note-form-scroll {
        flex: 1;
    }

    .note-content-editor {
        min-height: 200px;
    }

    .form-label-desktop {
        display: none;
    }

    #note-title {
        border: none;
        border-bottom: 2px solid var(--border);
        border-radius: 0;
        padding: 12px 0;
        background: transparent;
    }

    .style-buttons {
        position: sticky;
        bottom: 0;
    }
}

@media (min-width: 769px) {
    .compose-bar {
        max-width: 520px;
    }

    .app-sidebar {
        transform: translateX(0);
    }

    /* Desktop: reserve space for the fixed sidebar so content isn't covered */
    .app-body {
        margin-left: var(--sidebar-w);
        width: calc(100% - var(--sidebar-w));
        transition: margin-left 0.25s ease;
    }

    .app-wrapper.sidebar-collapsed .app-body {
        margin-left: var(--sidebar-w-collapsed);
        width: calc(100% - var(--sidebar-w-collapsed));
    }

    .sidebar-backdrop {
        display: none !important;
    }
}
