/* style.css */
:root {
    --bg-main: #ffffff;
    --bg-sidebar: #f5f5f7;
    --bg-card: rgba(245, 245, 247, 0.7);
    --text-main: #000000;
    --text-muted: #86868b;
    --accent: #af52de;
    --danger: #ff3b30;
    --border-color: rgba(0, 0, 0, 0.1);
    --hover-color: #e5e5ea;
    --active-color: #d1d1d6;
    --dot-color: rgba(0, 0, 0, 0.05);
    --glow-color: rgba(175, 82, 222, 0.2);
    --btn-bg: rgba(175, 82, 222, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #141416;
        --bg-sidebar: #08080a;
        --bg-card: rgba(30, 30, 34, 0.45);
        --text-main: #ffffff;
        --text-muted: #98989d;
        --accent: #bf5af2;
        --danger: #ff453a;
        --border-color: rgba(255, 255, 255, 0.08);
        --hover-color: #2c2c2e;
        --active-color: #3a3a3c;
        --dot-color: rgba(255, 255, 255, 0.03);
        --glow-color: rgba(191, 90, 242, 0.255);
        --btn-bg: rgba(191, 90, 242, 0.15);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    color: var(--text-main);
    background-color: var(--bg-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
}

#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    overflow: hidden;
}

#loadingScreen h1 {
    font-size: 46px;
    font-weight: 700;
    letter-spacing: -1px;
    position: relative;
    z-index: 2;
    opacity: 0;
    animation: charmFade 2.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 1;
    opacity: 0;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(99, 102, 241, 0.3));
    margin-right: 150px;
    margin-bottom: 100px;
    animation: blobFloat1 2.2s ease forwards;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, rgba(217, 70, 239, 0.3), rgba(139, 92, 246, 0.3));
    margin-left: 200px;
    margin-top: 150px;
    animation: blobFloat2 2.2s ease forwards;
}

@keyframes charmFade {
    0% { opacity: 0; transform: translateY(20px) scale(0.95); }
    20% { opacity: 1; transform: translateY(0) scale(1); }
    80% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-10px) scale(1.05); }
}

@keyframes blobFloat1 {
    0% { opacity: 0; transform: scale(0.8) translate(-20px, -20px); }
    30% { opacity: 1; transform: scale(1.1) translate(0, 0); }
    80% { opacity: 1; transform: scale(1) translate(10px, 10px); }
    100% { opacity: 0; transform: scale(1.2) translate(20px, 20px); }
}

@keyframes blobFloat2 {
    0% { opacity: 0; transform: scale(0.8) translate(20px, 20px); }
    30% { opacity: 1; transform: scale(1.1) translate(0, 0); }
    80% { opacity: 1; transform: scale(1) translate(-10px, -10px); }
    100% { opacity: 0; transform: scale(1.2) translate(-20px, -20px); }
}

.hide-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 280px;
    min-width: 250px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px 15px 20px;
}

.sidebar h2 {
    font-size: 20px;
    font-weight: 600;
}

.search-container {
    padding: 0 15px 10px 15px;
}

#searchNotes {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-main);
    outline: none;
    font-size: 13px;
    transition: border-color 0.2s ease;
}

#searchNotes:focus {
    border-color: var(--accent);
}

.new-btn {
    background: var(--accent);
    color: #ffffff;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.new-btn:hover {
    box-shadow: 0 4px 15px var(--glow-color);
    transform: translateY(-1px);
}

.notes-container {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
}

.note-item {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.15s ease;
}

.note-item:hover {
    background: var(--hover-color);
}

.note-item.active {
    background: var(--active-color);
    font-weight: 600;
}

.editor {
    flex: 1;
    display: flex;
    padding: 40px;
    background-color: var(--bg-main);
    background-image: radial-gradient(var(--dot-color) 1.5px, transparent 1.5px);
    background-size: 32px 32px;
}

.display-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    padding: 40px 50px;
    border-radius: 28px;
    width: 100%;
    height: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    justify-content: flex-end; 
    margin-bottom: 24px;
}

.editor-header button {
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 18px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.back-btn {
    color: var(--accent);
    display: none;
}

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

.delete-btn {
    background: rgba(255, 59, 48, 0.08);
    color: var(--danger);
    border: 1px solid rgba(255, 59, 48, 0.15);
}

.delete-btn:hover {
    background: var(--danger);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
}

#noteTitle {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 20px;
    background: transparent;
    color: var(--text-main);
    border: none;
    outline: none;
    width: 100%;
}

.editor-relative-container {
    position: relative;
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#noteBox {
    flex: 1;
    font-size: 18px;
    line-height: 1.6;
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    overflow-y: auto;
    caret-color: currentColor;
}

#paintCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#paintCanvas.active {
    pointer-events: auto;
}

#eraserCursor {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    pointer-events: none;
    display: none;
    z-index: 5;
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
}

#noteBox h2 {
    font-size: 28px;
    font-weight: 700;
    margin-top: 16px;
    margin-bottom: 8px;
}

#noteBox[placeholder]:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
}

#noteTitle::placeholder {
    color: var(--text-muted);
}

.formatting-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 15px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    z-index: 2;
    flex-wrap: wrap;
}

.formatting-bar button {
    background: var(--btn-bg);
    color: var(--accent);
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 16px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.formatting-bar button:hover {
    background: var(--accent);
    color: #ffffff;
}

.formatting-bar button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: transparent;
    color: var(--text-muted);
}

.formatting-bar button:disabled:hover {
    background: transparent;
    color: var(--text-muted);
    transform: none;
}

.formatting-bar button.selected {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--glow-color);
}

.formatting-bar .divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 4px;
}

.color-palette {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding-left: 10px;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

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

.color-dot.active {
    border-color: var(--text-main);
    transform: scale(1.1);
}

.color-default { background-color: var(--text-main); }
.color-purple { background-color: #bf5af2; }
.color-blue { background-color: #0a84ff; }
.color-green { background-color: #30d158; }
.color-red { background-color: #ff453a; }

@media (max-width: 768px) {
    #loadingScreen h1 {
        font-size: 32px;
    }
    
    .blob-1, .blob-2 {
        width: 250px;
        height: 250px;
    }

    .sidebar {
        width: 100vw;
        min-width: 100vw;
        border-right: none;
    }

    .editor {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        padding: 0;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
        z-index: 10;
        background-color: var(--bg-main);
        background-image: radial-gradient(var(--dot-color) 1.5px, transparent 1.5px);
        background-size: 32px 32px;
    }

    .container.note-open .editor {
        transform: translateX(0);
    }

    .display-card {
        border-radius: 0;
        border: none;
        padding: 40px 24px;
    }

    .editor-header {
        justify-content: space-between;
    }

    .back-btn {
        display: block;
    }

    #noteTitle {
        font-size: 36px;
    }

    #noteBox {
        font-size: 16px;
    }
    
    .color-palette {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
        padding-top: 10px;
        padding-left: 0;
    }
    
    .formatting-bar .divider {
        display: none;
    }
} 