/* Layout & Typography */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    min-height: 100vh;
    background-color: #2f2f2f; /* dark grey border color */
    overflow: hidden;
}

#app-container {
    width: calc(100% - 100px);   /* 50px left + 50px right */
    height: calc(100% - 100px);  /* 50px top + 50px bottom */
    background: white;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 50px #2f2f2f; /* thick dark grey border */
    border: 1px solid #1f1f1f;
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
}

header {
    background-color: #f0f0f0;
    border-bottom: 1px solid #ccc;
    padding: 1px 0;
    flex-shrink: 0;
}

#notepad {
    flex: 1;
    padding: 10px 10px env(safe-area-inset-bottom, 10px);
    box-sizing: border-box;
    border: none;
    outline: none;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
}

#statusBar {
    background-color: #f0f0f0;
    border-top: 1px solid #ccc;
    padding: 5px 10px env(safe-area-inset-bottom, 5px);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    position: sticky;
    bottom: 0;
    z-index: 5000;
}

/* Menu System */
#menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    font-size: 14px;
}
#menu > li {
    position: relative;
    padding: 10px 18px; 
    cursor: pointer;
    user-select: none;
}
#menu > li:hover {
    background-color: #e0e0e0;
}
#menu > li:active {
    background-color: #cfcfcf;
}
#menu ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    padding: 7px 0;
    margin: 0;
    list-style: none;
    border: 1px solid #ccc;
    min-width: 180px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 9999;
}
#menu ul li {
    padding: 8px 18px;
    white-space: nowrap;
    cursor: pointer;
}
#menu ul li:hover {
    background-color: #f0f0f0;
}

/* Find/Replace Box */
#findReplaceBox {
    display: none;
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    padding: 14px;
    border: 1px solid #ccc;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: 10000;
    width: 340px;
    max-width: 90%;
    border-radius: 6px;
}
#findReplaceBox input[type="text"] {
    width: 220px;
    padding: 6px;
    margin-right: 6px;
    box-sizing: border-box;
}
#findReplaceBox button {
    padding: 6px 10px;
    cursor: pointer;
}
#findReplaceBox div {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

/* Modal Dialogs */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.3);
    justify-content: center;
    align-items: center;
    z-index: 11000;
}
.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    width: 320px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
}
.modal-content input[type="text"] {
    width: 100%;
    padding: 8px;
    margin: 12px 0 8px;
    box-sizing: border-box;
}
.modal-content button {
    padding: 6px 12px;
    margin: 4px;
    cursor: pointer;
    min-width: 70px;
}
.modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: #eee;
    border: none;
    width: 24px;
    height: 24px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
}

/* Hidden file input */
#fileInput {
    display: none;
}
