/* ==========================
   RESET & BASE
========================== */

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

body {
    background-color: #000;
    color: #fff;
    font-family: 'Domine', serif;
    height: 100vh;
    overflow: hidden;
}

/* ==========================
   LAYOUT
========================== */

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 40px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    margin-top: 10px;
}

.title {
    font-size: 48px;
    font-weight: 300;
    letter-spacing: 1px;
}

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

/* ==========================
   BUTTONS
========================== */

.btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-family: 'Domine', serif;
    backdrop-filter: blur(6px);
}

.btn:hover {
    border-color: #fff;
    background-color: rgba(255,255,255,0.06);
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-icon {
    font-size: 14px;
}

/* ==========================
   EDITOR
========================== */

.editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.textarea {
    width: 100%;
    height: 100%;
    background-color: #000;
    color: #fff;
    border: none;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    resize: none;
    outline: none;
    line-height: 1.8;
    padding: 0;
    letter-spacing: 0.5px;
}

.textarea::placeholder {
    color: #444;
}

/* Scrollbar */

.textarea::-webkit-scrollbar { width: 8px; }
.textarea::-webkit-scrollbar-track { background: #000; }
.textarea::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
.textarea::-webkit-scrollbar-thumb:hover { background: #666; }

/* ==========================
   TOAST
========================== */

#toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-family: 'Domine', serif;
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    z-index: 9999;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================
   MY NOTEPADS PANEL — OVERLAY
========================== */

#panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 100;
}

#panel-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* ==========================
   MY NOTEPADS PANEL — DRAWER
========================== */

#panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 100vw;
    height: 100vh;
    background: #0d0d0d;
    border-left: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 101;
}

#panel.open {
    transform: translateX(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.panel-title {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: #fff;
}

.panel-close {
    background: none;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
    font-family: monospace;
}

.panel-close:hover { color: #fff; }

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 24px;
}

.panel-body::-webkit-scrollbar { width: 5px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 3px; }

.panel-empty {
    text-align: center;
    color: #555;
    font-size: 14px;
    margin-top: 60px;
    line-height: 2.2;
}

/* ==========================
   NOTE CARDS
========================== */

.note-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 10px;
    transition: border-color 0.2s, background 0.2s;
}

.note-card.active-note {
    border-color: rgba(255,255,255,0.28);
    background: rgba(255,255,255,0.04);
}

.note-card:not(.active-note):hover {
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.02);
}

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

.note-preview {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-meta {
    font-size: 11px;
    color: #555;
    margin-top: 5px;
    font-family: 'Domine', serif;
}

.note-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.note-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.13);
    color: #999;
    font-size: 12px;
    padding: 5px 9px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Domine', serif;
}

.note-btn:hover {
    border-color: rgba(255,255,255,0.35);
    color: #fff;
}

.note-btn.delete-btn:hover {
    border-color: rgba(255,70,70,0.45);
    color: #ff6060;
    background: rgba(255,50,50,0.07);
}

/* ==========================
   PANEL FOOTER
========================== */

.panel-footer {
    padding: 14px 24px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
    color: #444;
    text-align: center;
    flex-shrink: 0;
}

/* ==========================
   LIMIT OVERLAY
========================== */

#limit-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 14px;
    text-align: center;
    pointer-events: none;
}

.editor-container.limit-active .textarea {
    display: none;
}

.editor-container.limit-active #limit-overlay {
    display: flex;
    pointer-events: all;
}

.limit-icon {
    font-size: 32px;
}

.limit-title {
    font-size: 20px;
    font-weight: 300;
    letter-spacing: 0.5px;
    color: #fff;
}

.limit-body {
    font-size: 14px;
    color: #666;
    max-width: 320px;
    line-height: 2;
}

.limit-body strong {
    color: #999;
    font-weight: 400;
}


/* ==========================
   MOBILE RESPONSIVE
========================== */

@media (max-width: 768px) {

    /* Prevent horizontal overflow on the whole page */
    html, body {
        overflow-x: hidden;
        height: auto;
        min-height: 100%;
    }

    .container {
        height: auto;
        min-height: 100dvh;
        padding: 24px 20px 16px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        margin-bottom: 20px;
        margin-top: 0;
    }

    .title {
        font-size: 42px;
        letter-spacing: 1px;
    }

    .actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .btn {
        font-size: 14px;
        padding: 8px 14px;
        border-radius: 10px;
        flex: 0 0 auto;
    }

    .btn-icon {
        font-size: 14px;
    }

    .editor-container {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    /* 16px minimum prevents iOS Safari auto-zoom on focus */
    .textarea {
        font-size: 17px;
        line-height: 1.8;
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }

    /* Panel: full screen width, slide from right */
    #panel {
        width: 100vw;
        max-width: 100vw;
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.08);
    }

    .panel-header {
        padding: 22px 20px 16px;
    }

    .panel-title {
        font-size: 18px;
    }

    .panel-body {
        padding: 14px 16px 24px;
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }

    .note-card {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px 12px;
    }

    .note-info {
        min-width: 0;
        flex: 1 1 100%;
    }

    .note-preview {
        font-size: 14px;
    }

    .note-meta {
        font-size: 12px;
    }

    .note-actions {
        flex: 0 0 auto;
        width: 100%;
        justify-content: flex-end;
    }

    .note-btn {
        font-size: 13px;
        padding: 6px 12px;
    }

    #toast {
        font-size: 13px;
        padding: 10px 18px;
        bottom: 24px;
        white-space: normal;
        text-align: center;
        max-width: 85vw;
        width: max-content;
    }

    .limit-title { font-size: 20px; }
    .limit-body  { font-size: 14px; }
}

@media (max-width: 480px) {
    .title {
        font-size: 36px;
    }

    .btn {
        font-size: 13px;
        padding: 7px 12px;
    }
}
