/* Modal styles with improved aesthetics */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: var(--ui-surface);
    padding: 15px;
    border-radius: 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 100%;
    transform: translateY(0);
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--ui-text);
    transition: color 0.2s;
}

.modal-close:hover {
    color: #f44336;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 13px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 0;
    box-sizing: border-box;
    background-color: var(--ui-surface-raised);
    color: var(--ui-text);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #2196F3;
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

/* Reset native dialog geometry while retaining the existing full-screen overlay. */
dialog.modal-overlay {
    margin: 0; padding: 0; border: 0; color: inherit; box-sizing: border-box;
    width: 100%; height: 100%; max-width: none; max-height: none;
}
dialog.modal-overlay[open] { display: flex; }
dialog.modal-overlay::backdrop { background: transparent; }
.modal-content { max-height: calc(100dvh - 30px); overflow-y: auto; }
@media (max-width: 460px) {
    .modal-overlay .modal-content { max-width: calc(100% - 54px); }
}
@media (prefers-reduced-motion: reduce) {
    .modal-content { animation: none; }
}