:root {
    --bg-color: #050b14;
    --surface-color: rgba(16, 24, 39, 0.6);
    --surface-hover: rgba(30, 41, 59, 0.8);
    --primary-color: #3b82f6;
    --primary-gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-gradient-end, #8b5cf6) 100%);
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.2);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --hover-bg-active: rgba(255, 255, 255, 0.1);
    --sidebar-bg: rgba(10, 15, 30, 0.95);
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-bg-focus: rgba(0, 0, 0, 0.4);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-color: #f8fafc;
    --surface-color: rgba(255, 255, 255, 0.8);
    --surface-hover: rgba(241, 245, 249, 0.9);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --hover-bg-active: rgba(0, 0, 0, 0.1);
    --sidebar-bg: rgba(248, 250, 252, 0.95);
    --input-bg: rgba(0, 0, 0, 0.05);
    --input-bg-focus: rgba(0, 0, 0, 0.1);
}

body {
    transition: background-color 0.4s ease, color 0.4s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    height: -webkit-fill-available;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.12) 0px, transparent 50%);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--app-vh, 1vh) * 100);
    min-height: -webkit-fill-available;
    overflow: hidden;
    overscroll-behavior: none;
    padding:
        env(safe-area-inset-top, 0px)
        env(safe-area-inset-right, 0px)
        env(safe-area-inset-bottom, 0px)
        env(safe-area-inset-left, 0px);
}

#app-container {
    width: 100%;
    max-width: 1200px;
    flex: 1;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Dil seçici — fixed; body flex layout'unu bozmaz */
.language-selector-container {
    position: fixed;
    top: max(10px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 1100;
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
}

.language-selector-container.is-hidden-on-app {
    display: none !important;
}

.lang-select {
    pointer-events: auto;
    padding: 8px 14px;
    min-height: 40px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    font-weight: 600;
    box-shadow: var(--shadow);
    max-width: 42vw;
}

/* ---- View sistemi ---- */
.view {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.view.active {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* auth-view ve diğer view'ların kendi display:flex kuralları .view.active'e devredildi */
#auth-view,
#google-security-view,
#recovery-view {
    display: none;
}
#auth-view.active,
#google-security-view.active,
#recovery-view.active {
    display: flex !important;
}

#auth-view.active {
    justify-content: flex-start;
    align-items: center;
    padding: 20px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 20px;
}

#google-security-view.active,
#recovery-view.active {
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
    gap: 20px;
    align-content: center;
}

.hidden {
    display: none !important;
}

/* On wide screens, go side-by-side */
@media (min-width: 901px) {
    #auth-view.active {
        flex-direction: row !important;
        justify-content: center;
        align-items: center;
        padding: 40px;
        gap: 60px;
    }
    .promo-container {
        flex: 1 1 50%;
        max-width: 500px;
        min-width: 300px;
        text-align: left;
    }
    .auth-card {
        flex: 1 1 50%;
        max-width: 420px;
        width: 100%;
    }
}

/* Fade animasyonu için opacity transition */
.view {
    transition: opacity 0.3s ease;
    opacity: 1;
}

.promo-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    color: var(--text-main);
    animation: fadeIn 0.8s ease forwards;
    box-sizing: border-box;
}

.promo-container h2 {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 15px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.promo-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 25px;
}

.promo-feature-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.promo-feature-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.promo-feature-text h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text-main);
}

.promo-feature-text p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.auth-card {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    width: 100%;
    max-width: 100%; /* Full width on mobile by default */
    min-width: 0;
    padding: 36px 32px 32px;
    border-radius: 20px;
    box-sizing: border-box;
    box-shadow: 
        0 20px 60px -15px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.06);
    border: none;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .auth-card {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 
        0 20px 60px -15px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.06);
}

.logo-wrapper {
    text-align: center;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.logo-wrapper h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    padding: 13px 16px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
}

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

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: var(--input-bg-focus);
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn.primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn.outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn.outline:hover {
    background: var(--hover-bg);
    border-color: var(--text-muted);
}

.btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn.danger:hover {
    background: var(--danger);
    color: white;
}

#sort-select option {
    background-color: #1e293b; /* Sleek dark option background */
    color: #f8fafc;
}

[data-theme="light"] #sort-select option {
    background-color: #ffffff;
    color: #0f172a;
}

.btn.icon-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 10px;
    border-radius: 50%;
}

.btn.icon-btn:hover {
    background: var(--hover-bg);
    color: var(--text-color);
    transform: rotate(15deg);
}

.message {
    margin-top: 20px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 12px;
    transition: var(--transition);
    display: none;
    animation: fadeIn 0.3s ease;
}

.message:not(:empty) {
    display: block;
}

.message.error { 
    background: rgba(239, 68, 68, 0.12);
    color: #f87171; 
    border: 1.5px solid rgba(239, 68, 68, 0.4);
}

[data-theme="light"] .message.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1.5px solid #fee2e2;
}

.message.success { 
    background: rgba(16, 185, 129, 0.12);
    color: #34d399; 
    border: 1.5px solid rgba(16, 185, 129, 0.4);
}

[data-theme="light"] .message.success {
    background: #f0fdf4;
    color: #15803d;
    border: 1.5px solid #dcfce7;
}

/* Main View */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    z-index: 5;
}

.app-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.notes-container {
    flex: 1;
    min-height: 0;       /* flex child scroll için şart */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    gap: 14px;
    /* Scroll alanının sabit yükseklikte kalması için */
    height: 0;
}

.notes-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    align-content: start;
}

.notes-container.list-view {
    display: flex;
    flex-direction: column;
}

/* ColorNote Sticky Note Cards */
.note-card {
    border-radius: 14px;
    padding: 16px 18px;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
    animation: fadeIn 0.3s ease forwards;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    justify-content: space-between;
    min-height: 120px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.note-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.note-card.selected {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.note-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.2px;
    word-break: break-word;
    margin-bottom: 6px;
    line-height: 1.3;
}

[data-theme="dark"] .note-card h3 {
    color: #f0f0f0;
}

/* Hide contents in both grid-view and list-view cards so only titles are visible on the dashboard */
.note-card p,
.note-card .checklist-preview {
    display: none !important;
}

.notes-container.grid-view .note-card {
    min-height: 80px;
}

.notes-container.list-view .note-card {
    min-height: 56px;
    padding: 12px 18px;
}

.note-card p {
    color: #3d3d3d;
    font-size: 0.85rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    opacity: 0.8;
}

[data-theme="dark"] .note-card p {
    color: #d0d0d0;
}

/* ColorNote Color Variants — Solid pastel backgrounds */
.note-card.color-yellow { background: #fff9c4; border-left: 4px solid #f9a825; }
.note-card.color-blue   { background: #bbdefb; border-left: 4px solid #1565c0; }
.note-card.color-green  { background: #c8e6c9; border-left: 4px solid #2e7d32; }
.note-card.color-pink   { background: #f8bbd0; border-left: 4px solid #c2185b; }
.note-card.color-purple { background: #e1bee7; border-left: 4px solid #7b1fa2; }
.note-card.color-orange { background: #ffe0b2; border-left: 4px solid #e65100; }
.note-card.color-red    { background: #ffcdd2; border-left: 4px solid #c62828; }
.note-card.color-gray   { background: #e0e0e0; border-left: 4px solid #616161; }

/* Dark mode color variants — deeper tones */
[data-theme="dark"] .note-card.color-yellow { background: rgba(249, 168, 37, 0.2); border-left-color: #fbc02d; }
[data-theme="dark"] .note-card.color-blue   { background: rgba(21, 101, 192, 0.2); border-left-color: #42a5f5; }
[data-theme="dark"] .note-card.color-green  { background: rgba(46, 125, 50, 0.2);  border-left-color: #66bb6a; }
[data-theme="dark"] .note-card.color-pink   { background: rgba(194, 24, 91, 0.2);  border-left-color: #ec407a; }
[data-theme="dark"] .note-card.color-purple { background: rgba(123, 31, 162, 0.2); border-left-color: #ab47bc; }
[data-theme="dark"] .note-card.color-orange { background: rgba(230, 81, 0, 0.2);   border-left-color: #ffa726; }
[data-theme="dark"] .note-card.color-red    { background: rgba(198, 40, 40, 0.2);  border-left-color: #ef5350; }
[data-theme="dark"] .note-card.color-gray   { background: rgba(97, 97, 97, 0.2);   border-left-color: #9e9e9e; }

/* Checklist Preview inside Card */
.checklist-preview {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
}

.checklist-preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: #3d3d3d;
}

[data-theme="dark"] .checklist-preview-item {
    color: #d0d0d0;
}

.checklist-preview-item.completed {
    text-decoration: line-through;
    opacity: 0.45;
}

.note-footer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .note-footer-meta {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.note-date {
    font-size: 0.7rem;
    color: #777;
    font-weight: 500;
}

[data-theme="dark"] .note-date {
    color: #999;
}

/* Color Picker Swatches */
.color-picker-container {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    overflow-x: auto;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.selected {
    border-color: #ffffff;
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.color-option[data-color="yellow"] { background-color: #fbc02d; }
.color-option[data-color="blue"]   { background-color: #1e88e5; }
.color-option[data-color="green"]  { background-color: #43a047; }
.color-option[data-color="pink"]   { background-color: #e91e63; }
.color-option[data-color="purple"] { background-color: #8e24aa; }
.color-option[data-color="orange"] { background-color: #fb8c00; }
.color-option[data-color="red"]    { background-color: #e53935; }
.color-option[data-color="gray"]   { background-color: #757575; }

/* Checklist Builder inside Editor */
.checklist-builder {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.checklist-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--input-bg);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.checklist-item-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checklist-item-row input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
}

.checklist-item-row.completed input[type="text"] {
    text-decoration: line-through;
    opacity: 0.5;
}

.btn-remove-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-remove-item:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* FAB — artık kullanılmıyor, footer'a taşındı */
.fab {
    display: none;
}

/* App Footer — Yeni Not butonu */
.app-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.fab-footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 32px;
    border-radius: 50px;
    background: var(--primary-gradient);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    letter-spacing: 0.2px;
}

.fab-footer-btn:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.65);
}

.fab-footer-btn:active {
    transform: scale(0.97);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: calc(var(--app-vh, 1vh) * 100);
    background: rgba(5, 11, 20, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    padding:
        max(12px, env(safe-area-inset-top, 0px))
        max(12px, env(safe-area-inset-right, 0px))
        max(12px, env(safe-area-inset-bottom, 0px))
        max(12px, env(safe-area-inset-left, 0px));
    transition: opacity 0.4s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 560px;
    max-height: min(90dvh, calc(var(--app-vh, 1vh) * 90));
    height: auto;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin: auto;
}

.modal.hidden .modal-content {
    transform: translateY(100%);
}

.modal-content--tall {
    height: min(80dvh, calc(var(--app-vh, 1vh) * 80));
    max-height: min(80dvh, calc(var(--app-vh, 1vh) * 80));
}

.modal-content--tall .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* ColorNote Fullscreen Editor & Notebook Styles */
.colornote-editor-content {
    background: #fff9c4 !important; /* Default yellow */
    color: #222222 !important;
    transition: background-color 0.25s ease;
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    max-width: 700px;
    height: 100%;
    height: 100dvh;
    height: calc(var(--app-vh, 1vh) * 100);
    max-height: 100%;
    max-height: 100dvh;
    max-height: calc(var(--app-vh, 1vh) * 100);
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
}

#editor-modal {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
}

#editor-modal .colornote-editor-content {
    max-width: none;
}

/* Büyük ekranda kart görünümü */
@media (min-width: 768px) {
    #editor-modal {
        padding: 20px;
        align-items: center;
        justify-content: center;
    }

    .colornote-editor-content {
        height: 85dvh !important;
        max-height: 85dvh !important;
        max-width: 700px !important;
        border-radius: 20px !important;
        box-shadow: 0 25px 60px rgba(0,0,0,0.35) !important;
    }
}

/* Editor top bar */
.editor-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    flex-shrink: 0;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.editor-top-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.editor-top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.note-title-input {
    font-size: 1.1rem !important;
    font-weight: 600;
    background: transparent;
    border: none;
    outline: none;
    padding: 6px 0;
    width: 100%;
    min-width: 0;
    flex: 1;
    color: #111111 !important;
}

.note-title-input::placeholder {
    color: rgba(0,0,0,0.4);
}

.editor-close-btn {
    color: inherit !important;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
}

.note-type-toggle {
    display: inline-flex;
    border-radius: 8px;
    background: rgba(0,0,0,0.06);
    padding: 2px;
    flex-shrink: 0;
}

.folder-select-box {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: rgba(0,0,0,0.06);
    border: none;
    border-radius: 8px;
    padding: 8px 30px 8px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22%23555%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M7.247%2011.14%202.451%205.658C1.885%205.013%202.345%204%203.204%204h9.592a1%201%200%200%201%20.753%201.659l-4.796%205.48a1%201%200%200%201-1.506%200z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    outline: none;
    flex-shrink: 0;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.folder-select-box:hover {
    background-color: rgba(0,0,0,0.1);
}

.folder-select-box:focus {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

.type-toggle-btn {
    padding: 8px 10px;
    font-size: 0.78rem;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #333;
    font-weight: 600;
    white-space: nowrap;
    min-height: 36px;
}

.type-toggle-btn.active {
    background: rgba(255,255,255,0.75);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.btn-save-note {
    background: rgba(0,0,0,0.08);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: #111;
    min-height: 40px;
    white-space: nowrap;
}

.editor-color-picker {
    padding: 10px 16px !important;
    background: rgba(0,0,0,0.03);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

.notebook-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    position: relative;
    min-height: 0;
    background: transparent;
}

.notebook-paper-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 200px;
    background: transparent;
}

.note-content-area {
    flex: 1;
    min-height: 200px;
    background: transparent;
    border: none;
    resize: none;
    font-size: 16px; /* iOS zoom engeli */
    line-height: 32px;
    outline: none;
    z-index: 2;
    color: #222222;
    font-family: inherit;
    width: 100%;
    -webkit-user-select: text;
    user-select: text;
}

.paper-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        transparent, transparent 31px,
        rgba(0, 0, 0, 0.06) 31px, rgba(0, 0, 0, 0.06) 32px
    );
    pointer-events: none;
    z-index: 1;
    margin-top: 6px;
}

.checklist-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2;
}

.checklist-area.hidden {
    display: none !important;
}

.btn-add-checklist {
    margin-top: 10px;
    text-align: left;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 500;
    min-height: 44px;
}

.reminder-field {
    margin-top: 24px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    padding-top: 14px;
    z-index: 2;
    flex-shrink: 0;
}

.reminder-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(0,0,0,0.5);
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}

.reminder-field input[type="datetime-local"] {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1.5px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.6);
    color: #222222;
    font-size: 16px; /* iOS zoom engeli */
    min-height: 44px;
}

.colornote-editor-content .editor-top-bar {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.colornote-editor-content input#note-title {
    color: #111111 !important;
}
.colornote-editor-content input#note-title::placeholder {
    color: rgba(0,0,0,0.4);
}

/* Dynamic Editor Color Theme Classes */
.colornote-editor-content.color-yellow { background: #fff9c4 !important; }
.colornote-editor-content.color-blue   { background: #bbdefb !important; }
.colornote-editor-content.color-green  { background: #c8e6c9 !important; }
.colornote-editor-content.color-pink   { background: #f8bbd0 !important; }
.colornote-editor-content.color-purple { background: #e1bee7 !important; }
.colornote-editor-content.color-orange { background: #ffe0b2 !important; }
.colornote-editor-content.color-red    { background: #ffcdd2 !important; }
.colornote-editor-content.color-gray   { background: #e0e0e0 !important; }

/* In dark mode, we keep editor content readable and paper-colored, or adapt slightly */
[data-theme="dark"] .colornote-editor-content {
    color: #111111 !important; /* Keep it look like physical paper even in dark mode for that paper notebook aesthetic */
}

.checklist-builder .checklist-item-row {
    background: rgba(255, 255, 255, 0.35) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #111111 !important;
}

.checklist-item-row input[type="text"] {
    color: #111111 !important;
}
.checklist-item-row input[type="text"]::placeholder {
    color: rgba(0,0,0,0.4);
}

.modal-header {
    padding: 25px 30px;
    display: flex;
    gap: 15px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.modal-header input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.4rem;
    font-weight: 700;
}

.modal-header input:focus {
    outline: none;
}

.modal-body {
    flex: 1;
    padding: 25px 30px;
    display: flex;
    flex-direction: column;
}

.modal-body textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.7;
    resize: none;
}

.modal-body textarea:focus {
    outline: none;
}

.modal-footer {
    padding: 25px 30px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px solid var(--border-color);
}

.modal-footer .btn {
    flex: none;
    padding: 12px 30px;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes loadingBar {
    0%   { transform: translateX(-100%); }
    50%  { transform: translateX(150%); }
    100% { transform: translateX(-100%); }
}

.loading-splash,
#loading-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: calc(var(--app-vh, 1vh) * 100);
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 20px;
    transition: opacity 0.35s ease;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
#loading-splash.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* --- Layout & Sidebar --- */
#main-view {
    flex-direction: row;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    min-height: 0;
}

.app-sidebar {
    width: 280px;
    min-width: 280px;
    min-height: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--hover-bg-active);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary-rgba-15, rgba(59, 130, 246, 0.15));
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.sidebar-footer {
    padding: 20px 10px;
    border-top: 1px solid var(--border-color);
}

.text-danger {
    color: var(--danger) !important;
}
.text-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

.app-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.content-header {
    display: flex;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.content-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
}

.mobile-menu-btn {
    display: none;
    margin-right: 8px;
    min-width: 44px;
    min-height: 44px;
}

.mobile-menu-close {
    display: none;
    min-width: 44px;
    min-height: 44px;
}

/* Sidebar overlay (mobil) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

body.sidebar-open {
    overflow: hidden;
}

/* Notes header */
.notes-header {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px;
    padding: 12px 16px !important;
    background: var(--surface-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
    flex-shrink: 0;
}

.notes-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.notes-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.notes-title {
    font-size: 1.2rem !important;
    display: flex !important;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.network-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.3s;
}

.notes-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sort-select {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    max-width: 42vw;
    min-height: 40px;
}

.notes-search-wrap {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.search-field {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search-field input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 16px; /* iOS otomatik zoom engeli */
    outline: none;
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
}

.search-field input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* List Note Cards */
.notes-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    -webkit-overflow-scrolling: touch;
}

/* Responsive — max-width:900px is handled by mobile-first base styles above */
/* Only typography tweaks and feature hiding here */
@media (max-width: 900px) {
    .promo-container {
        text-align: center;
        padding-top: 48px; /* dil seçici için boşluk */
    }

    .promo-container h2 {
        font-size: 1.8rem;
        margin-bottom: 10px;
        word-break: break-word;
    }

    .promo-container p {
        font-size: 0.88rem;
        word-break: break-word;
    }

    .promo-features {
        display: none !important;
    }

    .auth-card {
        padding: 28px 24px 24px;
    }

    #auth-view.active,
    #google-security-view.active,
    #recovery-view.active {
        padding-top: 56px;
    }
}

@media (max-width: 768px) {
    #app-container {
        max-width: 100%;
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        height: 100dvh;
        height: calc(var(--app-vh, 1vh) * 100);
        width: min(300px, 86vw);
        min-width: 0;
        max-width: 300px;
        transform: translateX(-105%);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 100;
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
    }

    .mobile-menu-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-close {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .nav-item {
        min-height: 48px;
        padding: 14px 18px;
    }

    /* Modal kartları mobilde daha geniş */
    .modal-content {
        max-width: 100%;
        border-radius: 18px;
    }

    .modal-header {
        padding: 16px 18px;
    }

    .modal-body {
        padding: 16px 18px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        padding: 14px 18px;
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
        min-height: 44px;
    }

    /* iOS: input focus zoom engeli */
    .input-group input,
    .input-group select,
    .input-group textarea,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="datetime-local"],
    select,
    textarea {
        font-size: 16px !important;
    }

    .btn {
        min-height: 44px;
    }

    .btn.icon-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .fab-footer-btn {
        width: 100%;
        max-width: 420px;
        justify-content: center;
        min-height: 48px;
        padding: 14px 24px;
    }

    .notes-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    /* Touch: hover transform'ları kapat */
    .note-card:hover {
        transform: none;
    }

    .btn.primary:hover {
        transform: none;
    }

    .btn.icon-btn:hover {
        transform: none;
        background: transparent;
    }
    
    .btn.icon-btn:active {
        background: var(--hover-bg);
        transform: rotate(15deg) scale(0.92);
        color: var(--text-color);
    }
}

@media (max-width: 600px) {
    #auth-view.active {
        padding: 56px 14px 20px !important;
        gap: 16px !important;
    }

    .promo-container h2 {
        font-size: 1.45rem !important;
        line-height: 1.25;
    }

    .auth-card {
        padding: 22px 16px 18px !important;
        border-radius: 16px;
    }

    .promo-container div[style*="display: flex"] {
        justify-content: center;
        width: 100%;
    }

    #btn-install-android, #btn-install-iphone {
        width: 100% !important;
        min-width: 100% !important;
    }

    .app-header {
        padding: 12px 14px !important;
    }

    .notes-header {
        padding: 10px 12px !important;
        gap: 10px;
    }

    .notes-title {
        font-size: 1.05rem !important;
    }

    .sort-select {
        max-width: 38vw;
        font-size: 0.8rem;
        padding: 8px;
    }

    .notes-container {
        padding: 10px !important;
        gap: 10px !important;
    }

    .notes-container.grid-view {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .note-card {
        padding: 12px 12px !important;
        min-height: 72px;
    }

    .note-card h3 {
        font-size: 0.92rem;
    }

    .editor-top-bar {
        padding: 8px 10px !important;
        padding-top: max(8px, env(safe-area-inset-top, 0px)) !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .editor-top-left {
        width: 100%;
    }

    .editor-top-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .type-toggle-btn {
        padding: 8px 8px;
        font-size: 0.72rem;
    }

    .btn-save-note .save-label {
        display: none; /* dar ekranda sadece ikon + emoji */
    }

    .btn-save-note {
        padding: 8px 10px;
    }

    .note-title-input {
        font-size: 1rem !important;
    }

    .app-footer {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    }

    /* Recovery codes / form butonları alt alta */
    #recovery-codes-modal .modal-body > div[style*="display: flex"] {
        flex-direction: column;
    }

    .lang-select {
        font-size: 0.8rem;
        padding: 7px 10px;
        min-height: 36px;
    }
}

/* Çok dar telefonlar */
@media (max-width: 380px) {
    .notes-container.grid-view {
        grid-template-columns: 1fr !important;
    }

    .type-toggle-btn {
        font-size: 0.68rem;
        padding: 6px 6px;
    }

    .notes-header-actions .btn.icon-btn {
        min-width: 40px;
        min-height: 40px;
    }
}

/* Landscape telefon: editör ve ana görünüm */
@media (max-height: 500px) and (orientation: landscape) {
    .promo-container {
        display: none;
    }

    .colornote-editor-content {
        height: 100% !important;
        max-height: 100% !important;
    }

    .notebook-body {
        padding: 10px 12px;
    }

    .note-content-area {
        min-height: 120px;
        line-height: 28px;
    }
}

.modal-actions-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.modal-actions-row .btn {
    flex: 1;
    min-height: 44px;
}

@media (max-width: 480px) {
    .modal-actions-row {
        flex-direction: column;
    }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hover-bg-active); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-color); }

/* Mobilde ince scrollbar */
@media (max-width: 768px) {
    ::-webkit-scrollbar { width: 4px; height: 4px; }
}

/* Hide FAB and ensure top add note button is visible */
.fab-footer-btn { display: none !important; }
#btn-add-note-header { display: inline-flex !important; }

