body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: Arial, sans-serif;
    font-size: 16px;
    margin: 0;
    padding: 20px;
    overflow-x: hidden;
}

/* Navigation */
#nav {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    z-index: 20;
}

.nav-right {
    display: flex;
}

button, a {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
    opacity: 0.5;
    margin-left: 10px;
}

button:hover, a:hover {
    transform: scale(1.1);
    color: #007bff;
    opacity: 1;
}

/* Editor Mode */
.editor-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding-top: 60px; /* Space for nav */
    padding-bottom: 60px;
}

.template-container {
    position: relative;
}

#template {
    min-height: 200px;
    padding: 10px;
    color: #e0e0e0;
    white-space: pre-wrap;
    outline: none;
}

#template:focus {
    outline: none;
    box-shadow: none;
}

#template-placeholder {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #666;
    pointer-events: none;
    display: none;
}

#template:empty ~ #template-placeholder {
    display: block;
}

/* Generator Mode */
#input-fields, #no-fields {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding-top: 60px; /* Space for nav */
}

#no-fields {
    text-align: center;
}

#no-fields h2 {
    margin-bottom: 10px;
}

#no-fields ul {
    list-style: none;
    padding: 0;
}

#no-fields li {
    margin: 5px 0;
}

.field {
    margin: 15px 0;
    width: 100%;
    max-width: 800px;
}

.field label {
    color: #888;
    margin-bottom: 5px;
    display: block;
}

.editable-input {
    min-height: 40px;
    padding: 5px;
    color: #e0e0e0;
    border-bottom: 1px solid #666;
    outline: none;
    transition: border-color 0.2s ease;
    overflow: auto;
    background: none;
}

.editable-input:hover, .editable-input:focus {
    border-color: #007bff;
}

/* Preview Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.overlay-content {
    background: #333;
    color: #e0e0e0;
    padding: 20px;
    max-width: 80%;
    max-height: 80%;
    overflow: auto;
}

/* Popup */
.popup {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    color: #e0e0e0;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.popup.show {
    opacity: 0.5;
    transform: translateX(-50%) translateY(0);
}

.warning-popup {
    position: fixed;
    bottom: 70px; /* Above regular popup */
    left: 50%;
    transform: translateX(-50%);
    background: red;
    color: white;
    padding: 10px;
}

/* Mode Transition */
.mode {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    #nav {
        flex-direction: column;
        align-items: center;
    }
    .nav-right {
        margin-top: 10px;
    }
    button {
        font-size: 18px;
        margin: 5px;
    }
    .editor-wrapper, #input-fields, #no-fields {
        padding-top: 120px; /* More space for stacked nav */
    }
}